这个问题已经很老了,但我会添加我的案例,因为它似乎是在 AWS SES 上搜索“Missing finale @domain”问题的第一个结果。
(我发现的唯一其他 SO 问题是 AWS SES Missing final '@domain' PHP SDK
)
与其他问题的答案一样,每次参数未通过验证时都会返回 InvalidParameterValue。
在我的例子中,我在 python 上使用 boto3,将 Destination 参数与一些可能为空的键组成,如下所示:
to = []
bcc = []
# Some code to populate one or both lists..
response = client.send_email(
Destination={
'ToAddresses': to,
'BccAddresses': bcc
},
Message={
'Body': {
'Html': {
'Charset': MAIL_CHARSET,
'Data': message,
},
'Text': {
'Charset': MAIL_CHARSET,
'Data': message,
},
},
'Subject': {
'Charset': MAIL_CHARSET,
'Data': subject,
},
},
Source=MAIL_SENDER,
)
如果分配给 Destination 参数的 dict 中的两个键之一是空列表,则返回 InvalidParameterValue。
解决方案是简单地删除空的、无用的键:
to = []
bcc = []
# Some code to populate one or both lists..
destinations = {
'ToAddresses': to,
'BccAddresses': bcc
}
response = client.send_email(
Destination={typ: addresses
for typ, addresses in destinations.iteritems()
if addresses},
Message={
'Body': {
'Html': {
'Charset': MAIL_CHARSET,
'Data': message,
},
'Text': {
'Charset': MAIL_CHARSET,
'Data': message,
},
},
'Subject': {
'Charset': MAIL_CHARSET,
'Data': subject,
},
},
Source=MAIL_SENDER,
)