Postfix, smarthost with SMTP AUTH
From Ubuntuwiki.net
1. make sure libsasl2-modules is installed:
you@box:~$ sudo apt-get install libsasl2-modules
2. Create password maps file (it assigns username/passwords to specified mail servers). You can choose any name, let's say it is /etc/postfix/smarthost_passwd. It's content should be as follows:
hostname.tld USERNAME:PASSWORD
Note: Replace USERNAME and PASSWORD with your mailbox username and password.
3. Set proper permissions for that file:
you@box:~$ chown root:root /etc/postfix/smarthost_passwd you@box:~$ chmod 600 /etc/postfix/smarthost_passwd
4. Create hash from maps file (remember to do it each time you change your maps file):
you@box:~$ postmap /etc/postfix/smarthost_passwd
5. Configure your /etc/postfix/main.cf:
relayhost = [hostname.tld] smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd smtp_sasl_security_options = smtp_use_tls = yes
Note: If your ISP blocks outgoing port 25, you can choose to use alternative SMTP ports by appending the port at the end:
relayhost = [hostname.tld]:587
6. Reload or restart your postfix:
you@box:~$ /etc/init.d/postfix restart