My understanding is that:
- sSMTP has to be installed and configured
- MAILTO= has to be added on top of crontab
I have setup also installed the following instructions: https://wiki.archlinux.org/index.php/SSMTP
I've read other tutorials however they were from around 2009 and outdated.
Upon testing it as per the instructions I was not able to get it to work.
> echo test | mail -s "testing ssmtp setup" <email_address>
mail: cannot send message: Process exited with a non-zero status
The email address I am trying to send emails from is a @gmail.com address.
First you should have an MTA installed on your system.
After that you should configure this MTA with smtp parameters (gmail in your case):
Choose smarthost usage and set a correct smtp (gmail smtp server for you) address. To ensure you've correctly configured the smtp server check dc_smarthost parameter in /etc/exim4/update-exim4.conf.conf file.
If you have to provide password authentication for the smtp server, check this link content to do that.
If the smarthost configuration is correct the send command must work in a shell script:
This is a basic way to send mail, to improve it: man mail