I moved to the Mutt email client in mid 2011. I wrote up some tips and tricks for using Mutt and OS X.
The interesting and somewhat annoying thing about Mutt is that sometimes features are so well hidden you only hear whispers and rumors about them.
This is one of those times.
Goal: Attach files to an email message without using Mutt’s file browser
Mutt’s has a built-in file browser which it uses to select mailboxes, save attachments, and attach files to the current outgoing message.
The reality of email in 2012 is that we’re attaching files to messages a lot. Ok, maybe “several times a week”, but hey, we’re on OS X - I don’t want to select files using some console interface.
Mutt has a solution: the
Attach pseudo header
One of the “whispers and rumors” features of Mutt is the Attach pseudo header.
When it calls your editor of choice Mutt lets you edit the email headers of that message. This feature is the basis of the Attach pseudo header.
First, to get this to work, you must have
edit_headers set to yes.
edit_headers set, when you open your editor you’ll see
Deep in the Mutt documentation (manual section 2 subsection 2.4, second sub-sub section it talks about the
So, here’s how you use this:
- Create a new message or reply to an existing one in Mutt. This will trigger your editor
- If you want to attach a message, directly underneath the last header data you see, add a new new line that starts with
Attach:. Insert the path to the file to attach to the message.
Attach in use
From: Ryan Wilcox <firstname.lastname@example.org>
Subject: Hello world
When you exit your editor
the.doc will be attached to your message: you should see it in the attachment list in the Mutt outgoing message view.
Like pretty much every Unix utility, Mutt’s
Attach feature doesn’t handle whitespace in filenames. You must escape this whitespace using the