Link to home
Start Free TrialLog in
Avatar of daveyu
daveyu

asked on

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







Avatar of neteducation
neteducation

cat results.csv signature.txt | mpack -s "Hello World" david.urquhart@ghg.org.uk
Avatar of daveyu

ASKER

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
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.$$

Avatar of daveyu

ASKER

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?.
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.$$

Avatar of daveyu

ASKER

Worked it out myself:

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



ASKER CERTIFIED SOLUTION
Avatar of Hanno P.S.
Hanno P.S.
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daveyu

ASKER

Best Answer so far