Configure Postfix to use Gmail as a Mail Relay
In this tutorial, I setup and Configure Postfix to use Gmail as a Mail Relay with 587 port.
- OS: Centos
- User: root
yum install postfix mailx cyrus-sasl cyrus-sasl-plainTo configure postfix to use Gmail as a Mail Relay
vi /etc/postfix/main.cfAdd or modify the following as below:
#To use smpt gmail with 587 portTo configure Gmail authentication
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_security_level = encrypt
# Location of CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
vi /etc/postfix/sasl_passwdAdd the line as below:
[smtp.gmail.com]:587 username@gmail.com:passwordRunning commands as below:
chmod 600 /etc/postfix/sasl_passwdTo restart postfix service
chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
postmap /etc/postfix/sasl_passwd
service postfix startTest send a email
echo "Test Mail" | mailx -v -r "AccountEmail@gmail.com" -s "Test Mail 01" anotherAcount@gmail.com
Comments
Post a Comment