To configure ElasticEmail with postfix, first install sasl support
On Debian/Ubuntu
apt-get install libsasl2-modules
On RHEL/CentOS
yum install cyrus-sasl-plain
Edit postfix config
vi /etc/postfix/main.cf
On Ubuntu/Debian, you need to comment the line starting with “relayhost”.
Add following
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_tls_security_level = encrypt header_size_limit = 4096000 relayhost = [smtp.elasticemail.com]:587
Now create file
/etc/postfix/sasl_passwd
Add following content
[smtp.elasticemail.com]:587 YOUR_SMTP_USER:YOUR_SMTP_PASSWORD
You can find your SMTP user name and password from
https://elasticemail.com/account/#/settings/apiconfiguration
Now run
chmod 600 /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd
Restart postfix with
systemctl restart postfix
Postfix will relay mails using postfix now.
See postfix