Blog/ Outlook how-tos

How to Create a Transport Rule in Exchange Online (Mail Flow Rules)

Nafiul HasanNafiul Hasan· 12 min read
Exchange Online mail flow rules diagram showing conditions, exceptions, and actions for a transport rule in the Exchange admin center

The short answer

To create a transport rule in Exchange Online, open the Exchange admin center, go to Mail flow > Rules, click Add a rule, set your conditions and actions, then run it in test mode before switching to Enforce. Rules fire server-side across the whole tenant. Microsoft caps each tenant at 300 active transport rules.

Step-by-step guide to creating a transport rule in Exchange Online, covering conditions, test mode, actions, limits, and what to do when a rule doesn't apply.

On this page
  1. 01Before you start: roles, access, and the test-mode discipline
  2. 02How to create a transport rule in Exchange Online: step by step
  3. 03Exchange admin center, PowerShell, and compliance portal compared
  4. 04Creating a rule with PowerShell
  5. 05Common use cases: conditions and actions to set
  6. 06What to do when a transport rule is not applying
  7. 07A faster way to handle personal inbox routing

A transport rule in Exchange Online — Microsoft also calls them mail flow rules — is a server-side condition-and-action pair that the Exchange transport service applies to every message passing through your tenant, before that message reaches any inbox. You can use them to append legal disclaimers, route mail from specific senders, encrypt messages to external recipients, or reject anything arriving from a blocked domain, all without touching a single mailbox client.

Creating one takes about five minutes in the Exchange admin center. The slower part is scoping the rule correctly: an overly broad condition can silently catch messages you never intended to touch. That is why Microsoft's transport engine ships a built-in test mode, and why this guide leads with that discipline rather than burying it at the end.

This guide covers how to create a transport rule in Exchange Online using the admin center GUI, the PowerShell alternative for bulk or scripted setups, a side-by-side table of the most common use cases, and a practical troubleshooting reference for when a rule is not applying. Documented limits cited below — including the 300-rule cap — come from the Exchange Online Limits page on Microsoft Learn.

Before you start: roles, access, and the test-mode discipline#

You need the Global Administrator or Exchange Administrator role in Microsoft 365. Compliance Administrators can access Data Loss Prevention policies in the compliance portal, but they cannot create transport rules in the Exchange admin center. If you are unsure of your role, check admin.microsoft.com > Users > Active users and look at your own assigned roles.

The Exchange admin center is at admin.exchange.microsoft.com. You can also reach it from admin.microsoft.com by going to Admin centers > Exchange in the left sidebar.

Microsoft caps each Microsoft 365 tenant at 300 transport rules. That is a hard limit. Active rules, test-mode rules, and disabled rules all count toward the ceiling — so if you are near the limit, audit what you already have before creating more.

Always test before enforcing

A transport rule set to Enforce fires on every qualifying message the instant you save it. A single misconfigured condition can silently quarantine legitimate mail across your entire tenant. The safe habit: save every new rule in Test mode first, run a Message Trace to confirm it matches exactly the right messages, then switch to Enforce. It adds one step and prevents a class of problem that is genuinely hard to diagnose after mail has already been affected.

How to create a transport rule in Exchange Online: step by step#

