shelloozie-workflow

Null message body


echo test=$( "Message Body " | mail -s "Subject Testing " -a $(ls -dt $PWD/*|head -1) abc@def.com)


Solution

  • I am not sure if I get you right. You want to mail with an attachment and a body, and set $test variable the message? Why don't just set it explicitly.

    Or you just wanna know how to add the message body to the mail? If so, it would be like this.

    mail -A hello.txt -s "Subject Test" abc@def.com <<< "This is the message"
    

    Use -A for debian based systems, which uses mailutils package.