Prerequisites
I use AWS SES to send an email with event publishing to track the delivery status.
Problem
I'm looking for an event to make sure that an email is successfully sent to the end-user.
Description
Following AWS documentation, this type is suitable:
Deliveries – Amazon SES successfully delivered the email to the recipient's mail server.
However, this event I get always, even in case Hard bounces or Complaints.
For example, email status flow is:
- Sends -> Deliveries - in case of successfull delivery
- Sends -> Deliveries -> Hard bounces - in case I provide invalid recipient
I don't expect Hard bounces after Deliveries. If this behavior is correct then I need some additional event for sure success. Something like this is expected in case of successfull delivery:
- Sends -> Deliveries -> Success
I know that there are other "success" events like Opens, Clicks, Subscriptions, but they require additional action from the end-user.
Implementation details
I use Verified identity as an email sender.
A configuration set is used to redirect status events to SNS.
Finally, SQS is subscribed to this SNS to have all events in one place.
I tried several ways to send an email:
- Java code using AWS SES SDK
- Sending simulator with predefined and custom recipient's
The result is the same (as described above)
CodePudding user response:
I think it is impossible to have a Success status because AWS cannot guarantee when the recipient mail server will reply with a Hard Bounce. You yourself have to define how long to you want to wait until you consider a delivery as successful. For example, if no hard bounce after 5 minutes, then it is a success.
If your use case is for analytics, I will simply capture more event types (for example log both Deliveries and Hard Bounces), and then count my success as Count of Deliveries - Count of Hard Bounces.
If your use case is for event-driven workloads, we need to define first what is considered a Success. For example, if we define Success as no Hard Bounce after 5 minutes, we can configure a Lambda function to trigger 5 minutes after a Delivery event. In the function, check if a subsequent Bounce event occurred. If not, the delivery is considered successful and then you can proceed to do what you want to do.
CodePudding user response:
This is what I got from aws support about delivery status of an email.
Amazon SES will continue making several delivery attempts until receiving a successful response from the recipient mail server, or until 840 minutes elapse. If Amazon SES is still unable to deliver the email/message during this period, it stops sending the email and will then return a bounce message/notification.
According to this you can't be sure about the bounce or any other status within 5 minutes.
AWS does not have visibility to confirm if the Recipient Mail Server was able to deliver the message to the recipient email address when you get a 250 OK(it's confirmation that aws has delivered the message to recipient's mail server).
So there is no way you can be sure.
