1

Im using AWS Lambda for sending emails by Amazon SES.

Each time that the request send_email succeeds I got the message id like confirmation. But now, I want to use somehow this messageId. For example to know if this message concretelly get delivered or bounced.

CloudWatch offers me metrics, with the number of delivered or bounced messages but I want to look throught each one.

¿Is there any statement that allows to know the state of a message by id?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Why message ID and not responseCode? If you get 250 in the response code, it means your message is delivered but you still can't be sure if it will be bounced or not. You can never know this, nor aws has this knowledge. It all depends on the recieving mail server what will they do with the email. – Riz Jan 21 '22 at 09:09

1 Answers1

1

Due to the asynchronous nature of SMTP and how mails are being routed, you can't have this information immediately when sending an e-mail (via SES or otherwise).

However, AWS provides a feedback system which notifies an SNS topic when a message is delivered, bounced, or a complaint was received.

While the documentation is very detailed, the general idea is that you subscribe your own lambda(s) to the configured SNS topic(s) and you can then handle these events as you see fit (i.e. persist data on DynamoDB, call your unsubscribe API and so on).

Tasos P.
  • 3,994
  • 2
  • 21
  • 41