It turns out if you want to configure Zimbra to use an external SMTP relay service it can be a bit of a headache if that service doesn’t use port 25 or 587 to receive encrypted relay mail. Such is the case with AnyMXRelay. I decided to use AnyMXRelay to relay my mail since my Linode box keeps getting put on weird shadow blocklists despite mxtoolbox saying everything was fine.
It took some digging but I finally found this article on Zimbra’s wiki outlining what needs to happen. There are a few manual settings that need to be put in place on the command line in order to get this to work – namely, smtp_tls_wrappermode and smtp_tls_security_level.
In addition to the steps taken in this how-to for sending mail through a relay, you must also make these changes:
postconf -e smtp_tls_wrappermode=yes # No Zimbra setting for smtp_tls_wrappermode yet
zmprov ms `zmhostname` zimbraMtaSmtpTlsSecurityLevel encrypt
zmprov ms `zmhostname` zimbraMtaSmtpTlsCAfile /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt
zmprov ms `zmhostname` zimbraMtaSmtpSaslSecurityOptions noanonymous
zmprov ms `zmhostname` zimbraMtaSmtpSaslAuthEnable yes
zmprov ms `zmhostname` zimbraMtaSmtpSaslPasswordMaps lmdb:/opt/zimbra/conf/relay_password
Zimbra 8.5+ periodically applies settings automatically, so once you’ve made these changes, watch /var/log/zimbra.log for these lines
zmconfigd: Fetching All configs
zmconfigd: All configs fetched in 0.07 seconds
zmconfigd: All restarts completed in 1.80 sec
Once you see them, you can send some test mail. Tail
/var/log/zimbra.log to see if it worked or to see any error messages.
If you get these error messages:
HANGUP after 0.08 from [IP]:56518 in tests before SMTP handshake
status=deferred (Cannot start TLS: handshake failure)
It means you must also add two configuration lines to the amavis configuration file in
So the complete section looks like this:
smtp-amavis unix - - n - %%zimbraAmavisMaxServers%% smtp
Once you made the changes, save the file and restart all zimbra services with
The above disables TLS security for the antivirus piece. This could cause security issues if you Zimbra configuration is distributed to multiple hosts. In my case, this is an all-in-one server, so it does not matter.
Once I made the above changes, mail flowed through my external SMTP server successfully!