Postfix :: Relay Email to Google Apps / Gmail

40 sec read

:: What’s Postfix
Postfix is free and open source mail transfer agent.

 
:: How to setup Postfix relay email to Google Apps / Gmail in CentOS 6.3
+ Setup main.cf to relay email

vi /etc/postfix/main.cf

add some configure like these:

relayhost = [smtp.gmail.com]:587

smtp_sasl_auth_enable=yes
smtp_sasl_password_maps = hash:/etc/postfix/gmail
smtp_sasl_security_options =
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = login

smtp_tls_eccert_file =
smtp_tls_eckey_file =
smtp_use_tls = yes
smtp_enforce_tls = no
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom

 
+ Setup Google Apps / Gmail Login

vi /etc/postfix/gmail

add line like this:

smtp.gmail.com [email protected]:password

 
+ Create Postfix db file for gmail login

postmap /etc/postfix/gmail

 
+ set CAfile

cp /etc/pki/tls/certs/ca-bundle.crt /etc/postfix/cacert.pem

 
+ Restarting Postix

/etc/init.d/postfix restart

 
+ Testing send an email

echo 'hello' | mailx -s 'ignore me' [email protected]

 
:: Links
+ Google
+ Carlosgomez

Leave a Reply

Your email address will not be published. Required fields are marked *