我有这些非常尴尬的情况,也许我误解了这些通知的使用。
我已将 AWS SES 设置为在发送电子邮件后发布到主题。我已将其设置为针对退回、投诉和交付发布。
我所做的是,当我在我的 Web 服务器上收到 SNS 通知时,我会在我的数据库中查找该消息 ID,然后更改其状态。例如,如果送达通知到达,我将消息状态更改为“已送达”。如果退回通知到达,我将消息状态更改为“退回”。
但是,现在我注意到其中许多电子邮件都向我发送了两个通知,并且它们并不总是按特定顺序发送。有时一个比另一个来得早,有时反之亦然。
因此,如果“Bounce”首先到达,然后是“Delivered”,我在数据库中的状态会变成“Delivered”,我认为这可能会产生误导。
第一个问题 如何检查这些通知的顺序?
第二个问题 我觉得我误解了“交付”通知。我试过阅读 AWS 文档,但老实说,它们并不是地球上最好的文档。谁能给我一个简单,清晰的解释?
第三个问题 我是否正确处理了这些通知?或者,还有更好的方法?
感谢您的帮助。
谢谢!
--
供您参考,我附上了一个示例,其中包含一组 2 个通知。一次反弹,一次交付。
{
"Type": "Notification",
"MessageId": "2efb9ee6-6bd5-576d-b80d-d0f5e3f44f23",
"TopicArn": "arn:aws:sns:us-east-1:#####:ses_beamstyle_com_hk",
"Message": {
"notificationType": "Delivery",
"mail": {
"timestamp": "2015-07-05T19:30:40.441Z",
"source": "<no-reply@bs.com.hk>",
"messageId": "xxxxx
"destination": [
"<ooto@simulator.amazonses.com>"
]
},
"delivery": {
"timestamp": "2015-07-05T19:30:41.101Z",
"processingTimeMillis": 660,
"recipients": [
"ooto@simulator.amazonses.com"
],
"smtpResponse": "250 2.6.0 Message received",
"reportingMTA": "a9-140.smtp-out.amazonses.com"
}
},
"Timestamp": "2015-07-05T19:30:41.179Z",
"SignatureVersion": "1",
"Signature": "xxxxx",
"SigningCertURL": "xxxxx",
"UnsubscribeURL": "xxxxx"
}
{
"Type": "Notification",
"MessageId": "b6e8bb7d-4e73-52ae-b690-f56ec6527ce5",
"TopicArn": "arn:aws:sns:us-east-1:#####:ses_beamstyle_com_hk",
"Message": {
"notificationType": "Bounce",
"bounce": {
"bounceSubType": "General",
"bounceType": "Transient",
"bouncedRecipients": [
{
"emailAddress": "ooto@simulator.amazonses.com"
}
],
"timestamp": "2015-07-05T19:30:41.000Z",
"feedbackId": "xxxxx"
},
"mail": {
"timestamp": "2015-07-05T19:30:40.000Z",
"messageId": "xxxxx",
"destination": [
"<ooto@simulator.amazonses.com>"
],
"source": "<no-reply@bs.com.hk>"
}
},
"Timestamp": "2015-07-05T19:30:41.315Z",
"SignatureVersion": "1",
"Signature": "xxxxx",
"SigningCertURL": "xxxxx",
"UnsubscribeURL": "xxxxx"
}