Command Line email

Nov, 10 -- Categories: Linux, Mac

Send email while your at the teminal….
echo "The body of your email here" | mail -s "The Subject of your email here" me@jamesborder.com

A couple of “useful examples”?

send the last 100 line of the error log to yourself (or to a client that needs to see them but doesn’t know how to get to them)
tail -100 /opt/local/apache2/logs/error_log | mail -s "From error_log" me@jamesborder.com

send the last 10 lines of your command line history to your self
history | tail -10 | mail -s "Howd I do that" me@jamesborder.com