Skip to content

Instantly share code, notes, and snippets.

@casmith
Last active May 23, 2020 20:18
Show Gist options
  • Save casmith/50b33160c3c558acf7c9eedf8f3a5331 to your computer and use it in GitHub Desktop.
Save casmith/50b33160c3c558acf7c9eedf8f3a5331 to your computer and use it in GitHub Desktop.

Required Packages Luckily, installing this on Debian/Ubuntu is dead simple. bash

apt-get install ssmtp

Then, you'll need to edit your ssmtp.conf file.

nano /etc/ssmtp/ssmtp.conf

and paste something like this in.

root=username@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=username@gmail.com
UseSTARTTLS=YES
AuthUser=username
AuthPass=password
FromLineOverride=YES

Press crtl+x, and then y to save and exit.

Then add each account that you want to be able to send mail from by editing, bash

nano /etc/ssmtp/revaliases

and paste...

root:username@gmail.com:smtp.gmail.com:587
youruser:username@gmail.com:smtp.gmail.com:587 

Just replace youruser with your Ubuntu username and username@gmail.com with your gmail address.

Resources:

http://zackreed.me/articles/39-send-system-email-with-gmail-and-ssmtp

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