Set up SMTP relay with DirectAdmin

Estimated reading time: 1 min

Introduction

If you want or need to setup your mailserver to send all outgoing mail to a specific server which will handle the delivery to the recipients you need to setup a SMTP relay or smarthost.

Prerequisites

  • You need to know the hostname of the SMTP server which is going to relay the mail for your mailserver, which is smtprelay.snel.com in our case
  • This article assumes that no authentication is necessary on the SMTP relay server
  • This article is written for DirectAdmin with Exim
  • You need to be running exim.conf 4.5.7 or newer, please see this article if you need to update
  • You need to have the SSH login details of your server ready

Step 1: Log in with SSH

Log in as root. Please see this article for instructions if you don’t know how to connect.

Step 2: Configure the MTA

Copy/paste complete command:

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 mailserver

Restart the mailserver by issuing the following command:

service exim restart

Conclusion

Congratulations, you have successfully setup SMTP relay / smarthost with DirectAdmin.

Was this article helpful?
Dislike 1
Views: 5257

Reader Interactions

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *