Title

Type the following command under Debian / Ubuntu Linux:

sudo apt-get install ssmtp

Configure mailserver as a smarthost

sudo nano /etc/ssmtp/ssmtp.conf
AuthUser=@gmail.com
AuthPass=Your-Gmail-Password
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

Also, make sure you disable Sendmail:

service sendmail stop
chkconfig sendmail off
mkdir /root/.bakup
mv /usr/sbin/sendmail /root/.bakup
ln -s /usr/local/ssmtp/sbin/ssmtp /usr/sbin/sendmail