Skip to content
KVKK & GDPR Compliant Turkey Data Center 24/7 Technical Support destek@mxgate.com.tr
New: IP reputation monitoring is now free on every plan Start your 14-day free trial →
INTEGRATION GUIDE · MICROSOFT EXCHANGE

Exchange Smart Host Setup

On Exchange you route outbound mail by creating a Send connector: DNS routing is turned off, the MXGate address is given as the smart host, and authentication after TLS is selected. Because the wizard has no port field, port 587 must be set separately from the shell. Your Receive connectors and MX records are left untouched.

Time
About 10 minutes
Requires
Organization Management role
Version
Exchange 2016 · 2019 · Subscription Edition
Address
smtp.mxgate.com.tr · 587
Scope
Outbound mail only (Send connector)
WHAT CHANGES

The only thing that changes is the path out

Today Exchange looks up the recipient’s MX record and sends the message directly, and whether it arrives is decided by the reputation of your corporate IP address alone. After setup, the same message is handed to MXGate first, inspected there, and sent on from continuously monitored addresses.

Now Exchange DNS routing Recipient server Mail leaves directly. Whether it is delivered depends only on the reputation of your corporate IP address.
After setup Exchange Send connector MXGate :587 Recipient server Mail is first handed to MXGate over an authenticated, encrypted connection, inspected there, and sent on from continuously monitored addresses.
Mailboxes, Receive connectors and client settings stay where they are Applications such as CRM and ERP keep sending to Exchange, and their mail takes the same route Inbound mail is redirected separately via the MX record; this guide does not cover it For the full corporate picture, see the Enterprise page, and for an overview of the method Smarthost
SETUP

Exchange smart host setup in seven steps

The first four steps are done in the wizard in the Exchange admin center, the remaining three in the Exchange Management Shell. If you would rather do everything in one command without opening the wizard, use the longer command in step five.

  1. Open the new Send connector wizard in the EAC

    In the Exchange admin center go to the Send connectors tab under Mail flow and click Add. In the wizard that opens, give the connector a name and choose Custom as the Type.

    EAC PATH copy
    Mail flow › Send connectors › Add › New Send connector
    #  Name: MXGate Smarthost   ·   Type: Custom
  2. Choose smart host routing and add the address

    On the second page of the wizard select Route mail through smart hosts, click Add, and enter the name of the MXGate server in the dialog that opens. The source servers must be able to resolve this name through DNS.

    ADD SMART HOST copy
    # Fully qualified domain name (FQDN)
    smtp.mxgate.com.tr
    You can also give an IP address here, but the TLS-based authentication in the next step requires the server certificate to contain this exact fully qualified domain name. Use the name, not the IP.
  3. Choose the authentication method

    In the Route mail through smart hosts section select Offer basic authentication only after starting TLS and enter the username and password from your MXGate panel. This option sends the credentials only after TLS has been established.

    New Send connector › Route mail through smart hosts
    None
    Basic authentication
    Offer basic authentication only after starting TLS
    Username
    username from the panel
    Password
    ••••••••••••
    Exchange Server authentication
    Externally secured
    Back Next

    A representation of the screen. The option names match the English labels in the Exchange admin center.

    The other four options are not suitable for the MXGate connection; the table below compares what each of them does.
  4. Define the address space and the source servers

    In the Address space section enter SMTP as the Type, an asterisk as the fully qualified domain name and 1 as the Cost. Then, in the Source server section, select the Mailbox servers that will send mail to the smart host and finish the wizard.

    ADDRESS SPACE copy
    # Type        SMTP
    # FQDN        *   (all external domains)
    # Cost        1   (a lower value means a more preferred route)
    If you have multiple Active Directory sites, the Scoped send connector box limits the connector to the same site. If you leave it unticked the connector is usable by every transport server in the forest, which is the default.
  5. Set the port to 587

    The wizard has no port field and the connector is created with port 25. Because the MXGate connection uses 587, you have to set this value separately from the shell. This is the most commonly skipped step in the setup.

    EXCHANGE MANAGEMENT SHELL copy
    Set-SendConnector -Identity "MXGate Smarthost" -Port 587
    
    # If you prefer to create the whole connector in one command
    $cred = Get-Credential
    New-SendConnector -Name "MXGate Smarthost" -Custom -AddressSpaces "*" `
      -DNSRoutingEnabled $false -SmartHosts "smtp.mxgate.com.tr" `
      -SmartHostAuthMechanism BasicAuthRequireTLS -AuthenticationCredential $cred `
      -Port 587 -RequireTLS $true
    The default port is 25. Without this command the connector looks correct but never connects to 587, and you see timeout errors in the queue.
  6. Verify the settings

    You can see whether the connector really has the values you expect with a single command in the shell. Check the port, the authentication mechanism and that DNS routing is off in particular.

    EXCHANGE MANAGEMENT SHELL copy
    Get-SendConnector "MXGate Smarthost" | Format-List `
      Name, SmartHosts, Port, SmartHostAuthMechanism, DNSRoutingEnabled, RequireTLS
    
    # Expected values
    #   SmartHosts             : [smtp.mxgate.com.tr]
    #   Port                   : 587
    #   SmartHostAuthMechanism : BasicAuthRequireTLS
    #   DNSRoutingEnabled      : False
  7. Send a test and read the protocol log

    Turn protocol logging up to verbose for the connector, send a message from a user to an external address, and follow the session with MXGate in the log. When you see a 250 response in the log, the setup is working.

    LOGGING copy
    Set-SendConnector -Identity "MXGate Smarthost" -ProtocolLoggingLevel Verbose
    
    # Default log location
    %ExchangeInstallPath%TransportRoles\Logs\Hub\ProtocolLog\SmtpSend
    
    # Anything stuck in the queue?
    Get-Queue | Where-Object { $_.Identity -like "*MXGate*" }
    Setup complete. Once the log shows the TLS session with MXGate and the message accepted with a 250 response, outbound mail is going through MXGate authenticated and encrypted. Set the logging level back to None when you have finished troubleshooting.
