【问题标题】:Getting "InvalidParameterValue - Missing final '@domain'" from Amazon SES while sending an email with unicode characters in destination address在发送目标地址中包含 unicode 字符的电子邮件时,从 Amazon SES 获取“InvalidParameterValue - Missing final '@domain'”
【发布时间】:2014-02-13 20:10:23
【问题描述】:

当我尝试发送一封在收件人:字段中包含 unicode 字符的电子邮件时,Amazon SES 返回上述错误。 Amazon SES Documentation says 此类电子邮件地址应以 MIME 编码字语法发送,邮件 gem(由 ActionMailer 使用)正确执行,发送为:=?UTF-8?B?dmluYXl2aW5heeKAmXNAbWFpbGluYXRvci5jb20=?=

【问题讨论】:

    标签: amazon-web-services amazon-ses


    【解决方案1】:

    我看到了同样的错误,并发现这是由于 ReturnPath 参数不正确造成的。该错误表明您的 ReturnPath 参数没有域名。 ReturnPath 参数应该是一个电子邮件地址,它是退回通知被转发到的地址。

    【讨论】:

    • 填充ReturnPath 参数并没有为我解决这个问题。一定是别的东西。
    【解决方案2】:

    这个问题已经很老了,但我会添加我的案例,因为它似乎是在 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,
        )
    

    【讨论】:

      【解决方案3】:

      我刚刚收到此错误,因为我将电子邮件地址存储在 .cfg 文件中(该文件使用与 Windows .ini 文件相同的结构),并且我在电子邮件地址周围加上引号,就像程序员习惯使用字符串一样但你不应该在 cfg 文件中这样做:

      [email_settings]
      email_to="some_user@domain.com"
      

      当我删除引号时,它起作用了。我确定有多个问题会导致此错误。

      【讨论】:

        猜你喜欢
        • 2012-01-26
        • 2012-06-22
        • 1970-01-01
        • 1970-01-01
        • 2014-04-03
        • 1970-01-01
        • 2016-08-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多