How to send email from Terminal?

bash, email, terminal

Solution

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" "example@example.com" <<EOF
hello
world
EOF

This will send an email to `example@example.com` with the subject `hello` and the message

Hello

World

Problem

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.

Original source

Related problems