OPTIONS

Five authentication methods — which one and why?

The wizard offers five options at this point and only one of them is suitable for the MXGate connection. The right-hand column gives the PowerShell equivalent of each.

Option in the wizard PowerShell value What it does MXGate
None None No authentication. Used only when access to the smart host is restricted by source IP address. Not suitable
Basic authentication BasicAuth Requires a username and password, but the credentials are sent in clear text. Not suitable
Offer basic authentication only after starting TLS BasicAuthRequireTLS TLS is established first and the credentials are only sent over the encrypted channel. This is the option to use for the MXGate connection. Choose this
Exchange Server authentication ExchangeServer GSSAPI-based authentication, intended for connections between Exchange servers. Not suitable
Externally secured ExternalAuthoritative The connection is presumed to be secured by a mechanism outside Exchange, such as IPsec or a VPN. Not suitable
Certificate name match: when authentication after TLS is selected, the smart host’s certificate must contain the exact fully qualified domain name you entered on the connector. If you enter an IP address instead, the match fails and the connection is not established.
MAPPING

The PowerShell equivalent of every field in the wizard

The same connector can be created either way. This table shows which field maps to which parameter as you go through the interface, and doubles as a direct reference if you work from the command line.

Field in the wizard PowerShell parameter What it is for
Type -Custom The connector usage type. For smart host routing you choose Custom or Internet.
Route mail through smart hosts -DNSRoutingEnabled $false Stops Exchange from looking up the recipient’s MX record; mail is delivered only to the address you give.
Add smart host › FQDN -SmartHosts "smtp.mxgate.com.tr" The address mail is handed to. The source servers must be able to resolve this name in DNS.
Authentication option -SmartHostAuthMechanism BasicAuthRequireTLS Authentication with a username and password after TLS has been established.
Username and password -AuthenticationCredential (Get-Credential) This parameter is required when BasicAuth or BasicAuthRequireTLS is selected.
Address space › FQDN -AddressSpaces "*" Which domains the connector applies to. An asterisk means all external domains.
Source server -SourceTransportServers The Mailbox servers that will send mail to the smart host. If omitted, the local server is used.
(not in the wizard) -Port 587 The wizard has no port field and the default is 25. If you need 587 it must be set separately. The default is 25.

