Skip to content

Instantly share code, notes, and snippets.

@Alejandro-MartinG
Created October 22, 2018 17:33
Show Gist options
  • Select an option

  • Save Alejandro-MartinG/d4d2452c1c8f7132df100725e049705f to your computer and use it in GitHub Desktop.

Select an option

Save Alejandro-MartinG/d4d2452c1c8f7132df100725e049705f to your computer and use it in GitHub Desktop.
ssmtp email configuration on Ubuntu
sudo apt-get install bsd-mailx
sudo apt-get install ssmtp
sudo vim /etc/ssmtp/ssmtp.conf
I have added these lines in config file:
# Config file for sSMTP sendmail
TSL_CA_FILE=/etc/ssl/certs/ca-certificates.crt
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
[email protected]
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
[email protected]
AuthPass=*******
UseSTARTTLS=YES
# Where will the mail seem to come from?
rewriteDomain=gmail.com
# The full hostname
hostname=instance-1
# 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
FromLineOverride=YES
$ sudo vim /etc/ssmtp/revaliases
root:[email protected]:smtp.gmail.com:587
Turn on "less secure app access":
https://myaccount.google.com/lesssecureapps
You will recive a email talking about foreing login, accept it and its done you can receive emails:
https://myaccount.google.com/device-activity/nt/1540227923000
date | sudo ssmtp [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment