Difference between revisions of "mail from script or CLI"
From thelinuxwiki
(Created page with "I was having trouble setting my subject line on emails. They were coming in blank. I had to put Subject: into the string and then it worked. My mail program is sendmail, bu...") |
Latest revision as of 20:17, 4 February 2014
I was having trouble setting my subject line on emails. They were coming in blank. I had to put Subject: into the string and then it worked. My mail program is sendmail, but I think the binary was replace with postfix sendmail...? not sure...
# ls -l /usr/sbin/mail /usr/sbin/mail -> /usr/sbin/sendmail
mail from CLI test
# printf "Subject:my subject\nmy body\n" | /usr/sbin/mail -F sender@atsomeemail.com me@myemailaddress.com
in my script
echo "Subject:${EMAILSUBJECT}" | cat - $LOGFILE | /usr/sbin/mail -F sender@atsomeemail.com $EMAILADDRESS
all this was working and tested