On Wed, May 12, 2010 8:51 am, Derek Martin wrote: > On Wed, May 12, 2010 at 11:50:20AM +0800, Qi Zhang wrote: >> Yes, because the attachments are generated by scripts then put into >> different folders. >> Each receiver has different amount of attachments. > > If I understand correctly, this is trivial to do with mutt in a > script, unless your attachment filenames can contain shell special > characters or whitespace. The shell deals badly with that, > unfortunately. Otherwise, if your attachment directory is in $dir, > then something like this should do what you need: > > cd $dir > attachments=`echo *` > # DO NOT quote $attachments, so each is treated as a separate arg > mutt -s "$subject" -i "$message_file" -a $attachments -- "$recipient"
bash and zsh should allow something like that: mutt -s "$subject" -i "$message_file" `printf "-a %q " dir/*` -- "$recipient" which should take care of the quoting for special filenames. However, I have not tested it. regards, Christian