Skip to content

Instantly share code, notes, and snippets.

@iamdylanngo
Last active March 19, 2020 01:07
Show Gist options
  • Save iamdylanngo/fe9dbe0865b9cde1df899c864b70bfd3 to your computer and use it in GitHub Desktop.
Save iamdylanngo/fe9dbe0865b9cde1df899c864b70bfd3 to your computer and use it in GitHub Desktop.
centos7-postfix-relay-gmail
# Guide setup postfix, mail relays on centos 7
## Install postfix
sudo yum install postfix
sudo vim /etc/postfix/main.cf
/*add to bottom*/
myhostname = relay.example.com
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
## Configuration sasl_passwd
sudo vim /etc/postfix/sasl_passwd
/*add line*/
[smtp.gmail.com]:587 <gmail-user>:<gmail-password>
sudo chown root:postfix /etc/postfix/sasl_passwd
sudo chmod 640 /etc/postfix/sasl_passwd
sudo getenforce && sudo getenforce 0
# Start postfix service
sudo systemctl start postfix
# Check log postfix
yum install postfix-pflogsumm
pflogsumm /var/log/maillog
# Reconfig
sudo dpkg-reconfigure postfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment