首页 文章

SES事件序列

提问于
浏览
1

我无法确定来自SES的事件序列 . 我目前正在使用SNS通过电子邮件发送JSON .

发送电子邮件时,我需要对我们系统上的电子邮件传输记录进行状态更改 . 想法是收集事件消息并影响我们系统上电子邮件对象的状态更改 .

使用他们的测试沙箱,我发送了一封电子邮件给他们的反弹和投诉测试电子邮件帐户 .

收到的事件如下:

{
    "notificationType": "Delivery",
    "mail": {
        "timestamp": "2016-03-09T07:05:57.166Z",
        "source": "-redacted-",
        "sourceArn": "-redacted-",
        "sendingAccountId": "-redacted-",
        "messageId": "-redacted-",
        "destination": ["bounce@simulator.amazonses.com",
        "complaint@simulator.amazonses.com"]
    },
    "delivery": {
        "timestamp": "2016-03-09T07:05:57.686Z",
        "processingTimeMillis": 520,
        "recipients": ["complaint@simulator.amazonses.com"],
        "smtpResponse": "250 2.6.0 Message received",
        "reportingMTA": "a8-55.smtp-out.amazonses.com"
    }
}

{
    "notificationType": "Bounce",
    "bounce": {
        "bounceSubType": "General",
        "bounceType": "Permanent",
        "reportingMTA": "dsn; a8-55.smtp-out.amazonses.com",
        "bouncedRecipients": [{
            "action": "failed",
            "emailAddress": "bounce@simulator.amazonses.com",
            "status": "5.1.1",
            "diagnosticCode": "smtp; 550 5.1.1 user unknown"
        }],
        "timestamp": "2016-03-09T07:05:57.785Z",
        "feedbackId": "-redacted-"
    },
    "mail": {
        "timestamp": "2016-03-09T07:05:57.000Z",
        "source": "-redacted-",
        "sourceArn": "-redacted-",
        "messageId": "-redacted-",
        "destination": ["bounce@simulator.amazonses.com",
        "complaint@simulator.amazonses.com"],
        "sendingAccountId": "-redacted-"
    }
}

{
    "notificationType": "Complaint",
    "complaint": {
        "userAgent": "Amazon SES Mailbox Simulator",
        "complainedRecipients": [{
            "emailAddress": "complaint@simulator.amazonses.com"
        }],
        "complaintFeedbackType": "abuse",
        "timestamp": "2016-03-09T07:05:57.000Z",
        "feedbackId": "-redacted-"
    },
    "mail": {
        "source": "-redacted-",
        "timestamp": "2016-03-09T07:05:57.946Z",
        "sourceArn": "-redacted-",
        "sendingAccountId": "-redacted-",
        "messageId": "-redacted-",
        "destination": ["bounce@simulator.amazonses.com",
        "complaint@simulator.amazonses.com"]
    }
}

根据mail object的文档,时间戳字段应为'The time at which the original message was sent (in ISO8601 format).' .

bounce object文档指出此对象的时间戳为'The date and time at which the bounce was sent (in ISO8601 format). Note that this is the time at which the notification was sent by the ISP, and not the time at which it was received by Amazon SES.' .

并且complaint object文档指出此对象的时间戳为'The date and time at which the bounce was sent (in ISO8601 format). Note that this is the time at which the notification was sent by the ISP, and not the time at which it was received by Amazon SES.' .

我看不出所述字段描述如何导致我看到的无序问题 .

我认为这些事件应该是在退回或投诉之前作为交付的订单,以便反弹或投诉是列出的收件人的最终状态 .

  • 邮件对象时间戳不一致,它会更改事件,并按时间顺序排列事件超出预期序列 .

  • 事件时间戳也将事件从预期序列中取出 .

邮件对象时间戳序列

  • 2016-03-09T07:05:57.000Z (bounce)

  • 2016-03-09T07:05:57.166Z (delivery)

  • 2016-03-09T07:05:57.946Z (complaint)

How can an email be bounced before it is delivered? Does that mean the final state for the bounce email is delivered?

并且通知类型对象时间戳序列

  • 2016-03-09T07:05:57.000Z (complaint)

  • 2016-03-09T07:05:57.686Z (delivery)

  • 2016-03-09T07:05:57.785Z (bounce)

How can a complaint be made before delivery?

我在这里服用疯狂的药片吗? How should I determine the final state for the email sent to each recipient?

1 回答

  • 1

    实际上,看起来相当简单 . 不,我当然是在开玩笑 .

    但是,严肃地说,当你考虑到较低级别的机制时,下面的措辞似乎可以解释可能发生的事情:

    请注意,这是ISP发送通知的时间,而不是Amazon SES收到通知的时间 .

    当然,这是最严格意义上的无意义陈述,因为在简单的语言中,ISP发送消息的时间和SES收到的时间完全相同 - 没有中间的SMTP分类器 - 天空会导致那两次发散 . 显然(对我来说)正确的解释是,这指的是服务器发出通知的时间戳,它的准确性是不确定的 .

    在解析弹跳和投诉响应时,SES必然会发挥一些作用,因为SMTP出了名 . 这可能包括提取 Headers 数据...就像时间戳...这很可能不是毫不客气的......让你感觉false precision .

    如果你假设 000 毫秒的时间戳实际上仅精确到秒,而不是毫秒,你会发现你看到的问题......消失了 .

    当然,这也可能只是一个不好的例子 .

    不过,问题的核心在于,它实际上也不可能在反弹之前完全没有交付 .

    如果你在反弹后获得交付,那就没有意义了 . 这是值得注意的,但没有意义,因为SES不会发送邮件,因为它还没有放弃尝试交付的邮件 .

    如果您单独测试弹跳和投诉模拟器也可能会有所帮助,因为您将在一条消息上使用两个不同的收件人来淹没水 .

相关问题