我正在使用AWS SES发送电子邮件,而在未交付(退回)电子邮件时使用SNS进行通知。
这是一封未发送电子邮件时收到的退信:
{
"notificationType"=>"Bounce",
"bounce"=>{
"bounceType"=>"Permanent",
"bounceSubType"=>"General",
"bouncedRecipients"=>[{
"emailAddress"=>"something@somethnig.com",
"action"=>"failed", "status"=>"5.1.1", "diagnosticCode"=>"smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try\n550-5.1.1 double-checking the recipient's email address for typos or\n550-5.1.1 unnecessary spaces. Learn more at\n550 5.1.1 https://support.google.com/mail/?p=NoSuchUser b9si9302589pgt.293 - gsmtp"
}],
"timestamp"=>"2019-02-17T08:31:24.795Z",
"feedbackId"=>"...",
"remoteMtaIp"=>"IP",
"reportingMTA"=>"dsn; SOMETHING.smtp-out.us-west-2.amazonses.com"},
"mail"=>{"timestamp"=>"2019-02-17T08:31:24.000Z",
"source"=>"email@something.com",
"sourceArn"=>"AWS source",
"sourceIp"=>"IP",
"sendingAccountId"=>"ID #",
"messageId"=>"msg ID",
"destination"=>["email@adress.com"]
}
}
由于我有一个应用程序,每天有多个用户发送许多电子邮件,因此我需要确定哪些电子邮件失败了-上面的对象没有提供此信息。因此,我查看了AWS SES documentation,并在其中找到了bounce对象的以下响应:
{
"notificationType":"Bounce",
"bounce":{
"bounceType":"Permanent",
"reportingMTA":"dns; email.example.com",
"bouncedRecipients":[
{
"emailAddress":"jane@example.com",
"status":"5.1.1",
"action":"failed",
"diagnosticCode":"smtp; 550 5.1.1 <jane@example.com>... User"
}
],
"bounceSubType":"General",
"timestamp":"2016-01-27T14:59:38.237Z",
"feedbackId":"00000138111222aa-33322211-cccc-cccc-cccc-ddddaaaa068a-000000",
"remoteMtaIp":"127.0.2.0"
},
"mail":{
"timestamp":"2016-01-27T14:59:38.237Z",
"source":"john@example.com",
"sourceArn": "arn:aws:ses:us-west-2:888888888888:identity/example.com",
"sourceIp": "127.0.3.0",
"sendingAccountId":"123456789012",
"messageId":"00000138111222aa-33322211-cccc-cccc-cccc-ddddaaaa0680-000000",
"destination":[
"jane@example.com",
"mary@example.com",
"richard@example.com"],
"headersTruncated":false,
"headers":[
{
"name":"From",
"value":"\"John Doe\" <john@example.com>"
},
{
"name":"To",
"value":"\"Jane Doe\" <jane@example.com>, \"Mary Doe\" <mary@example.com>, \"Richard Doe\" <richard@example.com>"
},
{
"name":"Message-ID",
"value":"custom-message-ID"
},
{
"name":"Subject",
"value":"Hello"
},
{
"name":"Content-Type",
"value":"text/plain; charset=\"UTF-8\""
},
{
"name":"Content-Transfer-Encoding",
"value":"base64"
},
{
"name":"Date",
"value":"Wed, 27 Jan 2016 14:05:45 +0000"
}
],
"commonHeaders":{
"from":[
"John Doe <john@example.com>"
],
"date":"Wed, 27 Jan 2016 14:05:45 +0000",
"to":[
"Jane Doe <jane@example.com>, Mary Doe <mary@example.com>, Richard Doe <richard@example.com>"
],
"messageId":"custom-message-ID",
"subject":"Hello"
}
}
}
太好了-在这里,在mail
键下还包含了我需要的headers
信息。所以-here, in this article,我了解了如何启用headers
并将其包括在退回通知中。我已按照本文中的说明在AWS仪表盘中进行了设置,但标头信息仍未包含在bounce
对象中。我等待了24个小时,因为我认为可能会保留一些时间来从AWS端进行激活,但仍然一无所获-标头子对象仍未包含在bounce对象中。
我现在俯瞰什么?是否需要采取一些额外的额外步骤来将标题信息包含在退回通知中?