Use GMail to Send E-mails on your Linux Box via CLI

It's remarkably easy. First off uninstall sendmail, because we're going to be replacing it with another binary.

/etc/init.d/sendmail stop
yum remove sendmail

Now we'll install ssmtp.

yum install ssmtp

To configure ssmtp replace the contents of /etc/ssmtp/ssmtp.conf with:

# or your personal domain's if you use GMail for it
root=YOUR-EMAIL@gmail.com
mailhub=smtp.gmail.com:465
rewriteDomain=gmail.com
# use @yourdomain.com if you use GMail for your domain's e-mail, otherwise skip @gmail.com
AuthUser=YOUR-GMAIL-USERNAME 
AuthPass=YOUR-GMAIL-PASSWORD
FromLineOverride=YES
UseTLS=YES