Smart Host setup with SMTP Authentication on Postfix
This document describes 5 easy steps to setup your Postfix email server as smarthost to relay through DNS Exit mail relay server for all email sending.
The mail relay service from DNSExit.com can be found here
1. Create password maps file
The file specifies username/passwords to specified mail relay servers.
You can name the file any name, let's say it is /etc/postfix/relay_passwd.
It's content should be as follows:
Note: Replace USERNAME and PASSWORD with your DNS EXIT mail relay username and PASSWORD.
2. Set proper permissions for that file:
# chown root:root /etc/postfix/relay_passwd
# chmod 600 /etc/postfix/relay_passwd
3. Create hash from maps file (remember to do it each time you change your maps file):
# postmap /etc/postfix/relay_passwd
4. Configure your /etc/postfix/main.cf:
relayhost = [relay.dnsexit.com]
smtp_fallback_relay = [relaybackup.dnsexit.com]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
Note: If your ISP blocks outgoing port 25. You can choose to use alternative SMTP ports by appending the port at the end:
relayhost = [relay.dnsexit.com]:26
5. Reload or restart your postfix:
# /etc/init.d/postfix restart
Other notes about postfix:
If the above settings don't work, you need to make sure the SASL support (smtp authentication) is compiled into Postfix. To do so, you may need to upgrade to latest version of Postfix.