Exchange transport rules: Mail flow rules
Act on mail as it passes through - carefully
Who this is for: Administrators who can access the Exchange admin center.
Mail flow rules, formerly transport rules, check messages and take actions when conditions match. Test each rule before enforcing it.
Before you start
You need an account that can open the Exchange admin center (EAC) and Mail flow > Rules. If you cannot open Rules, ask your tenant administrator for access.
Scope: This guide covers testing, checking, and enforcing a rule in Exchange Online. It does not explain how to configure specific production conditions or actions.
Things they are good for
- Testing whether messages match a rule.
- Sending an incident report for matches in Test without Policy Tips mode.
- Showing a Policy Tip to senders in Test with Policy Tips mode.
- Checking matched rules and actions in message trace.
Exchange admin center - Mail flow > Rules. Add a rule, and set it to test mode before enforcing.
Creating one
This guide starts with a rule listed in Rules. For a new rule, use Create a mail flow rule, then set its conditions and settings. Use only conditions and actions that have already been approved.
Test a rule without Policy Tips
- In the EAC at https://admin.exchange.microsoft.com, go to Mail flow > Rules and open the rule. To create a rule, select Create a mail flow rule.
- On the Conditions tab, add Generate incident report and send it to. Choose the report recipients and message properties. For a new rule, add this action while setting its conditions.
- On the Settings tab, select Test without policy tips under Rule mode. For a new rule, choose this mode in the rule settings. Select Save.
- Wait at least 30 minutes before testing the rule.
- Send test messages that should match and should not match. Include relevant senders, recipients, replies, and messages that may match multiple rules.
- In the EAC, go to Mail flow > Message trace. Find each test message and open its details. Check for Transport rule in Event and review Action.
- Confirm the expected messages show the correct rule and action, and check report recipients for incident reports. If results are wrong or missing, do not enforce the rule. Troubleshoot and test again.
Test with Policy Tips instead
Use this option only when a sender-facing Policy Tip is appropriate. Add Notify the sender with a Policy Tip and use the approved block and override options. Do not guess these settings.
- On the Conditions tab, add Notify the sender with a Policy Tip and set the approved options. For a new rule, add the action while setting its conditions.
- On the Settings tab, select Test with Policy Tips under Rule mode. For a new rule, choose this mode in the rule settings. Select Save.
- Wait at least 30 minutes, then send the test messages described above. Check message trace for the Transport rule event and action. Confirm the sender receives the Policy Tip. If a check fails, do not enforce the rule; troubleshoot and test again.
Enforce the rule after testing
- Open the rule and remove the testing action from its Conditions tab: Generate incident report and send it to, or Notify the sender with a Policy Tip.
- On the Settings tab, select Enforce under Rule mode, then select Save. Tell affected users about the rule before enforcing it.
- Trace a message that should match and check the Transport rule event and action. Investigate unexpected results and interacting rules.
When it goes wrong
- If the rule does not work, wait a few hours and test again. Check for rule conflicts. You can move the rule to the top by setting its priority to 0, then test again.
- If a disclaimer appears on every reply, add an exception that checks for a unique phrase in the disclaimer. Test the original message and a reply.
- If an action should occur when either of two conditions matches, create two rules, one for each condition. Copy the rule, then remove one condition from each. Test both conditions and messages that match neither.
- If The sender > is this person does not match messages sent to a distribution group, use The sender > is a member of this group (SentToMemberOf). Test a message addressed to the group and check message trace.
- If the Exchange transport rule report omits a rule, set its Severity level to a value other than Not specified, then check the report again.
- If external automatic forwarding is blocked, check the outbound spam filter policy, remote domains, and mail flow rules. A block in one control can override an allow in another. Review the disclosure risk before enabling external forwarding.
Related help articles
References
- https://learn.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/test-mail-flow-rules
- https://learn.microsoft.com/en-us/defender-office-365/outbound-spam-policies-external-email-forwarding
Last updated on