Qmail is a modular application so each configuration setting is kept in a single file. Typically the smarthost relay definitions are stored in /var/qmail/control/smtproutes.
Qmail does not provide out-of-the-box support for SSL secured connections. There are various patches which provide this capability but none work across all systems. The configuration provided below makes use of stunnel to secure the connection. stunnel works on most UNIX-like operating systems is easy to install and configure.
Note: Most newer versions of Qmail have support for the SMTP AUTH command which is required for relaying via Easy-SMTP. If your version does not support SMTP AUTH you may either update Qmail to a newer release or you can configure your Easy-SMTP account to use IP-based authentication.
Begin by installing stunnel using your system package manager or by using the source code from htt://www.stunnel.org. The following examples are for a CentOS system, your file paths may vary.
# yum install stunnel.x86_64 |
Add the following to /etc/stunnel/stunnel.conf
client=yes [smtps] accept = 2525 connect = ssrs.reachmail.net:465 |
Enable stunnel in rc.local
# echo "/usr/sbin/stunnel /etc/stunnel/stunnel.conf" >> /etc/rc.d/rc.local |
Start stunnel
# /usr/sbin/stunnel /etc/stunnel/stunnel.conf |
Add the following entries to the /var/qmail/control/smtproutes. Note that if you want to control which destinations are routed through Easy-SMTP you can add additional definitions to this file.
# echo ":localhost:2525 accountid\user password" >> /var/qmail/control/smtproutes # echo "ssrs.reachmail.net accountid\username password" >> /var/qmail/control/smtproutes #### Example for selective routing # echo "some-domain.tld:localhost:2525 accountid\user password" >> /var/qmail/control/smtproutes
Restart qmail
qmailctl stop qmailctl start