1

In my script I have a variable named $message. I want to send this message together with a jpeg using mpack.

One way that works:

echo "$message" > myText
mpack -s "test mail" -d myText myImage.jpg john@example.com

However, I would like to dispense with writing the file myText and directly pass the contents of $message to the -d parameter.

How can this be done?

BTW: My $message variable contains two sub-strings separated by a linefeed.

1

Figured it out. A named pipe did the trick:

mkfifo fifo
echo "$message" > fifo &
mpack -s "test mail" -d fifo myImage.jpg john@example.com
rm fifo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.