Skip to content

Instantly share code, notes, and snippets.

@soifou
Last active November 29, 2017 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soifou/d418fee52dcff9963d4c to your computer and use it in GitHub Desktop.
Save soifou/d418fee52dcff9963d4c to your computer and use it in GitHub Desktop.
Install Mandrill with Postfix

Postfix / Mandrill

Installation

# apt-get install postfix

Configuration sasl

# vim /etc/postfix/sasl_passwd
    [smtp.mandrillapp.com] user@email.com:XXXXXXXXXXXXX
# chmod 600 /etc/postfix/sasl_passwd
# postmap /etc/postfix/sasl_passwd

Configuration postfix /etc/postfix/main.cf

# TLS parameters
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_use_tls=yes
#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# enable SASL authentication
smtp_sasl_auth_enable = yes
# tell Postfix where the credentials are stored
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 
smtp_sasl_security_options = noanonymous
# use STARTTLS for encryption
#smtp_use_tls = yes

# Mandrill
relayhost = [smtp.mandrillapp.com]

Hostname check

Check that all domain are correctly being set:

cat /etc/hostname
    HOSTNAME
cat /etc/mailname
    HOSTNAME.localdomain
cat /etc/postfix/main.cf | grep mydest
    HOSTNAME.localdomain, localhost.localdomain, localhost

Reload postfix

# service postfix reload

Log

Watch log here: /var/log/mail.log

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment