I'm doing my first steps with Mutt (with msmtp in Slackware 13.1).
I'm already able to send mail with attachments like so:
cat mail.txt | mutt -a "/date.log" -a "/report.sh" -s "subject of message" -- myself@gmail.com
I would like to define the files to be attached in another file and then tell Mutt to read it, something like this:
mutt -? listoffilestoattach.txt
Is it possible? Or there are similar approaches?
You can populate an array with the list of file names fairly easily, then use that as the argument to
-a
.If you are using
bash
4 or later, you can replace thewhile
loop with the (slightly) more interactive-friendlyreadarray
command:If, as appears to be the case,
mutt
requires a single file per-a
option, then you'll need something slightly different:Using
readarray
, try