In the following example, I can use comma to send the same message to 2 recipients. But I can not use comma to send 2 files.

echo "Here is the file you requested" | mutt -s "attaching file" -a one.txt -- me@company.com,you@company.com

How do I send the second.txt file in the same command?

link|improve this question

78% accept rate
feedback

migrated from stackoverflow.com Mar 15 '11 at 17:17

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 1 down vote accepted
echo "Here is the file you requested" | mutt -s "attaching file" -a one.txt -a two.txt -- me@company.com,you@company.com

Should work. A lot more work for 10-20 files though.

link|improve this answer
feedback

As said in mutt manual (version 1.5.21).

-a file [...] Attach a file to your message using MIME. When attaching single or multiple files, separating filenames and recipient addresses with "--" is mandatory, e.g.

mutt -a image.jpg -- addr1 or mutt -a img.jpg *.png -- addr1 addr2

The -a option must be placed at the end of command line options.

So

echo "Here is the file you requested" | mutt -s "attaching file" -a one.txt second.txt -- me@company.com,you@company.com

will be ok.

link|improve this answer
which mutt version should I use? I tried the above command but only the first file is being sent. Mutt 1.4.2.2i (2006-07-14) – shantanuo Mar 14 '11 at 9:10
@shantanuo I use 1.5.21. Please add your version to the question. – graphite Mar 14 '11 at 9:13
I did not notice, but the answer by Philippe Harewood is working as expected. Thanks all. – shantanuo Mar 14 '11 at 9:19
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.