Although Amazon SES is often used for sending emails, it can also easily receive emails.
Setup Procedure#
The setup process is actually very simple, as follows:
- Create and verify a domain Identity for receiving
- 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 screen, create a domain Identity. You can easily verify your 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 bucket policy or IAM policy is s3:PutObject
.
Creating a Receipt Rule#
First, create a receipt rule set, and then create receipt rules within the receipt rule set. This allows you to manage multiple rules together.
You can also easily create this from the "Email Receiving" section in the console by following the on-screen instructions.
There is a screen where you can specify receipt conditions. The console includes guidelines on how to write receipt conditions, which you can refer to.
On the next screen, you can choose actions to take when receiving an email. Operations such as saving to S3, invoking a Lambda function, publishing a message to SNS, and more are possible, and multiple operations can be added.
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 may not be clear from the console instructions alone.
Add the following record to the DNS records of the receiving domain (region
is the region where you set up SES).
10 inbound-smtp..amazonaws.com
For example, if you're using the Tokyo region (ap-northeast-1
):
10 inbound-smtp.ap-northeast-1.amazonaws.com
For example, if you want to set up failover from Tokyo (ap-northeast-1
) to Osaka (ap-northeast-3
):
10 inbound-smtp.ap-northeast-1.amazonaws.com 20 inbound-smtp.ap-northeast-3.amazonaws.com
Confirming Email Reception#
Send an email to the domain you configured from your regular email client, and verify that it is saved to the S3 bucket.
Once you've completed these steps, you can automate the process however you like!