SSMTP
SSMTP is a program which delivers email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.
Installation
sudo apt-get update
sudo apt-get install ssmtp
Configuration
Configuration file path:
/etc/ssmtp/ssmtp.conf
# 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
[email protected]
# 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 - See more at: http://www.havetheknowhow.com/Configure-the-server/Install-ssmtp.html#sthash.zv2xEvMZ.dpuf
How to test SSMTP configuration
Once you've configured sSMTP it's time to try and send an email. The simplest way to do this is to run sSMTP in a terminal with a recipient email address.
ssmtp [email protected]
sSMTP will then wait for you to type your message, which needs to be formatted like this:
To: [email protected]
From: [email protected]
Subject: test email
Hello World!