Ryan shows you how to use Amazon SES
to receive inbound emails, and then
store those emails on Amazon S3

Ryan_IAD0318

I want to use Amazon Simple Email Service (Amazon SES) to receive inbound emails. I also want to store those emails for archival or further processing. How can I do that?

Follow these steps to set up Amazon SES to receive inbound emails, and then store those emails:

1.     Verify your email domain with Amazon SES.

2.     Set up an Amazon Simple Storage Service (Amazon S3) bucket with the permissions to store emails from Amazon SES.

3.     Create an Amazon SES receipt rule that sends inbound emails to the S3 bucket.

4.     Test the Amazon SES rule.

Verify your email domain with Amazon SES

You must verify the domain that you want to use for receiving emails. For instructions, see Verifying a Domain with Amazon SES.

Set up an Amazon S3 bucket with the permissions to store emails from Amazon SES

1.     Create an Amazon S3 bucket.

2.     After you create the bucket, select its name from the bucket list in the Amazon S3 console.

3.     Choose the Permissions view.

4.     Choose Bucket Policy.

5.     Under Bucket policy editor, enter the following policy. Be sure to replace BUCKET-NAME with the name of your bucket, and replace AWSACCOUNTID with your AWS account ID.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowSESPuts",
            "Effect": "Allow",
            "Principal": {
                "Service": "ses.amazonaws.com"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::BUCKET-NAME/*",
            "Condition": {
                "StringEquals": {
                    "aws:Referer": "AWSACCOUNTID"
                }
            }
        }
    ]
}

Note: For more information about this policy, see Give Amazon SES Permission to Write to Your Amazon S3 Bucket.

6.     Choose Save.

Create an Amazon SES receipt rule that sends inbound emails to the S3 bucket

1.     Open the Amazon SES console.

2.     In the navigation pane, under Email Receiving, choose Rule Sets.

3.     If you want to add the rule to an existing active rule set, skip to step 4. To create a new rule set, choose Create a Rule Set, enter a rule set name, and then choose Create a Rule Set.

Note: If you create a new rule set, be sure to select the rule set, and then choose Set as Active Rule Set.

4.     Choose View Active Rule Set.

5.     Choose Create Rule.

Note: You can also choose to update an existing rule with the same values as described in the following steps.

6.     Under Recipients, if you want to store emails sent only to certain email addresses with your verified domains, enter those email addresses as recipients. If you want to store all emails sent to your verified domains, don't enter any recipients, and then choose Next Step.

7.     Under Actions, for Add action, select S3. Then, complete these fields:
For S3 bucket, select the bucket that you created to store the emails.
(Optional) Configure Object key prefix, Encrypt Message, and SNS topic as required by your use case. Or, you can leave these fields blank. For more information on these fields, see S3 Action.

8.    Choose Next Step.

9.    Under Rule Details, complete these fields:
For Rule name, enter a name for your rule.
For Enabled, be sure that this checkbox is selected so that the rule is created as an active rule.
(Optional) Select Require TLS or Enable spam and virus scanning if required by your use case.
For Rule set, verify that your active rule set is selected. An active rule set includes (Active) in the name.
For Insert after rule, select the position that you want for your rule within the rule set.

10.    Choose Next Step.

11.    Choose Create Rule.

Test the Amazon SES rule

1.     From the Amazon SES console, in the navigation pane, choose Domains.

2.     Select your verified domain.

3.     Choose Send a Test Email. Then, complete these fields:
For From, enter an email address that you want to send the test email from.
For To, enter an email address with the domain that you want to test.
For Subject and Body, enter example email text.

4.     Choose Send Test Email.

5.     After a few minutes, open the Amazon S3 console.

6.     Open the bucket that you configured to store the Amazon SES emails.

7.     Verify that the bucket contains the test email that you sent.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.

Published: 2018-12-18