Can’t Send Outgoing Mail (Virtualmin + Postfix)

After a recent operating system update on my Virtualmin server, outgoing emails (accounts, forwarding, system generated) stopped working. Connections to the SMTP server worked fine, authentication had no issues, and mail could be sent locally to domains on the same server.

But when trying to mail to on external address (Gmail for example), the mail client and mail logs showed an error: “Relay access denied”. It took quite a while to discover the offending settings so I thought I’d share what worked for me (finally) here.

Postfix_logo

Near the end of the /etc/postfix/main.cf you should ensure the settings are as follows:

smtpd_sasl_auth_enable = yes
#smtp_sasl_auth_enable = yes

Where ‘smtp_sasl_auth_enable” is commented out. After making this change I was again able to send mail to external domains.

Make sure you test your setup to a few different mail providers though. The update enabled IPv6 for my Postfix server, and because I don’t have reverse DNS for IPv6 enabled on my server Gmail rejected all mail. You might also wish setup reverse DNS for IPv6, or make the following change so that only IPv4 is used:

inet_protocols = ipv4