Skip to content

Instantly share code, notes, and snippets.

@dunderrrrrr
Created February 21, 2020 13:39
Show Gist options
  • Save dunderrrrrr/13edc092eb0dfa19acde012fd30396b7 to your computer and use it in GitHub Desktop.
Save dunderrrrrr/13edc092eb0dfa19acde012fd30396b7 to your computer and use it in GitHub Desktop.
SSMTP is a program which delivers email from a local computer to a configured mailhost (mailhub).

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.

Install sSMTP

$ sudo apt install ssmtp

Configure sSMTP

Configuration can be found in nano /etc/ssmtp/ssmtp.conf. Add the following lines for Gmail.

[email protected]
mailhub=smtp.gmail.com:587
rewriteDomain= 
hostname=server hostname
UseSTARTTLS=YES 
AuthUser=username
AuthPass=password
FromLineOverride=YES

Now add reverse aliases in /etc/ssmtp/revaliases.

root:[email protected]:smtp.gmail.com:587

Now you're all set!

Test sSMTP

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!

Send your email with CTRL+D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment