- Install postfix:
apt-get install postfix libsasl2-2 ca-certificates libsasl2-modules
- SMTP relay host: smtp.gmail.com:587
- Configure postfix by editing /etc/postfix/main.cf:
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
- Create /etc/postfix/sasl_passwd file, which contains the gmail user name and password in the following format:
smtp.gmail.com:587 username@gmail.com:password
- Generate /etc/postfix/sasl_passwd.db file using postmap:
sudo postmap /etc/postfix/sasl_passwd
- Secure the files by setting file permissions:
sudo chmod 400 /etc/postfix/sasl_passwd*
- Set up CA certificate for postfix:
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
- Reload postfix:
/etc/init.d/postfix reload
No comments:
Post a Comment