The interface labels and parameter names come from the vendor documentation: Create a Send connector to route outbound mail through a smart host and New-SendConnector.

TROUBLESHOOTING

What does the error in the queue or protocol log mean?

The six rows below cover almost every problem seen after an Exchange smart host setup. Look for the symptom in the left column.

Symptom What it means Fix
Timeouts in the queue, no connection The connector is still using port 25 The wizard never asks for a port and the default is 25. Fix it by setting the Port parameter to 587 with Set-SendConnector, and confirm with Get-SendConnector.
TLS negotiation failed The smart host certificate does not match the name on the connector Authentication after TLS requires the certificate to contain the exact fully qualified domain name on the connector. Enter the domain name, not an IP address, in the smart host field.
5.7.3 Authentication unsuccessful The credentials are missing or wrong The AuthenticationCredential parameter is mandatory when BasicAuth or BasicAuthRequireTLS is selected. Copy the credentials from the panel again and update them with Set-SendConnector.
451 4.4.0 DNS query failed The connector is still looking up MX records Confirm that DNSRoutingEnabled is False and SmartHosts is populated. Smart host routing only works when DNS routing is off.
Some servers still send directly The source server list is incomplete Add every Mailbox server that sends mail outside to the Source server section. Servers not on the list keep using another connector.
The connector is never used Another connector with a lower cost covers the same address space List all connectors with Get-SendConnector. Disable the old internet connector, or raise its cost so the new one is preferred.

Rolling back

If you want to undo the setup, disabling the connector is enough; there is no need to delete it. As long as your old internet connector is still enabled, mail immediately goes back to its previous route.

EXCHANGE MANAGEMENT SHELL · ROLLBACK optional
# Disable the connector
Set-SendConnector -Identity "MXGate Smarthost" -Enabled $false

# If you want to remove it completely
Remove-SendConnector -Identity "MXGate Smarthost"
FAQ

Questions from Exchange administrators

The wizard has no port field — how do I set port 587?

A Send connector is always created with port 25; the wizard never asks for a port. To use 587 you must set the Port parameter with Set-SendConnector in the Exchange Management Shell after creating the connector. If you create the connector in a single command, you can add the Port parameter to New-SendConnector as well.

Which authentication option should I choose?

Choose Offer basic authentication only after starting TLS, which is BasicAuthRequireTLS in PowerShell. It sends the credentials only after TLS has been established. When this option is used a username and password are mandatory, and the smart host certificate must contain the exact fully qualified domain name you entered on the connector.

Do I need to delete my existing internet connector?

You do not have to delete it, but when two connectors cover the same address space Exchange picks the one with the lower cost. You can disable the old connector, or raise its cost so the new one is preferred. Leaving both enabled makes it unclear which connector mail actually leaves through.

Does this setup affect incoming email?

No. A Send connector only determines the path that mail leaving Exchange takes. Your Receive connectors, MX records and mailboxes stay exactly as they are. Putting inbound traffic through MXGate as well is a separate step, made through the MX record.

We use Microsoft 365 (Exchange Online) — does this guide apply?

No. This guide is for Exchange Server installations running on premises. On Exchange Online, outbound routing is configured with cloud connectors in the Exchange admin center and requires additional steps such as domain validation. In a hybrid setup this guide does apply to the on-premises servers.

Last updated: · Applies to: Exchange Server 2016 · 2019 · Subscription Edition