How to send email from a unix / linux script

I like a lot of detail about my script runs when I am doing unit testing, I will usually append status and event messages to a summarized log file that I call my email file, this is the syntax I use to send an email with this summary when my script is done running:

mail -s "My script completed" [email protected] < $my_email_summary

So the general syntax for the command is:

mail -s "subject" myemail@mydomain < file_name

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.