How to set up mail flow rules in Office 365?
Mail flow rules (transport rules) provide you with the ability to implement various email delivery policies based on an extensive set of conditions, exceptions, and actions.
Create transport rules in Microsoft 365
To create a transport rule in Office 365 via the Exchange admin center (EAC), follow these steps:
- Go to the Rules page under the Mail flow tab and navigate to .
- In the Set rule conditions window, specify the rule name, along with its conditions, actions, and any exceptions as needed. Click Next.
- Configure additional options such as rule mode, severity, activation date, deactivation date, the state of multiple rule processing, and more. Click Next.
- In the Review and finish page, check all the transport rule conditions and click the Finish button to save it.
- After creating the rule using EAC, it is not enabled by default. To enable a transport rule, click on the respective mail flow rule in the Rules page and move the Enable or disable rule toggle to the 'enable' position.
You can also use the āNew-TransportRuleā cmdlet in the Exchange Online PowerShell to create a new mail flow rule.
New-TransportRule -Name "<RuleName>" -SubjectContainsWords "<WordsInTheSubject>" -AddToRecipients ā<ToAddress>ā -Priority <PriorityValue>
Notes:
- After you create a mail flow rule, it may take more than 30 minutes for the rule to activate and take effect on emails.
- Ensure the priority value should be within the acceptable range. For example, if there are 9 existing rules, the valid priority values for a new rule (the 10th rule) are from 0 through 9.
Limitations of mail flow rules in Microsoft 365
Transport rules in Microsoft 365 have specific limitations that organizations need to consider.
- Organizations can create a maximum of 300 transport rules to manage email delivery.
- All regular expressions in each transport rule can be up to 8 KB in size. Additionally, the total size limit for all regular expressions in all transport rules combined is 20 KB only.
- Exchange Online extracts text from attachments and scans only the first 1 MB of that text when processing rules.
- Transport rules can add only up to 100 recipients to a message, any additional recipients will not be included. Additionally, transport rules cannot add a distribution list as a recipient.
- If a rule is set to forward a message, it will process only if the message needs to be forwarded to fewer than 10 recipients. Messages will not be forwarded if they require forwarding to 10 or more recipients.
- A message can be redirected only once across different organizations using different transport rules. Subsequent redirection attempts will result in the message being dropped with a Non-Delivery Report (NDR).
Best practices for configuring mail flow rules in Exchange Online
Here are some recommended practices for setting up transport rules in Exchange Online:
- Check and test transport rules: Before applying a transport rule org-wide, configure it in the āTest without Policy Tipsā mode and properly test mail flow rules using the āTest-Messageā cmdlet.
- Configure multiple rules when needed: When various actions are need to be processed sequentially on a same message, set up multiple transport rules.
- Stop processing more rules: When multiple rules could affect the same message, opt to halt processing more rules.
- Understand the DLP and transport rule interaction: As mail flow rules take precedence over DLP rules, avoid combining DLP rule actions with mail flow rule conditions. If a message is processed by a transport rule and then by a DLP policy, the transport rule won't apply again to the message modified by the DLP policy.
- Use external files for keyword matching: Use PowerShell to load keywords or patterns from external text files when setting up mail flow rules to block messages based on specific expressions or words listed in those files.
- Selective application in email conversations: Configure transport rules with exceptions to prevent applying the same action to every message in an email thread. For instance, if you want to add a disclaimer only to the first message in the thread, configure the rule with an exception to avoid repeating the action in subsequent messages.