Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

2 Answers 2

up vote 3 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.

share|improve this answer

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 this will be ok:

echo "Here is the file you requested" | mutt -s "attaching file" -a one.txt second.txt -- me@company.com,you@company.com
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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