SETUP for sending Mail via postfix to GMAIL

My knowledge of mail delivery systems is near ZERO I have stand alone PC running UBUNTU 12.04 (no other OP systems) I am developing a web system with PHP and want to send an email to users that have registered. I have installed POSTFIX and set it up to work with GMAIL (I hope correctly) My little test program appears to send the email but it does not arrive at destination. Is there some special code for SMTP or something else needed to install? Please can you give me step by step instructions of what must be installed.

Simple explanations will be appreciated so I know why and for what I am doing these things. This is my test program which shows OK Thanks


You can use the package ssmtp to send emails. I am using this package to send me reports of my daily backups.

To install:

sudo apt-get install ssmtp

You will need to edit the files /etc/ssmtp/ssmtp.conf and /etc/ssmtp/revaliases to use your email account.

To test if it works, try to send yourself an email:

ssmtp <your email address>

Then type your message, press enter, and finally press ctrl+d.

For detailed instructions on setting up ssmtp, check out this article.