To use SMTP through PostMarkApp on a Google Cloud Engine the default configuration on PostMarkApps docs won’t be sufficient to get everything configured correctly due to google blocking some SMTP ports and the docs not explaining all of the necessary configuration.
You can view PostMarkApp’s docs on the subject here: http://support.postmarkapp.com/customer/portal/articles/64738-can-i-configure-postfix-to-send-through-postmark-
##1. Required Dependencies (From PostMarkApp’s Docs)
IMPORTANT: Make sure you have SASL authentication package installed first. It can be installed using apt-get install libsasl2-modules or yum install cyrus-sasl-plain. If not, you will see authentication errors like “SASL authentication failed; no mechanism available”.
2. Update Postfix config
Access the postfix main config here:
sudo vim /etc/postfix/main.cf
Add the following at the bottom of the config file.
#start postmarkapps settings smtp_sasl_auth_enable = yes smtp_sasl_password_maps = static:secret:secret (where "secret is your API token") smtp_sasl_security_options = noanonymous smtp_tls_security_level = may smtp_tls_loglevel = 1 relayhost = [smtp.postmarkapp.com]:2525 ##end postmarkapp settings
Note To use with GCE you need to use port 2525 even through PostMarkApp also allows the use of port 25 or 587. Also be sure to replace ‘secret’ with the api token on either side of the ‘:’.
3. Update Duplicate Entries
Ensure there is only one relayhost config on the main.cf file. The default implementation has the following which needs to be removed or commented out.
4. Update Hostname
The service won’t work unless you update the ‘myhostname’ config to reflect your current host.
5. Restart Postfix
Once all of the configs have been set, restart postfix using the following command.
sudo /etc/init.d/postfix restart
6. You’re Done!
Test by sending an email and confiming it goes through the PostMarkApp portal.