Sending emails from gmail account using PHP mail() function. Tested on Ubuntu 10.04.
$ sudo apt-get install postfix libsasl2-2 ca-certificates libsasl2-modules
vim /etc/postfix/main.cf:
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_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
Need to perform clean up after adding the line above (remove useless lines).