How to configure smart host (mail relay) services to work with CodeTwo software


You use smart host (mail relay) services (e.g. for security or anti-spam protection) and you would like to configure them to work with CodeTwo cloud services.


To ensure correct mail flow in your organization (Fig. 1.), you will have to reconfigure your smart host's Exchange Online outbound connector and the associated transport rule. Follow the steps below.

Fig. 1. Proper mail flow when using smart host and CodeTwo services.

  1. Log in to your Microsoft 365 admin center (Office 365 admin center).
  2. Go to Admin centers, Exchange to access your Exchange admin center.
  3. Select mail flow from the left menu, and open the connectors tab.
  4. Find and select the outbound connector of your smart host, as shown in Fig. 2. Click the Edit (pencil icon) button.

Fig. 2. Configuration of connectors in Exchange admin center.

  1. The Edit Connector wizard will open (Fig. 3.). Click Next

Fig. 3. The Edit Connector wizard.

  1. Select the first option, as shown in Fig. 4. (Only when I have a transport rule...), and click Next. Leave the other settings unchanged and complete the wizard.

Fig. 4. Reconfiguration of your smart host's outbound connector.

  1. Now you need to add a new transport rule for your smart host's outbound connector. Switch to the rules tab, click the New (+) button (Fig. 5.) and choose Create a new rule... from the drop-down menu.

Fig. 5. Adding a new transport rule for the smart host's outbound connector.

  1. A new window will open. Name your rule and click More options... to turn on additional options. Configure the rule so that it looks exactly like the one shown in Fig. 6.:
  • add a new condition by selecting A message header... matches these text patterns. Type the name of the header (X-CodeTwoProcessed) and the text pattern that needs to be matched (true);
  • add a new action: choose Redirect the message to... the following connector and select your smart host's outbound connector. Leave the other fields as they are and save the rule.

Fig. 6. Correct configuration of the transport rule for your smart host.

  1. The rule will be saved at the bottom of the list, with the lowest priority. Move it up using the arrow button, so it is directly below the CodeTwo transport rule (by default, the CodeTwo rule has 0 priority - in this case your smart host rule should have a priority of 1, as shown in Fig. 7.). You can also edit the rule and change the priority manually.

Fig. 7. Priority of transport rules.

Your mail flow is now configured and emails will be routed through our cloud services and your smart host service before they reach their recipients.


If you experience any mail flow problems when sending emails via SMTP clients (e.g. Mozilla Thunderbird), see this article.