Skip to content

Postfix

This article explains how to use Sendamatic as an outbound relay, or smarthost, for Postfix.

Create the credential files

Add the following line to /etc/postfix/sasl_passwd

/etc/postfix/sasl_passwd
[in.smtp.sendamatic.net]:587 <credential ID>:<credential password>

Create the postfix hashmap

sudo postmap hash:/etc/postfix/sasl_passwd

Secure the credential files

sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db

Configure Postfix

sudo postconf -e "relayhost = [in.smtp.sendamatic.net]:587" \
"smtp_sasl_auth_enable = yes" \
"smtp_sasl_security_options = noanonymous" \
"smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" \
"smtp_use_tls = yes" \
"smtp_tls_security_level = secure" \
"smtp_tls_note_starttls_offer = yes"

CA certificates

Postfix needs to be able to verify the Sendamatic SSL certificate. The location of your CA root certificates depends on the distribution you're using.

# Debian / Ubuntu
sudo postconf -e "smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt"

# Redhat / CentOS
sudo postconf -e "smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt"

Finally, reload the Postfix configuration

sudo postfix reload

You may also like