How do I use mpack to send an email with an attachment and textual body

I am using mpack to send attachments i.e.

mpack -s "Hello World" < results.csv

How do I add some text to the body of the email contained in a
file such as signature.txt

Who is Participating?
Hanno P.S.Connect With a Mentor IT Consultant and Infrastructure ArchitectCommented:
mpack will "pack" (convert) a file/stream -- like uuencode. I don't use mpack, as uuencode does
it also:

( uuencode results.csv < results.csv ; cat signature.txt ) | mailx -s "Test Message with attachement"
cat results.csv signature.txt | mpack -s "Hello World"
daveyuAuthor Commented:
This is what I get with this suggestion:

# cat results.csv signature.txt | mpack -s "Hello World"
Either an address or one of the -o or -n switches is required
mpack version 1.5
usage: mpack [-s subj] [-d file] [-m maxsize] [-c content-type] file address...
       mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -o file file
       mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -n groups file
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

oh, I see... ok, then use

cat results.csv signature.txt >/tmp/temporary.$$ ; mpack -s "Hello World" /tmp/temporary.$$; rm /tmp/temporary.$$

daveyuAuthor Commented:
Well I tried this but the whole thing gets sent as an attachment i.e.

the output of cat results.csv signature.txt.

I want results.csv to be an attachment and the contents of signature.txt
to be the body of the email.

I see that mutt can do this with

mutt -a results.csv -s "Hello World" < signature.txt

Is this the way to go?.
Suppose that your example

mpack -s "Hello World" < results.csv

works, then you can do like this:

cat results.csv signature.txt >/tmp/temporary.$$ ; mpack -s "Hello World"</tmp/temporary.$$; rm /tmp/temporary.$$

daveyuAuthor Commented:
Worked it out myself:

mpack -s "Hello World" -d signature.txt results.csv

daveyuAuthor Commented:
Best Answer so far
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.