I am tempering with my cronjobs to change the sender and subject for emails sent by the cronjob. For sending emails I installed the mailutils package on Ubuntu 14.04.
This is how I am sending my email from the cronjob:
0 3 * * * /root/bin/backup.sh 2>&1 | mail -s "Slave1 Backup" -a "From:Slave1<slave3@example.com>" cronjob@example.com
Source: How to change "From:" field for emails from Cron?
However this sends me an empty email. The backup script ran because I can see that all the files are up to date, however the email contains no text.
If I change it back to this, the emails contains all the output from the backup script as I want to:
MAILTO: cronjob@example.com
0 3 * * * /root/bin/backup.sh
What do I have to change so that mailutils will send the output from the cronjob?