SSMTP is a very simple SMTP mail program which is used to send e-mails to a target server. It’s not a fully feature e-mail server but simply passes e-mails on. I first became acquainted with it because it’s the only mail server you can install on Citrix Xenserver. I now use it with all my servers because it’s very easy to configure.
Simply install it via command line:
sudo apt-get install ssmtp
There is only one config file to worry about: /etc/ssmtp/ssmtp.conf. To configure it to use an SSL connection (for gmail or if, like me, your ISP blocks port 25), add the following options, changing the brackets with your mailserver, username, and password.
mailhub=<mailserver>:587 UseSTARTTLS=YES AuthUser=<username> AuthPass=<password> AuthMethod=DIGEST-MD5
If you just pasted the above config into your ssmtp.conf be sure to check the resulting config file for duplicate entries.
It’s as simple as that. All outgoing mail will be sent to the server specified above.