Processing incoming email with AWS Simple Email Service (SES)

Thomas Schoffelen
4 min readMay 9

AWS Simple Email Service is a service I’ve never been that big of a fan of, because it generally feels like a bit of a black box, although things have improved recently with the introduction of Virtual Deliverability Manager tools in the AWS Console.

There’s one AWS SES feature I really love though: the ability to set it up for receiving email.

You can point your domain name’s MX records at AWS, and SES will accept emails sent to that domain. This is useful in many situations, but specifically handy if you’re building any sort of tool where you send email notifications you want users to be able to reply to (think the comment emails in a Google Doc, or the functionality to reply via email in your favourite project management tool).

Here’s how to set it up:

Set up a rule set

To start, we need to set up some things in the AWS Console. You can set this up using CloudFormation or the CDK too, but I always prefer to do it through the Console first, so that I have an understanding of what options are available. You can get started in the Incoming email section of the SES Console.

In there, you can set up an email receiving rule set. Within there, you can have multiple routes with different conditions, which will allow you to route emails based on things like the email address or domain it is addressed to. You then specify what actions happen when the rule’s conditions are met.

Save to S3

The main thing you usually want to happen here is saving the email to S3. Alternatively, it is also possible to send the email as an SNS notification. The latter seems like the easiest to connect up to things like AWS Lambda, but it comes with a limitation in terms of email size that can be accepted, since an SNS message can’t be larger than 150 KB, which is not too big, considering this includes the email’s headers and most email clients will send both a plain text and HTML version of an email.

Thomas Schoffelen

Entrepreneur tech kid, co-founder of NearSt, Londoner, open source enthusiast and aspiring spare time literature geek.