This is the code I have in a bash script that runs as a cronjob. The cronjob run as root.
/usr/sbin/sendmail email@example.com<<EOF subject:Backup Error! from:backup@server01 $error EOF
There is code after this and the email I get is as follows:
From the root user on the machine.
and the message includes:
subject:Backup Error! from:backup@server01 $error EOF More code... that is in the script all the way to the end...
I have tried other variations, this is the closest I've got. I tried this in a regular script and it worked properly. Whats going on, and how can I send this email, specifying the subject and form sender?