Skip to content

Instantly share code, notes, and snippets.

@smolin
Created August 11, 2017 20:07
Show Gist options
  • Save smolin/a13aeba5b2cd004264067b8f45cb3aaa to your computer and use it in GitHub Desktop.
Save smolin/a13aeba5b2cd004264067b8f45cb3aaa to your computer and use it in GitHub Desktop.
send email from linux with ssmtp
These instructions will allow root to send email from the
system through a dedicated gmail account, as for example for
smartd monitoring.
Props to https://tecadmin.net/send-email-smtp-server-linux-command-line-ssmtp/
for the starting point for this information.
Sign up for a dedicated gmail account.
Turn on "allow less secure apps".
Install ssmtp using your package repository tools.
Edit /etc/ssmtp/ssmtp.conf so it looks something like this:
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=your_email@gmail.com
AuthPass=XXXXXXXXXXXXXXX
Protect the password with:
% chmod go-r /etc/ssmtp/ssmtp.conf
Check that ssmtp is in the line of fire with:
% sendmail -V
sSMTP 2.64 (Not sendmail at all)
Test with
% sudo mail real_email@domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment