cPanel / WHM

cPanel/WHM Smarthost Configuration

Authenticated smarthost setup with Exim Configuration Manager

Back to Documentation

What does this guide do?

Ensures all emails sent from your cPanel/WHM server are delivered through the MXGate smarthost (with authentication). This puts your outbound emails under MXGate protection.

Prerequisites

  • WHM root access
  • SMTP username and password created from MXGate panel
  • cPanel version 92+ (Exim 4.94+ recommended)

1 Access Exim Configuration Manager in WHM

Log in to WHM panel as root user and search for "Exim" to find Exim Configuration Manager.

# WHM Yolu:
Home > Service Configuration > Exim Configuration Manager

2 Switch to Advanced Editor Tab

On the opened page, click Advanced Editor tab from the top menu. You can directly edit the Exim configuration file in this section.

Important: Use the "Backup" button to backup current settings before starting configuration.

3 Section: ROUTERCONFIG - Smarthost Router

Add the following configuration in the ROUTERCONFIG section. This ensures all outgoing mail goes through MXGate:

# MXGate Smarthost Router
smarthost_router:
driver = manualroute
domains = ! +local_domains
transport = mxgate_smtp
route_list = * smtp.mxgate.com.tr::587
no_more

4 Section: TRANSPORTCONFIG - Transport Configuration

Add the transport definition containing SMTP authentication settings in the TRANSPORTCONFIG section:

# MXGate SMTP Transport with Authentication
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 TLS encryption. All credentials are transmitted encrypted.

5 Section: AUTH - SMTP Authentication

Add MXGate SMTP authentication settings in the AUTH section. Use the username and password obtained from the MXGate panel:

# MXGate SMTP Authentication
smarthost_login:
driver = plaintext
public_name = LOGIN
client_send = : MXGATE_KULLANICI_ADI : MXGATE_SIFRE

Security: Replace MXGATE_USERNAME and MXGATE_PASSWORD with actual credentials from MXGate panel.

Format: client_send = : username : password - Note it must start with a colon (:).

6 Save Configuration and Restart Exim

After making all changes, click the Save button at the bottom of the page. WHM will automatically validate and restart the Exim configuration.

# SSH üzerinden Exim yapılandırmasını test edin:
exim -bV
# Syntax hatası olup olmadığını kontrol edin:
exim -C /etc/exim.conf -bV
# Exim servisini yeniden başlatın (gerekirse):
/scripts/restartsrv_exim

7 Testing and Verification

Test if the configuration is working. Send an email and check the Exim logs:

# E-posta kuyruğunu kontrol edin:
exim -bp
# Exim loglarını izleyin:
tail -f /var/log/exim_mainlog
# Başarılı bağlantı görmelisiniz:
"smtp.mxgate.com.tr [IP]:587 connected"
"=> kullanici@domain.com R=smarthost_router"
# SMTP kimlik doğrulama testi:
exim -d -Mvl <message-id>

Success! All your outgoing emails are now delivered encrypted and authenticated through MXGate.

Troubleshooting

535 Error:

Check your authentication credentials. Make sure the username and password are correct in the MXGate panel. Ensure colons (:) are correctly placed in AUTH section.

Connection refused:

Check firewall settings. Ensure outbound access to port 587 is allowed.

TLS required:

Ensure hosts_require_tls is in the transport section, or remove the TLS requirement.

Router not found:

Ensure smarthost_router definition is added to ROUTERCONFIG section. Check for indentation errors.