Issue
My requirement is to attach all the .csv files in a folder and send them in a single mail.
Here is what have tried,
mutt -s "subject" -a *.csv -- [email protected] < subject.txt
The above command is not working (It's not recognizing multiple files) and throwing the error
Error sending message, child exited 67 (User unknown.).
Could not send the message.
Then I tried using multiple -a
option as follows,
mutt -s "subject" -a aaa.csv -a bbb.csv -- [email protected] < subject.txt
This works as expected. But this is not feasible for 100 files for example. I should be able use it with file mask (as like *.csv to take all csv files). Is there is any way we can use like *.csv in single command?
Thanks
Solution
Mutt doesn't support such syntax, but it doesn't mean it's impossible. You just have to build the mutt command.
mutt -s "subject" $( printf -- '-a %q ' *.csv ) ...
The command in $( ... )
produces something like this:
-a aaa.csv -a bbb.csv -a ...
Answered By - user80168 Answer Checked By - Terry (WPSolving Volunteer)