Amazon SES is a service often used for sending email, but it can also easily receive email.
Setup Steps#
The setup process is actually very simple, as follows:
- Create and verify a domain identity for the receiving domain
- Create an S3 bucket
- Create a receipt rule
- Create an MX record in the DNS of the receiving domain
Creating a Domain Identity#
From the console, create a domain identity. You can easily authenticate the domain by following the console instructions.
Creating an S3 Bucket#
Create an S3 bucket to store emails received by SES. The only permission required for the bucket policy or IAM policy is s3:PutObject.
Creating a Receipt Rule#
First, create a receipt rule set, and then create a receipt rule within that rule set. This allows you to manage multiple rules together.
You can also create this from the "Email Receiving" section in the console, where on-screen instructions make it easy to set up.
There's a screen where you can specify receipt conditions. The console includes guidance on how to write receipt conditions, which you can refer to.
On the next screen, you can select actions to take when email is received. You can save to S3, invoke a Lambda function, publish a message to SNS, and more, and you can add multiple actions.
In this case, we'll save to an S3 bucket. The required permission is s3:putObject.
Adding an MX Record#
This part is the most important and isn't fully clear from just the console instructions.
Add the following record to the DNS records of the receiving domain (region is the region where you set up SES).
10 inbound-smtp.<region>.amazonaws.com
For example, if using the Tokyo region (ap-northeast-1):
10 inbound-smtp.ap-northeast-1.amazonaws.com
For example, if setting up failover from Tokyo (ap-northeast-1) → Osaka (ap-northeast-3):
10 inbound-smtp.ap-northeast-1.amazonaws.com 20 inbound-smtp.ap-northeast-3.amazonaws.com
Verifying Email Reception#
Send an email to the domain you just configured from your regular email client, and verify that it's saved in the S3 bucket.
Once you've gotten this far, you're free to automate it however you like!