Null message body

613 Views Asked by At

echo test=$( "Message Body " | mail -s "Subject Testing " -a $(ls -dt $PWD/*|head -1) [email protected])

1

There are 1 best solutions below

3
Matthew Chen On BEST ANSWER

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" [email protected] <<< "This is the message"

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