How to send a mail from a Linux shell script

Often times we need to send an email from Linux shell script after completing a certain task.  Here is the shell script to send email automatically.

mail -s "Your subject" toemail@example.com <<< "Your message"

<<<  passes the word on the right the standard input of the command on the left.

Editorial Staff
 

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.