🔍 See Original Answer on Ask Ubuntu 🔗
How do I set Cron to send emails?
April 4, 2018
Edited: August 5, 2018
November 24, 2022
Copy to clipboard: false
I used a pretty simple method to get
cron to send emails: Backup Linux configuration, scripts and documents to Gmail.
Simplest way to automate sending email
From Send email alerts using ssmtp we find the simplest way of sending email automated from terminal or script. The installation steps are straight forward:
sudo apt install ssmtp sudo nano /etc/ssmtp/ssmtp.conf # Change "MyEmailAddress" and "MyPassword" to your own.
There is one step not mentioned; Google will send you an email confirming you want to allow a “less secure” application to send mail with your account:
There is an annoyance of getting too much mail. For example every time you mistype your
sudo password you will get an email: Stop emailing me bad sudo password attempts