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 1-month free trial →
INTEGRATION GUIDE · cPANEL / WHM

cPanel / WHM Smarthost Setup

You define three sections in WHM’s Exim Configuration Manager: routing, transport and authentication. After that, every message leaving the server is relayed through MXGate over an authenticated, encrypted connection. Your inbound settings and MX records are left untouched.

Time
About 10 minutes
Requires
WHM root access
Version
cPanel 92+ · Exim 4.94+
Endpoint
smtp.mxgate.com.tr · 587 · STARTTLS
Scope
Outbound mail only
Plugin support
MXGate cPanel/WHM plugin · capabilities
cPANEL / WHM PLUGIN

The MXGate cPanel/WHM plugin instead of manual configuration

If you would rather not apply the setup steps on this page by hand, the MXGate plugin performs the same smarthost setup from inside WHM, and SPF, DKIM and inbound filtering are managed from the same screen.

In the panelWHM → Plugins → MXGate
Smarthost tab: status, connection settings and connection test
Smarthost tab: status, connection settings and connection test
SPF records tab: per-domain SPF status and bulk update
SPF records tab: per-domain SPF status and bulk update
DKIM signing tab: key and DNS record status
DKIM signing tab: key and DNS record status
Inbound Spam Filter tab: importing domains and dry run
Inbound Spam Filter tab: importing domains and dry run
Last 24 hours summary, rollback history and plugin settings
Last 24 hours summary, rollback history and plugin settings

Smarthost setup

Enter the server address, port and SMTP account; the connection is tested before saving.

  • TLS and login are verified without sending mail
  • Exim settings are backed up on switch-on; a faulty setting rolls back automatically
  • An existing hand-made smarthost setting is detected and taken over on approval

Rollback history

A snapshot is taken before every change.

  • One-click return to the previous state
  • Switching the smarthost off restores the server exactly

Last 24 hours summary

Mail traffic on one screen, explained in plain language.

  • Delivered, deferred and rejected counts
  • Queue status and latest errors

SPF management

MXGate is added to your domains’ SPF records.

  • Domains on Google, Microsoft or Yandex are protected in bulk actions
  • You can still change them one by one
  • Filtering, paging and a DNS lookup limit warning

DKIM management

Every domain’s signing status in one list.

  • Key present, DNS record published, visible from outside
  • Missing keys are created with one click with cPanel’s own tool

Automatic for new domains

Optional: no need to repeat the setup for new domains.

  • SPF and DKIM are applied when an account or domain is added
  • Automatic import and MX option for inbound filtering

Inbound spam filter

MX records are switched to MXGate with one click; mail is scanned first, then delivered to your server.

  • “Dry run” preview without changing anything
  • “Undo” restores the old MX record exactly
  • Domains hosted elsewhere need separate confirmation; unproven ownership goes to the organisation administrator for approval

Safe updates

New releases are announced on the plugin page.

  • One-click update
  • Signed packages; never installed unless the signature verifies

Everyday management

Interface in Turkish (default) and English.

  • Suspended accounts are skipped and reported by name
  • Removable from the panel; the smarthost is switched off first
Once you have the service, the plugin is downloaded from the Setup Guide in the MXGate management panel and installed on the server with a single command.
WHAT CHANGES

The only thing that changes is the path out

Today your cPanel server delivers email straight to the recipient’s server, and whether it arrives is decided by the reputation of your server’s IP address alone. After setup, the same message is handed to MXGate first, inspected there, and sent on from continuously monitored addresses.

Now cPanel / Exim Recipient server Mail leaves directly. Whether it is delivered depends only on the reputation of your server’s IP address.
After setup cPanel / Exim 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, accounts and website settings stay where they are How your applications send mail does not change Inbound mail is redirected separately via the MX record; this guide does not cover it For an overview of the method, see the smarthost service page, and for inspection on outbound traffic Outbound Filtering
SETUP

cPanel smarthost setup in seven steps

