Italiano English
Modifica History Actions

PostfixGmail

Configure Postfix to relay mails with your Gmail account

1) Install postfix, postfix-tls,libsasl2 ,libsasl2-modules ,sasl2-bin

2) In /etc/postfix/main.cf add:

myhostname = tuscolo
mydomain = ninux.org
mynetworks = 127.0.0.0/8 192.168.0.0/16 10.0.0.0/8 172.16.0.0/16
inet_interfaces = all
mydestination = localhost.localdomain, localhost.localdomain, localhost
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_sasl_tls_security_options = noanonymous
tls_random_source = dev:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_enforce_peername = no
smtp_tls_per_site = hash:/etc/postfix/usar_tls

3) Create the file /etc/postfix/sasl_passwd :

smtp.gmail.com user@gmail.com:password

4) Create the file /etc/postfix/usar_tls :

smtp.gmail.com MUST_NOPEERMATCH

5) Go to /etc/postfix as root and run:

postmap sasl_passwd
postmap usar_tls

This will create sasl_passwd.db and usar_tls.db. MUST BE IN /ETC/POSTFIX!

6) Restart postfix : /etc/init.d/postfix restart

WARNING: all sent emails will be also copied in the "Sent" Folder of your gmail account!