How to send email from Terminal?
I know there are ways to send email from terminal in Linux/MacOS, but I can't seem to find proper documentation on how to do that.
Basically I need it for my bash script that notifies me every time there is a change in a file.
Solution 1:
echo "this is the body" | mail -s "this is the subject" "to@address"
Solution 2:
Go into Terminal and type man mail
for help.
You will need to set SMTP
up:
http://hints.macworld.com/article.php?story=20081217161612647
See also:
http://www.mactricksandtips.com/2008/09/send-mail-over-your-network.html
Eg:
mail -s "hello" "[email protected]" <<EOF
hello
world
EOF
This will send an email to [email protected]
with the subject hello
and the message
Hello
World