Scenario: Conditional mail routing

Exchange Online

Applies to: Exchange Online Protection

Topic Last Modified: 2016-06-17

If you have multiple sites, perhaps spread across the world, you can use connectors and mail flow rules (also known as transport rules) to route mail to a specific site, based on conditions.

This scenario is illustrated in the following graphic:


Exchange Online filters incoming messages before routing each message to a specific location.

An Outbound connector configured to use criteria-based routing is required to route mail to a site. To do this, you first create an Outbound connector that routes mail to a mail server, by IP address, at a specific site. To set up conditional mail routing, do the following:

  1. In the EAC, navigate to mail flow > connectors. click Add Icon to create a new connector.

  2. In the From: drop-down box, choose Office 365.

  3. In the To: drop-down box, choose either Your organization’s email server or Partner organization if you want to connect to a server other than your organizations.

    route to and from options
  4. Name the connector and add a description. If you want to turn the connector on immediately, check Turn it on. Click Next.

    name connector
  5. Choose Only when I have a transport rule… and click Next.

    transport rule option
  6. Specify one or more smart hosts to which OFfice 365 will deliver email messages.

    add host
  7. Define your Transport Layer Security (TLS) settings depending on your security needs.

    define TLS settings
  8. Review your new connector configurations and click Next to validate the connector.

Next, create a mail flow rule and assign it to the Outbound connector:

  1. In the EAC, navigate to mail flow > rules. Click Add Icon and choose Create a new rule….

  2. In the new rule window, name the rule. To ssee all the options available for the rule, click More options… at the bottom of the page.

    click more options
  3. For *Apply this rule if…, select The recipient… and has specific properties including any of these words. The select user properties box appears. Click Add Icon, and under User properties:, choose City. City is an Active Directory attribute made available for use by the transport rule. Specify the name of the city, such as New Orleans. Click OK, and then click OK again to close the select user properties box.

    apply rule if
    Check the accuracy of user attributes in Active Directory to ensure that the mail flow rule works as intended.
    Note that outbound connector changes may take time to replicate.
  4. For *Do the following…, choose Redirect the message to… and then specify the following connector. The select connector box appears. Choose the Outbound connector you created previously.

    You can choose additional properties for the rule, such as the test mode and when to activate the rule.

  5. To save the connector, click Save.

Once you complete these steps, the mail flow rule redirects messages addressed to users whose City property is set to New Orleans to the IP address specified by your Outbound connector.

To route messages to additional sites, as illustrated in the graphic, follow the same steps, but change the IP address in each connector and the City value in each transport rule to reflect the correct site.