The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 30,544β€…    Votes:  6β€…
Tags: command-line   cron   email   rm  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/1021764
Title: How do I set Cron to send emails?
ID: /2018/04/04/How-do-I-set-Cron-to-send-emails_
Created: April 4, 2018    Edited:  August 5, 2018
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    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:

gmail turns on less secure apps for email

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

⇧ How to fix the ubuntu splash loading bar showing up on the desktop view? Network not working properly after restart notebook closed lid  β‡©