The steps below use the current Exchange admin center at admin.exchange.microsoft.com. Interface labels reflect the version available as of July 2026; Microsoft occasionally renames panels without changing the underlying functionality.

  1. 1

    Open the Exchange admin center and navigate to Mail flow

    Sign in to admin.exchange.microsoft.com. In the left navigation, select Mail flow, then Rules. You will see all existing transport rules in the tenant, listed in priority order.

  2. 2

    Start a new rule

    Click Add a rule. A dropdown appears with preset templates such as Apply disclaimers and Filter messages by size. Choose a template to pre-populate common conditions, or select Create a new rule to start from scratch. Both routes open the same rule wizard.

  3. 3

    Name the rule clearly

    Give the rule a name that describes what it does and why — not 'Rule 1' or 'Test.' Something like 'Outbound disclaimer — legal dept' or 'Block inbound from partner-blocked.txt' still reads cleanly when you are skimming a list of 40 rules six months later. The name is admin-only and is never shown to end users.

  4. 4

    Set the condition under Apply this rule if

    Choose the condition that determines which messages the rule evaluates. Common conditions: The sender is located > Outside the organization (for inbound rules); The recipient is located > Outside the organization (for outbound rules); The sender domain is; A message header includes. You can combine multiple conditions using AND (all must match) or OR (any must match). Text predicates are case-insensitive.

  5. 5

    Choose the action under Do the following

    Select what happens when the rule fires. Common actions: Apply a disclaimer to the message (append or prepend, with HTML and plain text fallback); Redirect the message to; Reject the message and include an explanation; Set the spam confidence level (SCL) to; Blind carbon copy the message to. Some actions stop further rule processing; others let the message continue through lower-priority rules.

  6. 6

    Add exceptions if needed

    Under Except if, add any exclusions. For example, if you are appending a disclaimer to all outbound mail, you might exclude automated system senders by adding Except if > The sender is > [email protected]. Exceptions use the same predicate library as conditions.

  7. 7

    Set the mode to Test — not Enforce

    Under Choose a mode for this rule, select Test without Policy Tips. Do not choose Enforce yet. In test mode the rule evaluates messages but applies no action; instead it generates an incident report email to an address you specify whenever a message matches, so you can verify scope before going live.

  8. 8

    Set priority and save

    Priority 0 runs first. If you need this rule to evaluate before all existing rules, set it to 0. Click Save. The rule is now live in test mode — evaluating every message, logging matches, applying no action.

  9. 9

    Verify with Message Trace, then switch to Enforce

    In the Exchange admin center, go to Mail flow > Message trace. Run a trace on a message that should have matched. Expand the trace detail and look for the transport rule evaluation entries; the log shows which rules ran, in which order, and whether each matched. Once you are confident the rule is catching the right messages and only those, return to the rule, change the mode to Enforce, and save.

Diagram showing the decision path of an Exchange Online transport rule: message arrives at the transport service, conditions are evaluated in priority order, exceptions are checked, action is applied or skipped, and processing continues or stops
Exchange Online evaluates rules in priority order (0 = highest). An action that includes Stop processing more rules ends the chain for that message.

Exchange admin center, PowerShell, and compliance portal compared#

Three interfaces let you create and manage transport rules in Exchange Online. The Exchange admin center covers most use cases without writing a line of code. PowerShell is the right tool when you need to create many rules at once, replicate a configuration across tenants, or access predicates the GUI does not expose.

MethodWhereSkill neededBest for
Exchange admin center (EAC)admin.exchange.microsoft.com > Mail flow > RulesGUI onlyDay-to-day rule creation; all common predicates; no code required
Exchange Online PowerShell (New-TransportRule)ExchangeOnlineManagement module, command linePowerShellBulk creation, scripting, cross-tenant replication, advanced predicates not exposed in the GUI
Microsoft 365 Compliance portal (DLP policies)compliance.microsoft.com > Data loss preventionGUIData loss prevention rules — overlapping scope but a separate engine with its own priority chain; not interchangeable with transport rules

Creating a rule with PowerShell#

Connect first: Install-Module ExchangeOnlineManagement if you have not already, then Connect-ExchangeOnline -UserPrincipalName [email protected]. The cmdlet is New-TransportRule.

The example below appends a legal disclaimer to all mail sent from inside the tenant to recipients outside it, and saves the rule in test mode so it generates incident reports rather than modifying live messages:

New-TransportRule: outbound disclaimer in test mode
ConnectConnect-ExchangeOnline -UserPrincipalName [email protected]
CreateNew-TransportRule -Name 'Outbound disclaimer — legal' \
-FromScope InOrganization \
-SentToScope NotInOrganization \
-ApplyHtmlDisclaimerText '<p>Confidential. For the intended recipient only.</p>' \
-ApplyHtmlDisclaimerFallbackAction Wrap \
-Mode TestWithoutNotification

Common use cases: conditions and actions to set#

The table below maps the most frequently needed configurations to the exact condition and action combination that implements them. All are achievable in the Exchange admin center without PowerShell.

