SSMTP – sending emails from Linux system : I’ve been using Manjaro Linux since the start of 2020 (From 2021 I have switched to Arch Linux but using the same SSMTP set-up)
Linux unlike Windows can be harder to use. To modify or create files or folders in certain places can be a real pain, because of it’ security. It’s a good thing, but wrapping you head around how to modify a dopey file that needs root access can be a real pain in the ass.
In a these posts, I’m trying to write down things that I found hard or complicated to do or learn, and sometimes very time consuming. So hopefully they maybe of some use to you.
This tip is to get my Cron backups to send an email when the job has been completed. Sadly as with many Linux’s programs this is far from easy.
First I had to install ssmtp, that was the easy part… (update 2021 SSMTP is now replaced with something else in Arch linux and no longer updated, but it can still be found and downloaded and works fine)
Once installed you will find a folder at /etc/ssmtp/
Inside will be two files, ssmtp.conf & revaliases. As usual these have only root permissions and so you need to modify them as root and not as user.
In the conf file once opened you just need to paste the following under the line # The full hostname (for info when a line has a # in front of it, this means that it’s a commented line not a command line)
ssmtp.conf (change the red details for yours)
hostname=user-manjaro (‘user-manjaro’ this is my user/hostname name, in my Arch Linux setup it’s now xxxx-arch for instance)
AuthPass=123456 needed if you use gmail with 2FA, you have to create a special password under gmail security’s settings to let ssmtp / Linux send yourself mails (https://support.google.com/accounts/answer/185833?hl=en)
Once these details have been done you can modify the second file Revaliases
Paste these two lines in the revaliases file, again you need root access to modify this file and modify just the red details for your own
With all this done you can now use SSMTP for sending emails from your Linux system
Back to your cron files
Once this has been done, you can modify your cron file and instead of
Now when your cron job runs, you will receive a mail. The subject of the cron subject line is long and a mess : but it’s better than nothing
Email subject line : Cron <root@usermanjaro> root rsync -avhW /home/trevor/Documents/* /run/media/trevor/BackUp_1/Copy_trevor_home_documents