Without the plugin, the setup is done by hand as follows. The steps are applied in order in the WHM interface. You can copy the code blocks as they are; only the username and password placeholders in step five need to be replaced.

  1. Open Exim Configuration Manager in WHM

    Log in to WHM as the root user and type “Exim” in the search box at the top to open Exim Configuration Manager.

    WHM PATH copy
    Home › Service Configuration › Exim Configuration Manager
  2. Switch to the Advanced Editor tab and take a backup

    The Advanced Editor tab lets you edit the sections of the Exim configuration directly. Before making any change, take a backup of the current configuration with the Backup button on the page.

    Survives updates: anything you add in the Advanced Editor is stored in /etc/exim.conf.local and is preserved across cPanel updates. The main /etc/exim.conf file is regenerated on every build, so never edit it by hand.
  3. ROUTERCONFIG: add the routing rule

    Add the router definition below to the ROUTERCONFIG section. It routes all mail that is not addressed to a local domain through MXGate.

    ROUTERCONFIG copy
    # MXGate smarthost router
    smarthost_router:
      driver = manualroute
      domains = ! +local_domains
      transport = mxgate_smtp
      route_list = * smtp.mxgate.com.tr::587
      no_more
    The domains = ! +local_domains line keeps mail between accounts on the server local instead of sending it out. Do not remove it.
  4. TRANSPORTCONFIG: add the transport definition

    Add the transport definition, including the authentication and TLS requirements, to the TRANSPORTCONFIG section.

    TRANSPORTCONFIG copy
    # MXGate SMTP transport
    mxgate_smtp:
      driver = smtp
      hosts = smtp.mxgate.com.tr
      port = 587
      hosts_require_auth = smtp.mxgate.com.tr
      hosts_require_tls = smtp.mxgate.com.tr
    Port 587 is used with STARTTLS, so credentials and message content travel encrypted. The hosts_require_tls line prevents falling back to an unencrypted connection.
  5. AUTH: enter the authentication credentials

    Add the client authenticator containing the username and password from your MXGate panel to the AUTH section.

    AUTH copy
    # MXGate SMTP authentication
    smarthost_login:
      driver = plaintext
      public_name = LOGIN
      client_send = : MXGATE_KULLANICI_ADI : MXGATE_SIFRE
    Careful: the client_send line must start with a colon: : username : password. Replace the placeholders with the real credentials from your panel, and do not wrap the password in quotes.
  6. Save and restart Exim

    Click the Save button at the bottom of the page. WHM validates the configuration, rebuilds it and restarts Exim. You can run the same checks over SSH if you prefer.

    SSH · VERIFY copy
    # Any syntax errors in the configuration?
    exim -bV
    
    # Rebuild and restart the service if needed
    /scripts/buildeximconf
    /scripts/restartsrv_exim
  7. Send a message and read the log

    Send a message from an account on the server to an external address and confirm in the Exim log that it left through MXGate. If you see the router name in the log, the setup is working.

    TEST · LOG copy
    # Watch the queue and the live log
    exim -bp
    tail -f /var/log/exim_mainlog
    
    # The line you should see in the log
    => kullanici@ornek.com R=smarthost_router T=mxgate_smtp
    Setup complete. Once you see this line, all mail leaving the server is going through MXGate, authenticated and encrypted.
TROUBLESHOOTING

What does the error in your Exim log mean?

The five rows below cover almost every error seen after a cPanel smarthost setup. Look for the text from your log in the left column.

Error in the log What it means Fix
535 Authentication failed The username or password was not accepted Check that the client_send line in the AUTH section starts with a colon, and copy the credentials from the panel again. There must be no quotes or spaces in the password.
Connection refused / timed out Outbound access to port 587 is blocked Allow outbound port 587 in the server firewall and on your provider’s network. Some hosting networks close this port by default.
TLS required but not supported An encrypted connection could not be established Confirm that the hosts_require_tls line is present in the TRANSPORTCONFIG section and that the OpenSSL packages on the server are up to date.
Mail stays local The router is not being read, or the order is wrong Check that the smarthost_router definition was added to the ROUTERCONFIG section and that the indentation is two spaces. Exim silently skips a definition with bad indentation.
Mail between accounts also goes out The domains condition is missing Confirm that the domains = ! +local_domains line is present in the router. Without it, mail between accounts on the server is routed outside as well.

Rolling back

If you want to undo the setup, remove the three sections you added in the Advanced Editor and save. Restoring the backup has the same effect: once the configuration is rebuilt, the server goes back to sending mail directly as before.

SSH · ROLLBACK optional
# Back up the local configuration, then edit it
cp /etc/exim.conf.local /etc/exim.conf.local.mxgate-bak

# Rebuild the configuration and restart the service
/scripts/buildeximconf
/scripts/restartsrv_exim
FAQ

Questions from server administrators

Does this setup affect incoming email?

No. The configuration only changes the path that mail leaving the server takes. Your MX records, mailboxes and inbound settings stay exactly as they are. Putting inbound traffic through MXGate as well is a separate step, made through the MX record.

Will a cPanel update wipe these settings?

No. The sections you enter in the Advanced Editor are stored in /etc/exim.conf.local and are preserved across updates. The file that gets replaced is /etc/exim.conf, which is regenerated on every build, which is why the configuration should never be written there by hand.

Do we need separate credentials for each account on the server?

No. One set of credentials at server level is enough, and mail from every account leaves over the same connection. Reporting in the panel is still broken down by domain and sender, so you can still see which account sent what.

Is there a mail outage while saving?

There is a pause of a few seconds while Exim restarts. Incoming connections are retried during that window and queued messages are not lost. Even so, it is best to make the change outside peak sending hours.

Can we roll the setup back?

Yes. Remove the three sections you added in the Advanced Editor and save, or restore the backup you took before setup. Once the configuration is rebuilt, the server goes back to sending mail directly as before.

Can we use the cPanel/WHM plugin instead of configuring by hand?

Yes. The MXGate cPanel/WHM plugin performs the same smarthost setup from WHM → Plugins → MXGate: it tests the connection before saving, backs up the Exim settings when switching on and rolls back a faulty setting automatically. SPF, DKIM and the optional inbound spam filter are managed from the same screen. Once you have the service, the plugin is downloaded from the Setup Guide in the MXGate management panel and installed with a single command.

Last updated: · Applies to: cPanel 92 and above · Exim 4.94+