How to receive emails in a S3 bucket with AWS SES?

Subscribe to my newsletter and never miss my upcoming articles

If you want to receive your emails in an S3 bucket, this is the tutorial you should follow.

Prerequisite: Configure an AWS S3 Bucket

You must create an S3 bucket where the emails are going to deposit.

To do this, create a standard bucket type and assign a policy that Amazon SES can write the files to it. The policy must be like the following:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "AllowSESPuts",
            "Effect": "Allow",
            "Principal": {
                "Service": ""
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::bucket-name/*",
            "Condition": {
                "StringEquals": {
                    "aws:Referer": "your-account-ID"

Configuration in Amazon SES

Verify a domain

Enter the domain that the email account belongs to so that Amazon can verify that the domain is yours. To do this, enter the Domains section and enter the domain:


On the DNS settings you own (Godaddy, Hostgator, Route53, etc.), you must create and enter the verification record sets that Amazon delivers.



Amazon must verify the domain, so you must enter this information in DNS settings.

If you are using Cloudfare or any CDN, you must enter these settings too.

Just wait 5 minutes to propagate the changes around the DNSs...


Set Up an MX record in your DNS Settings

A mail exchange record (MX record) is a setting that specifies the mail servers that can accept email sent to your domain.

To add an MX record to your domain's DNS settings, you must do the following:

  • Log in to the DNS provider management console.
  • Create a new MX record.
  • In the Name field of the MX record, specify the domain followed by a period. Example:
  • For Type, select MX.
  • In Value, enter the following:

For example, if you are using the US East (N. Virginia) region, replace the region with us-east-1. It should be:

Create a Receive Rule Set

To create a set of rules in Amazon SES, go to the Rule Sets section and click on the Create a Rule Set button:


Specify the email account or domain from where you want to receive emails. If none is specified, you will receive emails from all accounts:


Select an action, of type S3:


In the action configuration, select the name of the bucket, and say the prefix to save the files (path in S3):


Specify a rule name, enable it and check "Enable spam and virus scanning" if you want AWS to scan the emails:


Review your configuration:


When you hit the save button, the Rule set is created and AWS sends a notification file to the prefix bucket.


You can download it and add a .EML extension to open with Outlook or any email application and read the AWS setup notification.



Login into your preferred mailbox account and send an email to the recipient that you specified in the Rule Set condition:


After you send the email, check the S3 and you should receive an email file. You can download it and add the extension .EML to open it.



At this point, you can integrate your Cloud Applications with AWS S3 to process your emails.

No Comments Yet