-
Using Mutt on OS X - tips and tricks
Introduction
A few months ago I switched to Mutt as my email client. I used my previous email client for 14 years, and had accumulated 150,000 messages.
Yes, I had been using the same email client since 1997.
Since then a lot has changed in the online world: the rise of IMAP, Gmail making webmail a viable first option for a lot of people, etc. Some of these changes my old email client handled well (for example, spam was handled by SpamSieve in seamless style).
But I found my workflow changing, based on Gmail. I no longer want my email client to automatically filter most of my messages, for example. I want most of my messages to go into my INBOX, where I have a centralized place for triage.
For the last few years I’ve tried out other email clients briefly: Postbox, Mail.app, Thunderbird. They didn’t match my style for one reason or another. Some of them didn’t have an interface to match my style or needs (the 150,000 messages), or didn’t have the longevity I was after (after spending 14 years in one email client, a 3 year old email client still doesn’t inspire trust with me).
There aren’t a lot of email clients that have been around for 10+ years.
Mutt was another email client I played with. I enjoyed it, because it matched the style of vim (my preferred Unix editor).
From the Mutt side
Installation
I decided to jump to Mutt as my primary email client when I saw the Lifehacker article on using Gmail with Mutt. This covered about half of my Mutt setup time.
I’m a longtime Macports user, so I compiled Mutt using that. Here’s the variants I used to (finally) get something that worked with the LifeHacker article:
sudo port install mutt-devel +smtp +ssl +imap +sasl +headercacheUseful (and non-obvious) Configs
Some other configs I added are as follows:
# Change the following line to a different editor you prefer. set editor = "bbedit -w"Sets up BBEdit as my editor for replies (the
-wswitch is to tell the bbedit command line tool to wait around until I save/close the document).bind index,pager G group-reply set fast_reply = yes # (controls the confirmation of TO and Subject in replys and forwards)Lets me use
Gto Reply To All. Fast Reply lets me bypass the To and Subject prompts that Mutt’s reply functionality usually imposes.I receive automated email from a number of systems (notifications from ticket systems, web app notification systems). I’ve set up some macros with tag patterns (once messages are tagged, I can shove them into a mailbox easily).
Here’s an example macro:
macro index,pager ,bo "<tag-pattern>\\[BobCo Rails App\\]<enter>" "BobCo Hoptoad Messages"Then I can enter
,boand automatically have my messages selected. (I use,as a nod to Vim’s LEADER command.If I see a bunch of these automated messages in my mailbox, I can hit my macro and quickly file them in the right mailbox.
From the OS X side
Ultimately I’m working in an OS X environment, and Mutt is command line Unix. But, I use OS X, and expect to be able to interact with things from OS X. Because I have some sweet tools in OS X.
Dealing with HTML Email
Mutt doesn’t deal with HTML email at all. Most of the suggestions online say something like, “Oh, pipe it to Lynx”. No thanks - I want to open HTML email in one of my desktop browsers, thank you.
My solution to this to to open up the email in my editor (BBEdit), then run a Python script I wrote which extracts the HTML part of the email and opens that part in a browser.
Here is the script: view HTML from email
Opening URLs in my preferred browser
Sometimes a plain text email will have a link I want to open in my desktop browser. There are a few ways to deal with this:
- Set a keyboard shortcut to the “Open URL” service (System Preferences -> Keyboard -> Keyboard Shortcuts -> Services -> Internet -> “Open URL”). Now you can select the link you want and press that keyboard command.
- iTerm2 will allow you to command-click on URLs
Interacting with the Address Book
I have all my addresses stored in Address Book.app, and want to use that as my email address book.
There’s a simple command line tool that hooks these two pieces together, documented on eric a. farris’ blog: hooking OS X’s Address Book to Mutt
Interacting with OmniFocus
I don’t use OmniFocus, but I found this awesome script for integrating OmniFocus and Mutt. (I took this code and modified it for the
mutt_open_originscript, so thanks, Andrew!).(The Mutt open origin script searches my outbound mail for references to the message ID of the current message. The idea here is to be able to open replies from me. More information is in the Mutt and BBEdit blog entry - as the script is BBEdit centric - but those curious might want to get directly to the script:
mutt open origin script on bitbucket)
Mutt and BBEdit
My preferred text editor is BBEdit. I’ve written a number of scripts which integrate BBEdit and Mutt in interesting ways (mostly using the
bbfindcommand). If you’re interested I posted these tips on BBEdit, Email and Mutt on the BBEdit Hints blog.