Sending email from the command line


It’s so easy to write little scripts and execute them at a later time with the standard command-line tooling available in unix-like operating systems, but if you plan on having them execute while you are out and about, it would be nice to get a notification on your phone that it worked (or didn’t work).

If you’re happy with a simple email notification, then luckily this can be done with one simple line of code!

On a mac:

echo "Hello" | mail -s "Your alert" [email protected] -f [email protected]

On *nix:

echo "Hello" | mail -s "Your alert" [email protected] -aFrom:[email protected]