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" david.urquhart@ghg.org.uk < results.csv

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







daveyuAsked:
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" some-address@domain.org
0
 
neteducationCommented:
cat results.csv signature.txt | mpack -s "Hello World" david.urquhart@ghg.org.uk
0
 
daveyuAuthor Commented:
This is what I get with this suggestion:

# cat results.csv signature.txt | mpack -s "Hello World" david.urquhart@ghg.org.uk
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
0
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.

 
neteducationCommented:
oh, I see... ok, then use

cat results.csv signature.txt >/tmp/temporary.$$ ; mpack -s "Hello World" /tmp/temporary.$$ david.urquhart@ghg.org.uk; rm /tmp/temporary.$$

0
 
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" david.urquhart@ghg.org.uk < signature.txt

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

mpack -s "Hello World" david.urquhart@ghg.org.uk < results.csv

works, then you can do like this:

cat results.csv signature.txt >/tmp/temporary.$$ ; mpack -s "Hello World" david.urquhart@ghg.org.uk</tmp/temporary.$$; rm /tmp/temporary.$$

0
 
daveyuAuthor Commented:
Worked it out myself:

mpack -s "Hello World" -d signature.txt results.csv david.urquhart@ghg.org.uk



0
 
daveyuAuthor Commented:
Best Answer so far
0
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.