Handling bounces on Amazon SES
18 November, 2011 5 Comments
If you send to an email that does not exist, Amazon SES will perform some handling of the bounce before passing the details on to you.
When you send email through Amazon SES you may notice that the email arrives with a Return Path that looks something like this:
As it happens, the large delimited hex number before the @ sign is the same value that you got back from the
SendRawMail response. (If you’re unfamiliar with sending an email see previous posts on
// client is a AmazonSimpleEmailServiceClient // request is a SendEmailRequest SendEmailResponse response = client.SendEmail(request); string messageId = response.SendEmailResult.MessageId;
When the email bounces, it will go first to Amazon SES where they will note which email bounced. Then the email will be forwarded on to you and you will receive the bounced email. (Be aware, tho’, that the email may end up in your spam folder – they did for me). Exactly where the bounce email will go depends on the API call you are using and the fields that you have populated in the outgoing email. The rules are detailed on the Bounce and Complaints notifications page of the Amazon SES Developer’s Guide.
If you look in the headers of this email you’ll see that Message Id again in various parts of the header. e.g.
X-Original-To: email@example.com Delivered-To: firstname.lastname@example.org Message-Id: <email@example.com>
How you process these bounces on your side is up to you. Amazon do not, yet (I’m hopeful they will and it has been requested a lot) provide an automated way of using the API for querying which emails are bouncing, are complained about or are rejected.
At present the best detail you are going to get on bounced emails is in the aggregate data provided through the
GetSendStatistics API call or via the graphs on the AWS Console.
What happens if I send more email to an address that bounced?
If you continue to send emails to an address that bounces you will get a
MessageRejectedException when you call
SendRawEmail with the message “Address blacklisted.”
Conclusion on bounce handling
At present bounce handling using Amazon SES isn’t great (but it’s certainly no better than using a plain old SMTP service) however Amazon do appear to be interested in providing better support for handling bounces and the like. It may very well be better supported in the future.