Menu
Amazon Simple Email Service
Developer Guide

Creating Receipt Rules for Amazon SES Email Receiving

A receipt rule enables you to specify what you want Amazon SES to do with mail it receives for one or more recipients or domains. The receipt rule consists of a condition and an ordered list of actions. If the recipient to which the incoming mail is addressed matches a recipient specified in the condition, then Amazon SES performs the actions specified in the receipt rule. For more information about the role of receipt rules in the email-receiving process, see Email-Receiving Concepts.

Note

Receipt rules exist in receipt rule sets only, which is why you must have at least one receipt rule set. Each receipt rule can belong to only one receipt rule set.

This topic shows you how to create a receipt rule and describes options for each action type.

Setting Up a Receipt Rule

You can use the Amazon SES console or the CreateReceiptRule API to create rules.

To create a receipt rule (console)

  1. Sign in to the AWS Management Console and open the Amazon SES console at https://console.aws.amazon.com/ses/.

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

  3. Choose a receipt rule set. For example, to go to your active receipt rule set, choose View Active Rule Set. If you have not created any receipt rule sets yet, you can create one by choosing Create a New Rule Set.

  4. From your receipt rule set, choose Create Rule.

  5. Use the following procedure to add one or more recipients. Collectively, these recipients are the condition. You can have a maximum of 100 recipients per receipt rule.

    1. Under Recipients, type an email address or domain that you own. You may use a leading dot to capture all subdomains of a domain. Using example.com for demonstration purposes:

      • To match a specific user—user@example.com. This will match any form of the address with a label. Addresses that contain labels are of the form name+label@example.com, with user-specified text between the plus sign (+) and the at sign (@). If you specify a label, then only messages with the same label will match.

        For example, if you want a receipt rule to apply to ticket+123@example.com, ticket+456@example.com, and ticket+789@example.com, simply set the recipient of the receipt rule to ticket@example.com. In contrast, if you set the recipient of the receipt rule to ticket+123@example.com, then the rule will only apply to ticket+123@example.com — it will not capture ticket+456@example.com and ticket+789@example.com.

      • To match all addresses within a domain but not its subdomains—example.com

      • To match all addresses within all subdomains, but not the domain itself—.example.com (note the leading period)

      • To match all addresses within a domain and all of its subdomains—Two recipients: example.com, .example.com

      • All recipients within all verified domains—Empty. (Do not specify any recipients.)

    2. Choose Add Recipient.

    3. If you have not yet verified the domain of the recipient, choose Verify. To complete domain verification, you need to publish a TXT record to your DNS server, as described in Verifying Domains in Amazon SES.

    4. Add additional recipients as needed, and then choose Next Step.

  6. Use the following procedure to add one or more actions to the receipt rule.

    1. Choose an action from the menu.

    2. Choose the action settings. For information about the options for each action, see Action Options.

    3. Add additional actions as needed, and then choose Next Step.

  7. For Rule Details, use the following procedure to choose settings.

    1. For Rule Name, type a name for the receipt rule. The name must contain less than 64 alphanumeric, hyphen (-), underscore (_), and period (.) characters. The name must start and end with a letter or number.

    2. If you want to enable the receipt rule, leave the Enabled option selected.

    3. If you want Amazon SES to reject any incoming emails that are not sent over a connection that is encrypted with Transport Layer Security (TLS), select TLS.

    4. If you want Amazon SES to scan incoming emails for spam and viruses, select Enable Spam and Virus Scanning.

  8. For Rule Set, choose an existing receipt rule set or click Create New Rule Set.

  9. For Rule Position, choose where to place the receipt rule in the ordered list of receipt rules. The receipt rules are evaluated sequentially.

  10. Choose Next Step, and then choose Create Rule.

For information about how to use the CreateReceiptRule API to create rules, see the Amazon Simple Email Service API Reference.