Hybrid environments

CodeTwo Exchange Rules supports installation in Exchange Server on-premises + Exchange Online / Office 365 hybrid environments. Since nothing can really be installed in the cloud, the success of the software deployment in hybrid environments relies on the proper mail flow configuration by the admin.

How does it work


CodeTwo software always intercepts emails for processing with its agent installed at the Microsoft Exchange Transport Service of the on-premises Exchange Server.

So for CodeTwo Exchange Rules to be able to process emails in the hybrid environment, such environment must be set to route all emails through a server with CodeTwo software installed. Emails that do not pass a server with CodeTwo software installed will obviously not be processed.

Inbound and outbound traffic

The best case scenario for CodeTwo software to process most of the mail traffic in the organization would be a hybrid environment configured as follows:

  • Centralized Mail Transport (CMT) feature enabled in the Exchange Online / Office 365 Hybrid Configuration wizard so all outbound mail flow from Exchange Online / Office 365 is routed through the on-premises Exchange Server(s) instead of standard direct delivery to the Internet. This way you can ensure your organization's compliance polices are met (e.g. emails are scanned by your anti-spam or anti-virus Transport Agents or stamped with signatures or legal disclaimers by CodeTwo Exchange Rules).
  • MX records at the DNS host of your domain name registrar company pointed to your Exchange Server on-premises instead of routing through Exchange Online Protection (EOP). This will ensure all incoming mail flows through your on-premises CodeTwo equipped server.


Other scenarios are possible and may be partially supported by CodeTwo Exchange Rules, however, the main point that must be kept in mind is that only emails that are routed through the on-premises Exchange Server, equipped with CodeTwo software are processed.

Internally sent messages

Similarly to the external in our out traffic, internally sent messages are only processed assuming they pass the on-premises Exchange Server. Following that, three scenarios are possible:

  • Either sender or recipient has its mailbox in the cloud and the other one has its mailbox in on-premises Exchange Server - emails will be processed by CodeTwo software as they have to pass CodeTwo equipped server on its way to the recipient.
  • Both sender and recipient have mailboxes in on-premises(s) servers - the same as above, emails will be processed by CodeTwo software as they have to pass CodeTwo equipped server on its way to the recipient.
  • Both sender and recipient have mailboxes in the cloud - Unfortunately, in this scenario emails will not be processed by CodeTwo software as they do not pass on-premises server(s) at any point of their journey to the recipient's mailbox. This is regardless on how you set up the CMT feature state or MX records because mailboxes are always searched for locally first and if found, emails are delivered directly. Unless Microsoft enables possibility to route such emails out of the cloud to the on-premises Exchange Server for processing before delivery, serving such emails, not only by CodeTwo Exchange Rules, but by any third party software is not possible.

See also

CodeTwo Sent Items Update service configuration in hybrid setups.

Microsoft article on Centralized Mail Transport feature in hybrid deployments.

Microsoft article on Transport routing in Exchange 2013 hybrid deployments.

Was this information useful?