[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3218
  • Last Modified:

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







0
daveyu
Asked:
daveyu
  • 4
  • 3
1 Solution
 
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
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now