been trying to follow the myriad of examples for how to send a simple email from bash script. So far I have installed and tried thru the examples: mailutils, sendmail and mutt. I can't get any of them to send anything and get errors everytime. I do what the examples say: install, type this, it will work....but it doesn't.
Simplest version I have tried:
- Code: Select all
MAIL = "/usr/bin/mail"
TO = "email@example.com"
SUBJECT = "Motion detected"
echo "texter text" | $MAIL -s "$SUBJECT" $TO
and these are the errors I get after trying to run the bash from cli:
./Send_Msg.sh: 3: ./Send_Msg.sh: MAIL: not found
./Send_Msg.sh: 4: ./Send_Msg.sh: TO: not found
./Send_Msg.sh: 5: ./Send_Msg.sh: SUBJECT: not found
./Send_Msg.sh: 7: ./Send_Msg.sh: -s: not found
This is in reference to getting Motion to send an email with a pic on an event. Gave up on the pic and am just trying to get the generic email to work and send anything. Will tackle working it in with Motion part later.
Greatly appreciate any help! Think I am going to take a break for a bit and go play some bf3....