Source: https://help.ubuntu.com/community/EmailAlerts
Install the ssmtp package
sudo apt-get install ssmtp
Edit the configuration file. The lines without the # are the ones we are interested in.
sudo nano /etc/ssmtp/ssmtp.conf
Adjust and add as necessary to match the following parameters
Change "MyEmailAddress" and "MyPassword" to your own.
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster
[email protected]
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587
[email protected]
AuthPass=MyPassword
UseTLS=YES
UseSTARTTLS=YES
# Where will the mail seem to come from?
#rewriteDomain=
rewriteDomain=gmail.com
# The full hostname
#hostname=MyMediaServer.home
hostname=MyMediaServer.home
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
Lets test that our ssmtp setup was correct by sending an Email
echo "Test message from Linux server using ssmtp" | sudo ssmtp -vvv [email protected]