Attaching messages to outgoing mail in mutt

When I want to forward an email to someone as an attachment (usually because I want them to reply to it without having to snip gunky forward ‘headers’ in the body and preserving Message-ID and such) I can’t always forward-as-attachment, sometimes because I’m replying rather than starting a new mail, sometimes because I’m forwarding messages from multiple folders.

Up until today, I’ve resorted to all kinds of tricks to add other messages as attachments to mutt messages. One old favourite was copying them (shift+c) to a new maildir, attaching the individual files and manually setting their MIME type to message/rfc822. This does actually work but there is an easier way, the attach-message function, bound to shift+a by default.

On the screen where you normally add attachments, press shift+a. Navigate to the folder containing the messages you wish to attach (if they’re in different folders, just do this once per folder). Tag all the messages you want to attach (the default keybinding for tagging a message is ‘t’). Quit from the folder browser (‘q’). All tagged messages will be attached to the outgoing mail.

Creative Commons License
Attaching messages to outgoing mail in mutt by Mary Gardiner is licensed under a Creative Commons Attribution 4.0 International License.

Sending messages one-by-one with mutt

Here’s a feature of my mail client, mutt, that I wasn’t previously aware of: the ability to emulate the mail command if you invoke it with mutt -x.

This is my use-case: every so often, I want to email a bunch of people, typically for some kind of invitation thing. But I’d like to email them the same message one by one.

I don’t want to Cc them all because I know a whole lot of people who are addicted to group reply/reply to all, and also because Gmail itself is addicted to this: it interprets mutt’s Mail-Followup-To header as Reply-To, meaning if I included an email list in the Ccs and mutt has set a Mail-Followup-To to be that email list and all other recipients minus myself (it’s been told I’m subscribed to the list), all Gmail users will reply to the entire Cc list minus myself, which is exactly the reverse of what I want. And lastly, occasionally I don’t want to give them a complete list of exactly who is and isn’t privy to whatever is in this particular email.

The standard solution is then to Bcc them. But most of my social mailing lists don’t accept Bccs, some of my friends also don’t accept them, and I also have trouble remembering who I sent the mail to.

After that, the typical thing to do (on the UNIX-like commandline anyway), is something like this:

  1. Store the text of the message in messagebody.txt
  2. Store the recipient list in addresses.txt
  3. Run a script that goes pretty much like this:
    for address in `cat addresses.txt`
    do
    mail -s “Some subject line” $address < messagebody.txt
    done

But then the problem is that I don’t have the usual copy of the outgoing mail in my mutt outbox, because I sent it with mail, not with mutt. However, just now I checked the mutt man page, and saw this:

 OPTIONS  -x     Emulate the mailx compose mode.

So, that means I can do this, or something equivalent to this, and get exactly the behaviour I want (mails sent one-at-a-time with the recipient’s email in the To: field and a copy left in my mutt outbox):

for address in `cat addresses.txt`
do
mutt -x -s “Some subject line” $address < messagebody.txt
done

Creative Commons License
Sending messages one-by-one with mutt by Mary Gardiner is licensed under a Creative Commons Attribution 4.0 International License.