Required Packages Luckily, installing this on Debian/Ubuntu is dead simple. bash
apt-get install ssmtp
Then, you'll need to edit your ssmtp.conf file.
nano /etc/ssmtp/ssmtp.conf
and paste something like this in.
root=username@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=username@gmail.com
UseSTARTTLS=YES
AuthUser=username
AuthPass=password
FromLineOverride=YES
Press crtl+x, and then y to save and exit.
Then add each account that you want to be able to send mail from by editing, bash
nano /etc/ssmtp/revaliases
and paste...
root:username@gmail.com:smtp.gmail.com:587
youruser:username@gmail.com:smtp.gmail.com:587
Just replace youruser with your Ubuntu username and username@gmail.com with your gmail address.
Resources:
http://zackreed.me/articles/39-send-system-email-with-gmail-and-ssmtp