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
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
cat results.csv signature.txt | mpack -s "Hello World" david.urquhart@ghg.org.uk
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
# 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.$$
cat results.csv signature.txt >/tmp/temporary.$$ ; mpack -s "Hello World" /tmp/temporary.$$ david.urquhart@ghg.org.uk;
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?.
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/tempo rary.$$; rm /tmp/temporary.$$
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<
ASKER
Worked it out myself:
mpack -s "Hello World" -d signature.txt results.csv david.urquhart@ghg.org.uk
mpack -s "Hello World" -d signature.txt results.csv david.urquhart@ghg.org.uk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Best Answer so far