--- title: "Configure SCG for Exchange Online (Transport Rule Method)" slug: "configure-scg-for-exchange-online-transport-rule-method" tags: ["Exchange Online", "Secure Mail"] updated: 2026-10-16T20:08:38Z published: 2026-10-16T20:08:38Z canonical: "docs.eshare.com/configure-scg-for-exchange-online-transport-rule-method" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.eshare.com/llms.txt > Use this file to discover all available pages before exploring further. # Configure SCG for Exchange Online (Transport Rule Method) This document describes the steps to create the eSHARE Outbound Connector, Inbound Connector, and sample transport rules in Exchange Online by using the Exchange Admin Center or via PowerShell. Provisioning this rule means Trusted Shares via Secure Mail Gateway are only created when the rule is matched. Before you implement these steps, we advise you to go through the SCG logic. The following steps will be reviewed: - [Create the Outbound Connector (M365 to eSHARE)](/collaborate/docs/configure-scg-for-exchange-online-transport-rule-method#outbound-connector-m365-to-eshare) - [Create the Inbound Connector (eSHARE to M365)](/collaborate/docs/configure-scg-for-exchange-online-transport-rule-method#inbound-connector-eshare-to-m365) - [Create the Connectors with PowerShell](/collaborate/docs/configure-scg-for-exchange-online-transport-rule-method#create-connectors-powershell) - [Create the Transport Rule](/collaborate/docs/configure-scg-for-exchange-online-transport-rule-method#create-transport-rules) - [Create the Transport Rules with PowerShell](/collaborate/docs/configure-scg-for-exchange-online-transport-rule-method#create-transport-rules-powershell) > **PREREQUISITES:** > > The person performing these steps must have an administrator role assignment of **Exchange Administrator** in the destination M365 tenant. ### **Create the Outbound Connector (M365 to eSHARE)** 1. Log in to the Exchange Admin Center and navigate to '**Mail flow**' > '**Connectors**'. 2. Select the '**+ Add a new connector**' button. 3. In the '**New connector**' pane: 1. In the '**Connection from**' section, select '**Office 365**'. 2. In the '**Connection to**' section, select '**Your organization’s mail server**'. 3. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.06.54@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=jGGbO7Fs2UkGM7q33dBff81WE%2BMi43icPMmckesCEm0%3D) 1. In the '**Connector name**' pane: 1. Enter a '**Name**' and '**Description**' for the connector (ex. **Connector for eShare SCG**). 2. Leave the '**Turn it on**' and '**Retain internal Exchange email headers**' (recommended) options enabled. 3. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.04.22@2x(1).png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=HRVlmsdykJbXZmbzv%2B9rZFox00BDRJoQ9lXbdZqihrQ%3D) 1. In the '**Use of connector**' pane: 1. Select the '**Only when I have a transport rule set up that redirects messages to this connector**' option. 2. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.11.44@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=%2FLZ4fNZB1f87i4td9DY8PFWRUxE33sZGYRkw3C8lvGo%3D) 1. In the '**Routing**' pane: 1. Input the IP address or the DNS smart host name provided to you by eSHARE, and select '**+**' to add it. 2. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.14.42@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=wlke89jfwSAtMhzxz5JKYU9EwUeDayFA%2F%2FhOeYGkBfA%3D) 1. In the '**Security restrictions**' pane: 1. Select the '**Always use Transport Layer Security (TLS) to secure the connection**' option. 2. Select the '**Any digital certificate, including self-signed certificates**' option and select '**Next**'. 3. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 09.33.47@2x(1).png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=maVwpd0%2Burjg%2FfQ4i2vy994aF63DWKK7c31IW%2FSltls%3D) 1. In the '**Validation email**' pane, input an external email address, select the '**+**' button, then select '**Validate**' to allow Exchange Online to validate the newly provisioned connector. After validation is completed, select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 09.35.54@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=%2FL2ol33wkbPoDJtefrvCmzHf3aW8ZFosCssFnzRGYps%3D) 1. In the '**Review connector**' pane, review the settings, and select '**Create connector**' to create & save it. Select '**Done**' to close the pane. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.17.13@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=%2FBqOP2cH6Gs7FYBxRUhYjKe%2FD56zQ62NE%2FuvcLUfyFQ%3D) ### **Create the Inbound Connector (eSHARE to M365)** 1. On the '**Mail flow**' > '**Connectors**' page, select the '**+ Add a new connector**' button. 2. In the '**New connector**' pane: 1. In the '**Connection from**' section, select '**Your organization’s mail server**'. 2. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.33.54@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=VnMylkBx0zdTbZQr%2Fd%2BXs4FdUQBPKzUXFtvUPRUa0z4%3D) 1. In the '**Connector name**' pane: 1. Input a '**name**'. 2. Input a '**description**'. 3. Leave the '**Turn it on**' and '**Retain internal Exchange mail header (recommended)**' options enabled. 4. Select the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.46.54@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=rv6AZ5qxSCpuZYrMk0zWUOkP3%2BGf69rk1PPtU9HXquM%3D) 1. In the '**Authenticating sent email**' pane: 1. Select the second option and input the IP address provided by eSHARE. 2. Select the '**+**' button, followed by the '**Next**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.48.48@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=9jQGkp8b1ZlC41cBTJJnTWzqZkse7Wl8C3LWW4t567g%3D) 1. In the '**Review connector**' pane, review the settings and select the '**Create connector**' button. ![](https://cdn.us.document360.io/c516537f-0d2f-4bf8-930d-3385ca9a11d7/Images/Documentation/CleanShot 2025-11-16 at 10.50.40@2x.png?sv=2026-02-06&spr=https&st=2026-11-18T20%3A16%3A59Z&se=2026-11-18T21%3A16%3A59Z&sr=b&sp=r&sig=Lss%2BH3bt5VxKoWziG2lk%2BWtgSRhtFAwlPrGt8EQT9qY%3D) 1. Select '**Done**' to close the pane. The newly created connectors are displayed on the '**Mail flow**' > '**Connectors**' page. ### **Create the Connectors with PowerShell** Instead of the Exchange Admin Center, the connectors for eSHARE may be created using Exchange Online PowerShell. Running the PowerShell cmdlets shown below requires the Exchange Online PowerShell V2 module. To install the necessary prerequisites, please visit: [https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module](https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module) 1. In PowerShell, run the command below to load the EXO V2 module. ```powershell Import-Module ExchangeOnlineManagement ``` 1. Connect to Exchange Online as an Exchange Administrator. ```powershell Connect-ExchangeOnline -UserPrincipalName myadmin@myorgdomain.com ``` 1. Run the command below to verify the connection to Exchange Online. ```powershell Get-Mailbox ``` 1. Run the command below to create the Outbound Connector. Change the values for -Name and -Comment as desired. The value for -SmartHosts will be provided by eSHARE. ```powershell New-OutboundConnector -Name "M365 to eShare SCG" -TlsSettings EncryptionOnly -UseMx $False -Comment "Connector to route emails from Exchange Online to eShare secure mail gateway" -AllAcceptedDomains $False -ConnectorType OnPremises -IsTransportRuleScoped $True -SmartHosts "insert_ip_address" ``` 1. To create a partner connector, run the following command. ```powershell New-OutboundConnector -Name "M365 to eShare SCG" -RecipientDomains * -TlsSettings EncryptionOnly -SmartHosts 13.77.229.101 -ConnectorType Partner -IsTransportRuleScoped $false - TestMode $False -Enabled $true -UseMXRecord $False ``` 1. Run the command below to create the Inbound Connector. Change the values for -Name and -Comment as desired. The value for -SenderIPAddresses will be provided by eSHARE. ```powershell New-InboundConnector -Name "eShare SCG to M365" -SenderDomains * -SenderIPAddresses "insert_ip_address" -ConnectorType onPremises -RestrictDomainsToIPAddresses $true ``` 1. Verify the connectors are created as required by reviewing them in the Exchange Admin Center or by running the following commands. Update the connector names as applicable. ```powershell Get-OutboundConnector "M365 to eShare SCG" | Format-list Get-InboundConnector "eShare SCG to M365" | Format-list ``` 1. Run the following command to validate the Outbound Connector. Update the connector name as applicable. ```powershell Validate-OutboundConnector -Identity "M365 to eShare SCG" -Recipients user@externaldomain.com,user@publicemaildomain.com ``` 1. After successful validation, disconnect from Exchange Online PowerShell by running the command below. ```powershell Disconnect-ExchangeOnline ``` ### **Create the Transport Rule** > [!WARNING] > Note: > > This is only a sample mail flow rule. The mail flow rules to be created in your tenant may vary depending on your requirements and the use cases you intend to support with eSHARE. 1. Navigate to '**Mail flow**' > '**Rules**'. 2. Select the '**+Add a rule**' icon and select '**Create a new rule**'. 3. Enter a suitable name for the rule (ex. **Outbound mails to eShare Email Appliance**). 4. Under '**Apply this rule if**': 1. Select '**The sender**' > is '**external/internal**'. 2. Select '**Inside the organization**' and click '**OK**'. 5. Select '**Add Condition**': 1. Select '**The recipient**' > is '**external/internal**'. 2. Select '**Outside the organization**' and click '**OK**'. 6. Select '**Add Condition**': 1. Select '**The subject or body**' > is '**subject includes any of these words**'. 2. Add the keyword '**[secure]**' found in a Subject. 7. Under '**Do the following**': 1. Select '**Redirect the message to**' > '**the following connector**'. 2. Select the connector you created first, sending mail to the eSHARE Appliance. 8. Under '**Except if**': 1. Select '**Add exception**', then select '**The message headers…**' > '**Matches these text patterns…**'. 2. Add the message header '**x-secure-processor**', and enter the word '**eflsmg**'. 9. Select the '**Save**' button to complete creating the Transport Rule. 10. Edit the newly created mail flow rule. Enable '**Stop processing more rules**' and select '**Save**' to update the rule. Your Exchange configuration is now complete. Mails originating from your organization to recipients outside will be passed through eShare Secure Email Appliance for processing. ### **Create the Transport Rules with PowerShell** Instead of the Exchange Admin Center, the mail flow rules for eSHARE may be created using Exchange Online PowerShell. Running the PowerShell cmdlets shown below requires the Exchange Online PowerShell V2 module. To install the necessary prerequisites, please visit: [https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module](https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module) 1. In PowerShell, run the command below to load the EXO V2 module. ```powershell Import-Module ExchangeOnlineManagement ``` 1. Connect to Exchange Online as an Exchange Administrator. ```powershell Connect-ExchangeOnline -UserPrincipalName myadmin@myorgdomain.com ``` 1. Run the command below to verify the connection to Exchange Online. ```powershell Get-Mailbox ``` 1. Create the rule to route emails with certain x-headers to eSHARE. ```powershell New-TransportRule -Name "Emails with eShare X-Header" -FromScope InOrganization -SentToScope NotInOrganization -HeaderContainsMessageHeader "x-smg" -HeaderContainsWords "[attachments]", "[securemail]" -ExceptIfHeaderContainsMessageHeader "x-secure-processor" -ExceptIfHeaderContainsWords "smg" -ExceptIfSenderIpRanges "" -RouteMessageOutboundConnector "M365 to eShare SCG" -StopRuleProcessing $True -Mode Enforce -Enabled $false ``` 1. Create the rule to route email with certain keywords in the subject to eSHARE. ```powershell New-TransportRule -Name "Emails with eShare Keywords" -FromScope InOrganization -SentToScope NotInOrganization -SubjectContainsWords "[attachments]", "[securemail]" -ExceptIfHeaderContainsMessageHeader "x-secure-processor" -ExceptIfHeaderContainsWords "smg" -ExceptIfSenderIpRanges "" -RouteMessageOutboundConnector "M365 to eShare SCG" -StopRuleProcessing $True -Mode Enforce -Enabled $false ``` 1. Create the rule to route emails with attachments over 2 MB to eSHARE. ```powershell New-TransportRule -Name "Emails with attachments over 2 MB" -FromScope InOrganization -SentToScope NotInOrganization -AttachmentSizeOver "2 MB" -SetHeaderName "x-smg" -SetHeaderValue "[attachments]" -ExceptIfHeaderContainsMessageHeader "x-secure-processor" -ExceptIfHeaderContainsWords "smg" -ExceptIfSenderIpRanges "" -RouteMessageOutboundConnector "M365 to eShare SCG" -StopRuleProcessing $True -Mode Enforce ``` 1. Create the rule to route emails with MIP labels to eSHARE. ```powershell New-TransportRule -Name "Emails with MIP Label" -FromScope InOrganization -SentToScope NotInOrganization -HeaderContainsMessageHeader "msip_labels" -HeaderContainsWords "MSIP_Label_^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$_Enabled=true" -SetHeaderName "x-smg" -SetHeaderValue "[secure-attachment]" -ExceptIfHeaderContainsMessageHeader "x-secure-processor" -ExceptIfHeaderContainsWords "smg" -ExceptIfSenderIpRanges "" -RouteMessageOutboundConnector "M365 to eShare SCG" -StopRuleProcessing $True -Mode Enforce ```