Rule sets and rules
After a traffic policy accepts an email, the ingress endpoint passes the email to its assigned rule set. A rule set is a reusable group of ordered rules that controls how Mail Manager processes accepted email. You can assign the same rule set to multiple ingress endpoints.
Each rule can select email or individual recipients with conditions, skip its actions when
an Unless condition matches, and run one or more actions. Use rules to route
email, retain a compliance copy, isolate suspicious email, invoke an application, or change
an email before delivery.
How rule sets process email
The following diagram shows how a rule evaluates conditions and
Unless conditions, runs ordered actions, and continues to the next
rule.
Rules run in the order that you configure. Each rule uses the following flow:
-
The rule starts with the email's current recipients.
-
Each condition narrows the selected recipients. A recipient remains selected only if all conditions match.
-
Each
Unlesscondition checks the selected recipients. If anyUnlesscondition matches a recipient, the actions do not run for that recipient. -
The actions run in configured order for the recipients that remain selected. The next rule then evaluates the current recipient list.
Example: Route email by recipient
This example shows how conditions select recipients and an Unless
condition removes a recipient from that selection.
-
Email recipients –
orders@example.comandtest@example.com. -
Conditions – Recipient
ENDS_WITH@example.com. -
Unless conditions – Recipient
EQUALStest@example.com. -
Actions
-
Add the header
X-Route: orders. -
Relay the email.
-
-
Result – The actions apply to
orders@example.com. TheUnlesscondition prevents them from applying totest@example.com.
Conditions select the recipients for a rule. Unless conditions remove
recipients from that selection. The actions run only for the recipients that
remain.
Choose a rule-set pattern
The following table maps common email-processing goals to rule-set patterns.
| Goal | Rule-set pattern |
|---|---|
| Keep a compliance copy and deliver email | Archive and deliver email – Archive, then relay or send. |
| Isolate suspicious email | Isolate suspicious email – Match a security result, write to Amazon S3, then drop. |
| Process application email | Process email with Lambda – Match a recipient or subject, then invoke a Lambda function. |
| Route departments separately | Route email by department – Match a department recipient, then relay. |
| Mark email for downstream processing | Add routing information – Add a header before delivery. |
| Change a destination during migration | Replace recipients during migration – Replace the recipient before later actions. |
Related resource
For an end-to-end routing and archiving walkthrough, see AWS Messaging Blog: Mail Manager – Amazon SES introduces new email
routing and archiving features
Reference for rule conditions and actions
-
For information about selecting email and recipients with
ConditionsandUnlessconditions, see Rule conditions. -
For information about action order, configuration, permissions, and failure behavior, see Rule actions.