Configure a Postfix Relay through Gmail on CentOS

[root@fs ~]# yum -y install postfix cyrus-sasl-plain mailx
[root@fs ~]# ee /etc/postfix/main.cf
####### RELAY GMAIL ######
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

[root@fs ~]# ee /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 bots@naitinoi.com:sana2455xxxx

[root@fs ~]# postmap /etc/postfix/sasl_passwd
[root@fs ~]# chown root:postfix /etc/postfix/sasl_passwd*
[root@fs ~]# chmod 640 /etc/postfix/sasl_passwd*
[root@fs ~]# service postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
[root@fs ~]# echo “This is a test.” | mail -s “test message” mail@some.co.th

[root@fs ~]# ee /etc/aliases
root: testuser@naitinoi.com
[root@fs ~]# newaliases

Comments are closed.