LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Piping to mail and adding a subject line. (https://www.linuxquestions.org/questions/linux-general-1/piping-to-mail-and-adding-a-subject-line-388827/)

Echo Kilo 12-03-2005 12:54 AM

Piping to mail and adding a subject line.
 
When I run a command or script and pipe it to mail, how do I add a subject line to the mail?

For example:

rsync -av /home/ /b/home | mail email@gmail.com

This will send the output, but without a subject line. Also, what if want to add some text in the body before the contents that are piped?

homey 12-03-2005 11:24 AM

How about putting the message in a text file or maybe using the here doc would work....

mail -s "howdy" me@mydomain.com < message.txt

or

mail -s "howdy" me@mydomain.com << EOF
> this is a test
> EOF


All times are GMT -5. The time now is 10:19 PM.