GoalConditionAction
Add a legal disclaimer to all outgoing emailThe sender is located > Inside the organization AND The recipient is located > Outside the organizationApply a disclaimer > Append — provide HTML text and a plain text fallback; set the fallback action to Wrap
Block all inbound mail from a specific domainThe sender domain is > example.comReject the message with the explanation > (your reason text)
Encrypt messages sent to external recipientsThe recipient is located > Outside the organizationApply Office 365 Message Encryption and rights protection > Encrypt
BCC all outbound mail to an archive mailboxThe sender is located > Inside the organizationBlind carbon copy the message to > [email protected]
Warn senders before emailing outside the tenantThe recipient is located > Outside the organizationNotify the sender with a Policy Tip > (warning text describing why)
Raise the spam confidence level on messages matching a keywordThe subject or body includes > (your keyword list)Set the spam confidence level (SCL) to > 9

What to do when a transport rule is not applying#

The two most common causes of a transport rule that appears to do nothing: the condition scope is inverted (the rule targets inbound traffic but the message is outbound, or vice versa), and priority order (a higher-priority rule matched first and its action included Stop processing more rules, so your rule never ran).

Message Trace is the diagnostic tool for both. Run a trace on a specific message that should have matched, expand the detail, and look for the transport rule evaluation entries. The trace shows every rule that evaluated, in which order, whether each matched, and whether processing stopped — giving you an exact record of what the transport engine did.

SymptomLikely causeFix
Rule created but no messages ever matchedCondition scope is inverted — rule targets inbound messages but they are outbound, or reverseRe-examine the sender/recipient location conditions; an inbound rule needs The sender is located > Outside the organization
Rule fires correctly in test mode but not after switching to EnforceMode was not saved after being changed from Test to EnforceReturn to the rule, confirm Mode shows Enforce, and save again
Rule is in Enforce mode but still does not fire on qualifying messagesA higher-priority rule matched first and included Stop processing more rulesRun Message Trace on a qualifying message; identify which rule stopped processing; adjust that rule's priority or remove the stop action
Disclaimer is not appending to messagesMessage is S/MIME encrypted or already contains the exact disclaimer text; or the fallback action is set to Ignore instead of WrapChange the fallback action to Wrap; verify the message is not S/MIME signed or encrypted before the rule evaluates
Test mode generating no incident reportsNo qualifying messages were sent after the rule was saved, or the incident report email address is blankSend a test message that matches the condition; verify the report address is configured on the rule
Cannot create the rule — limit error in the admin centerTenant has reached the 300-rule cap; active, test-mode, and disabled rules all countAudit existing rules in the EAC; disable or delete rules that are no longer in use to free capacity

Rule priority runs from 0 (highest) upward

Priority 0 evaluates first. A rule set to priority 5 runs after any rule numbered 0 through 4. When a rule's action includes Stop processing more rules, no lower-priority rule evaluates on that message — even if it would have matched. If you have a catch-all rule that is firing too broadly and blocking everything below it, raise its priority number (run it later) or remove the stop action.

A faster way to handle personal inbox routing#

Transport rules enforce org-wide policy at the server layer. They do not help individual users triage, prioritize, or draft replies to the mail that gets through. That is a different layer, and it is where AI Emaily sits.

AI Emaily connects to your mailbox — Gmail, Outlook, or IMAP — and handles personal inbox triage: filing, surfacing what actually needs attention, and drafting replies in a voice you define through a Personal Context brain and per-sender profiles. It reads no past mail to configure itself; you set the context directly.

If Exchange Online transport rules are already handling your org-wide filtering and you want personal triage on top of that, a 7-day free trial on Pro and Autopilot plans shows how the two layers complement each other without overlapping. We build AI Emaily.

Frequently asked

Nafiul Hasan

Written by

Nafiul Hasan

Nafiul Hasan is an entrepreneur and AI automation system builder with 10+ years of experience turning messy, manual workflows into reliable automated systems. He designs and ships AI enterprise solutions end-to-end — the agent logic, the data plumbing, and the product people actually use — and founded AI Emaily to give busy professionals their attention back. He writes here from the builder's seat: what works, what breaks, and how to put AI to work without giving up control.

EntrepreneurAI Automation System BuilderAI EnthusiastBuilds AI Enterprise Solutions10+ years experience
More from Nafiul
Ready when you are

Transport rules handle what the whole org sees. AI Emaily handles what you see.

Personal triage, voice-matched drafting, and client-level routing — built on top of whatever Exchange Online already enforces at the server layer. 7-day free trial on Pro and Autopilot.

  • 7-day free trial
  • Cancel anytime
  • Every provider