Learn how to set up a DirectAdmin smarthost using Exim to relay outgoing mail via an external SMTP server. Our DirectAdmin Support Team is always here to help you.
How to Set Up a DirectAdmin Smarthost with Exim
Setting up a DirectAdmin smarthost is a common need when you want all outgoing email from your server to be routed through an external SMTP relay. This can help with deliverability and centralize mail handling. In this guide, we’ll show you exactly how to configure a smart host on a DirectAdmin server running Exim. No guesswork, just straight, working steps.
We’ll assume you’re using a DirectAdmin server with Exim and you have SSH access. Make sure your Exim version is 4.5.7 or newer. You’ll also need the hostname of the SMTP relay server. In this example, we’ll use smtprelay.snel.com.
Let’s get started.
An Overview
Step 1: Log in via SSH
Use your terminal and log in as root to your DirectAdmin server:
ssh root@your-server-ip
Step 2: Configure the MTA (Mail Transfer Agent)
Run the following command to create the router config file for the smart host. This configuration tells Exim to send all non-local outgoing mail to the relay server:
cat <<'EOF' > /etc/exim.routers.pre.conf
smart_route:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = remote_smtp
route_list = !+local_domains smtprelay.snel.com::587
no_more
EOF
Step 3: Restart the Mail Server
To apply the new configuration, restart Exim:
service exim restart
Alternative Method Using a Custom Smarthost Route
If you prefer or need to use another SMTP relay like Comodo’s Spam Gateway, here’s another working method. This is especially useful if you’re in the EU or US region and want to route through their respective mail pools.
Step 1: Edit the Exim Configuration File
Open the main config file, usually located at /etc/exim.conf. Then in the routers section (after begin routers), add:
spamgateway_smarthost_router:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = spamgateway_smarthost_transport
route_list = $domain mxpool1.spamgateway.comodo.com::587 (for EU based CSEG server)
or $domain mxpool1.us.spamgateway.comodo.com::587 (for US based CSEG server) no_more
Important: Make sure to comment out the default lookuphost: router if it’s there.
Step 2: Add a Transport Section
After begin transports, include:
spamgateway_smarthost_transport:
driver = smtp
hosts_require_tls = *
Step 3: Restart Exim Again
As always, changes don’t apply until you restart Exim:
service exim restart
[If needed, Our team is available 24/7 for additional assistance.]
Conclusion
Using a DirectAdmin smarthost setup like this ensures all outgoing mail is filtered through a known relay, improving delivery success rates and reducing server overhead. Regardless of whether you’re using smtprelay.snel.com or a specialized service like Comodo’s gateway, this configuration keeps your system straightforward and clean. hostname
For any DirectAdmin smarthost configuration, always verify the destination SMTP details and test your mail sending afterward. Keep a close eye on your logs during the first few hours to make sure nothing’s getting blocked or rejected.
0 Comments