I wanted to setup my workstation’s e-mail to relay through the new e-mail server I setup. To do this I would need to setup my workstation’s Postfix SMTP client to use the mail server as a relayhost (Postfix lingo) a.k.a. a smarthost.
My e-mail server requires plaintext authentication and TLS (self-signed certificate). This is very important because by default Postfix does not try plaintext authentication or TLS.
My workstation’s /etc/postfix/main.cf looks like this:
smtp_tls_security_level = encrypt # Encryption only because cert is self-signed
relayhost = mail.tremont702.us
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_security_options = noanonymous
Then create the /etc/postfix/smtp_sasl_passwd which will hold your e-mail username and password:
Make sure your password file is only readable by root, and run postmap /etc/postfix/smtp_sasl_passwd to create the hash index/database file.
Reload Postfix using sudo postfix reload and all e-mails sent from your workstation will be relayed through your e-mail server!
Update:Â Don’t forget to install the libsasl2-modules package (for Debian at least)!