Install sSMTP and setup with Gmail on Ubuntu 16.04

This is a guide on how to install sSMTP and set it up with Gmail on Ubuntu 16.04.
I installed this to allow CSF/LFD to send email to me, as I didn’t want a full mail server.

Step 1:
Login to SSH as root.

Step 2:
Makre sure your Ubuntu Repository, is up to date.

sudo apt-get update

Step 3:
Install sSMTP

sudo apt-get install ssmtp

Step 4:
Configure sSMTP

nano /etc/ssmtp/ssmtp.conf

# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named

# Where will the mail seem to come from?

# The full hostname

# 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

Step 5:
Add reverse aliases

nano /etc/ssmtp/revaliases

Add the line:

Step 6:
Create a test messae to send

cd /root

nano msg.txt

Add the following lines:
Subject: test email

Hello World!

Step 7:
Test to make sure it all working

cd /root

/usr/sbin/ssmtp < msg.txt

Be sure to set your Gmail email address where it has:

Remember to set your Password in the ssmtp.conf file.
If you are using Two-Factor you will need to create an App password, instead.

Leave a Reply