Command Line Mail in Linux
Simple way for using command line mail program on Linux:
Simple Email Message:
echo “Message Body” | mail -s “Subject” receiver@emailaddress.com
Sending File using Linux mail command:
mail -s “Subject” receiver@emailaddress.com < file_to_send.txt
Sending Binary Files with Linux mail command:
Sometimes sending binary files does not work well the command line. We can use uuencode formatting for sending such files:
uuencode myimage.jpeg | mail -s “Subject” receiver@emailaddress.com
Few command line options for Linux mail command:
-s subject Use subject for the e-mail title
-c address Send copy of the mail to the specified address
-b address Send blind carbon copy to specified address
More details can be found here:
Linux Mail Command Line Options
Linux Mail Command Line Options – source 2