If you have multiple domains in your Exchange Server 2007/2010/2013/2016/2019 and need some or all of them to route through a different Send Connector, you will need to enable SBR (Sender Based Routing) in your Exchange Server.
Sender Based Routing is not supported in Exchange Server (on-premises) 2007/2010/2013/2016/2019 natively, so a custom SBR Transport agent must be configured.
This tutorial gives you a quick overview of how to set up and enable
"Sender Based Routing or Transport Rule Based Routing"
in Exchange Server (on-premises) 2007/2010/2013/2016/2019.
Exchange Server doesn’t support “Sender Based Routing” natively, but you can use an Exchange Server plugin to enable this function.
How it works:
"EA Sender Based Routing"
on Exchange Server.Send Connector
on Exchange Server.Routing Rule
in Sender Based Routing Manager
.“Sender Based Routing Agent” checks if current email message matches the routing rule based on Sender, Sender Group, Recipient, Headers or Subject conditions:
You can download EA Sender Based Routing for Exchange Server Installer and install it on your server.
Double click the installer file and the installation will be executed automatically. The installer requires Exchange Server 2007 SP1/2010/2013/2016/2019 to be installed. If no Exchange Server is detected in your operating system, Setup will be aborted.
After the installation is completed, click “Sender Based Routing Manager” from Windows
Start menu
-> All Programs
-> “EA Sender Based Routing”
to begin the setup.
Note
Installation Permission
An account with Administrative Privileges is required to run the installer for installing “Send Based Routing” on Exchange Server.
Important
After the installation is complete, I strongly suggest that you check “Microsoft Exchange Transport Service”
and “Microsoft Exchange Mail Submission Service” in Control Panel
-> Administrative Tools
-> Services
, and check if those services are running,
if not, start them manually.
For example, if you want to relay all emails from domain “mysenderdomain.com”
using a specified Send Connector
,
you would create a new Send Connector
from the
Exchange Admin Center
(https://yourserver/ecp
) -> mail flow
-> Send Connectors
,
and name it as mysenderdomain.com.sbr
.
Note
In Exchange 2007/2010, you should use Exchange Management Console
->
Organization Configuration
-> Hub Transport
-> Send Connectors
to
create a new Send Connector
.
Then select Next
, select "MX record associated with recipient domain"
or
"Route mail through smart hosts"
based on your environment. If you
selected "Route mail through smart hosts"
, add your smart host to the hosts list.
Important
For Exchange Server 2007 - 2013, you must use a smart host (Route mail through smart hosts
) in
this Send Connector, otherwise, your email will get SMTPSEND.DNS.NonExistentDomain
error.
For Exchange 2013 SP1 - 2019, you can use either “Route mail through smart hosts” or “MX record associated with recipient domain”.
Then select Next
, if you selected "Route mail through smart hosts"
,
set user authentication for your smart host based on your smart host requirement, default is none.
If you selected "MX record associated with recipient domain"
, this step is skipped.
Then select Next
, click the plus sign (+), and add mysenderdomain.com.sbr
into address space,
you need to input this address space
into "Sender Based Routing Rule"
at next section.
Important
You should use a virtual/non-existent domain name
in address space, do not use a real domain name or *.
This send connector is created for relaying message based on the routing rule,
if a real domain name is used, all emails to the domain will be relayed by this send connector,
no matter if the email is matched the rule.
Click Next
, add your source servers and then Finish
.
After the above Send Connector
is created, we can create a routing rule
to use this Send Connector
.
Now we need to create a rule in "Sender Based Routing Manager"
to re-route the email to the Send Connector
created in previous section.
Here is how “Sender Based Routing Rule” works:
Open “Sender Based Routing Manager” from Windows Start menu
->
All Programs
-> “EA Sender Based Routing”
Routing Rules
-> New
;"if the sender address matches the following pattern"
;*@mysenderdomain.com
in Sender Address
, sender address supports wildcard (* and ?);mysenderdomain.com.sbr
in Address Space
, this is the address space
you have added in your Send Connector
.Browse
to select the Send Connector instead of inputting the address space directly.Important
You should input the address space/virtual domain
you have added in your send connector, not your send connector name.
Finally, click Save
, after this rule is created, all emails from *@mysenderdomain.com
will be relayed by
“mysenderdomain.com.sbr” Send Connector.
Moreover, you can click Address Space
to open the advanced options, and
set the different connectors based on recipient address.
You can enable Full Debug Log in Sender Based Routing Manager
-> Journal
, then send a test email
from *@mysenderdomain.com
, and check the log content to see if the rule works as expected.
Note
Sender Address
supports multiple addresses or domains, you can separate domains and addresses by comma(,).
For example, you can input *@mysenderdomain1.com, *@mysenderdomain2.com
.
An email has two addresses associated with sending it: the envelope sender, and the From address. The envelope sender is where computers should respond (in the case of bounce messages or errors); the From address is where people should respond.
In most cases, the envelope sender and the From address are identical.
But they aren’t same always. For example, a non-delivery report
always uses null address (<>
) as the envelope sender address,
and use the postmaster address as the From address.
In SBR 1.1.0.6 or earlier version, the envelope sender is used to match the sender pattern; In later version, Both envelope sender and From address are used to match the sender pattern. Either envelope sender or From address matches the sender pattern, the email will be re-routed.
user@domain
;sender: user@domain
;from: user@domain
.<>
or sender: <>
or from: <>
.Besides Sender Condition
, you can also add more conditions such as Header
, Sender Group
,
Recipient
and Subject
. The email message will
be re-routed to specified Send Connector
while the rule matches all conditions.
If you would create more complex conditions that "Sender Based Routing Manager"
doesn’t support,
you can combine Exchange built-in Transport Rule
and Header Condition
like this:
Open Exchange Admin Center
(https://yourserver/ecp
) -> mail flow
-> rules
Note
In Exchange 2007/2010, you should use Exchange Management Console
->
Organization Configuration
-> Hub Transport
-> Transport Rules
to
create a new Transport Rule
.
"more options"
;"add conditions"
, add the conditions you want;"add action"
-> "Modify the message properties"
-> "Set the message header to this value"
"X-Reroute-Message"
, value is set to "yes"
Then create a rule in "Sender Based Routing Manager"
like this:
Routing Rules
-> New
;"if the sender address matches the following pattern"
;*@mysenderdomain.com
in Sender Address
, sender address supports wildcard (* and ?);X-Reroute-Message: yes
to Headers List
;mysenderdomain.com.sbr
in Address Space
, this is the address space
you have added in your Send Connector
.Combining with above Transport Rule
and Header Conditions
, the emails from *@mysenderdomain.com
with subject or body text including “reroute” will be re-routed to “mysenderdomain.com.sbr” Send Connector
.
As I mentioned, in Exchange Server 2007 - 2013,
you should use a smart host (Route mail through smart hosts
) in Customized Send Connector
,
otherwise your email will get SMTPSEND.DNS.NonExistentDomain
error.
Note
If your Exchange Server is 2013 SP1 or later version, you can ignore this section.
Therefore, you should consider this limitation, and create the proper Send Connector
and Router Rule
.
For example, if you want to relay emails like this:
*@mysenderdomain.com
by MX lookup (MX record associated with recipient domain
);Route mail through smart hosts
).You cannot create a Customized Send Connector
to relay the emails from *@mysenderdomain.com
(Because DNS MX lookup is not supported).
You should create a Customized Send Connector
named "not.mysenderdomain.com.sbr"
,
set smart host
in this Send Connector
, and then set a rule like this:
"if the sender address doesn't match the following pattern"
;*@mysenderdomain.com
in Sender Address
;not.mysenderdomain.com.sbr
in Address Space
.With above settings, all emails from *@mysenderdomain.com
are relayed by Default Send Connector
(DNS MX lookup),
and other emails are relayed by Customized Send Connector
(smart host).
By default, SBR doesn’t reroute the internal recipient in your organization.
If you want to reroute internal recipient,
you should specify the recipients explicitly by Add more conditions
-> Recipient Condition
.
For example, you want to reroute all emails to internal user, you should
select One of recipient in the list
or All recipient in the list
, and input *@yourdomain
to the list.
In some cases, you need to route the email to third-party server by customized Send Connector
,
after third-party server processed the email,
the email will be sent back to your server, then your server sends it by default Send Connector
.
In this case, you must enable "Add the following header to prevent email dead loop"
option.
It works like this:
It is recommended to use same Header on multiple servers.
There is an alternative solution:
If your third-party server adds a special header automatically after the email has been processed, then
you can select and the email doesn't contain all of the following headers
in your rule, and add
the specified header to the header list. It means “if the header exists, then SBR won’t reroute the email”.
If you want to reroute the email to multiple Send Connectors based on recipient address as well, you can add multiple address spaces in your Send Connector like this.
Above setting means:
*@emailarchitect.net
, then reroute the email to emailarchitect.net.sbr
Send Connector;*@adminsystem.com
, then reroute the email to adminsystem.com.sbr
Send Connector;You can synchronize the configuration files on multiple servers as follows:
Install SBR on the first server, open the Sender Based Routing Manager
and create routing rule(s),
then click “Open Config Folder”, find rules.json
and global.json
in config folder,
copy those files to Your other Exchange Servers\Sender Based Routing installation path\conf
,
then all of your Exchange Servers have the same configuration.
The default installation path is: C:\Program Files (x86)\EAExchSBR
.
To enable Sender Based Routing on Exchange 2019 and Server Core without desktop experience installed, you should download the Installer , and then run it under DOS command or PowerShell.
Remote desktop installation is supported, but running the installer by Windows Admin Center -> PowerShell remotely is not supported.
DOS command:
eaexchsbr.exe
PowerShell:
./eaexchsbr.exe
The installer supports silent mode, you can use the following command to start silent installation.
DOS command:
start /wait eaexchsbr.exe /S
PowerShell:
start eaexchsbr.exe -ArgumentList /S -Wait
If you would like to manage Routing Rules
using GUI Manager, there is an alternative solution:
You can run the installer on a client machine (Windows 7 - Windows 10) without Exchange Server installed, the Plugin management tool will be installed.
After the Sender Based Routing Manager
is installed, open the manager and create routing rule(s),
then click “Open Config Folder”, find rules.json
and global.json
in config folder,
copy those files to Your Exchange Server\Sender Based Routing installation path\conf
,
then your Exchange Server has the same configuration.
The default installation path is: C:\Program Files (x86)\EAExchSBR
.
If Sender Based Routing
is not working properly, you can enable full debug log like this:
Sender Based Routing Manager
-> Journal
-> change Log Level
to Full Debug
.Send Connector
.If there is no debug log generated after you enabled full debug log,
you should verify the installation of EA Sender Based Routing Agent
like this:
Open Exchange Management Shell and input:
Get-TransportAgent
press enter
You will see "EA Sender Based Routing Agent"
in the output.
If there is no "EA Sender Based Routing Agent"
in the output,
you can try to re-run the installer directly to fix
this issue, or contact our technical support team for assistance.
If you changed your custom send connector delivery setting (smart host or DNS MX), you should restart MsExchangeTransport
Service to take effect.
Restart-Service "MSExchangeTransport"
Not enough? Please contact our technical support team.
Remarks
We usually reply emails within 24hours. The reason for getting no response is likely that your SMTP server bounced our reply. In this case, please try to use another email address to contact us. Your Gmail, Hotmail or Office 365 email account is recommended.