Mark's Mutt Fan and Tip page

by Mark Stosberg

[ Update: This page was created in 2004 and I haven't used mutt for years. I currently use the Fastmail, which has good keyboard shortcut support on their website. ]

Mutt is my preferred e-mail client. I think you might also like to try Mutt if:

Why I chose Mutt

I chose Mutt over the alternatives for a few reasons. First, I wanted to be able to check my e-mail from multiple computers using the same e-mail program. Because Mutt runs on a server, I'm always accessing the same problem with the same configurations and preferences.

I also wanted an e-mail program that was very responsive. I don't want to wait on my computer any more than I need to when managing my mail. I found that Kmail and Apple Mail both have nice GUIs, but just because they are graphical, they take longer for various operations than terminal-based alternatives such as Mutt.

Following the above thinking is how I ended up using Pine as my mail client. Yes, Pine. I used it for years and found it worked well for me. I began exploring Mutt after finding it to be the default the mail reader for the Debian GNU/Linux distribution. I ultimately found that Mutt has more features that I care about, and feels even more efficient to use. Read on for some of the Mutt features I find distinctive and useful.

Some distinctive and useful Mutt features

Here are some of my favorite Mutt features that you might also find useful.


limit is a search feature that 'limits' the view of the current folder to those messages that meet a specific criteria. The criteria is specified with Mutt's own regular expression language. When I first encountered this,I thought "Oh no, another variation of the regular expression syntax to learn". I pleased to find that Mutt's system was not only intuitive and consistent, it contains many email-specific notations that add substantial value to the standard regular expression syntax. Here's an example I use. It means "limit the view of my inbox to only mail that is either New, Flagged as important, or less than 7 days old":


limit works great on a one folder, but there needs to be a way to search across several folders. For this, the external grepm program comes in very handy. It's an extremely thin wrapper around the grepmail utility. It allows you to search quickly through folders using regular expressions, displaying the results as a temporary Mutt folder. The downside to being an external utility is that it does not use Mutt's on syntax. Instead, it's a slightly modified version of the standard grep syntax.

In practice, this has turned out not to be problem. Simple searches of the headers or body are easy enough (try the -h or -b flags), and the rare complicated case sends me to the grepmail man page.

Easy address book management

At first I was put off by Mutt's simple text-file based address book system. There is no built-in general editor for it. Instead, a text editor can be used. Again, I found the structure here was so simple, that I generally prefer to edit it with a text editor anyway.

Still, I wanted a way to easily access addresses of people I have already e-mailed with. This is a feature I learned to appreciate from using Netscape Communicator. If I just started typing the name or e-mail address of a previous contact, the program would complete it even if I never formally added them to my address book.

Mutt can do much the same thing by integrating with the Little Brother Database, also known as lbdb. Here are the three steps to do that:

With this one-time setup, managing addresses in Mutt is very comfortable. To auto-complete an e-mail address, I can simply type Control-T after typing a few characters at the address prompt. If there is one match, it will replace what I've typed. Otherwise, a list of matches will be displayed, and I can select the correct one.

With built-in commands to add people to my address book and query it as described above, Mutt is providing the bulk the interface I need to manage e-mail addresses.

For the long term, there are some console-based address book applications that look promising. Going beyond e-mail address books, these programs could be complete address book solutions. Here I've been most impressed with abook and rolo. Neither feels finished enough yet to try adopting yet. Abook didn't seem to have a way to store a list of e-mail addresses in a record. Rolo doesn't yet provide an easy way to edit the VCard format it uses. If I switched to one of these, I would use it as a complete address book solution, not just for Mutt.

Attractive e-mail printing with muttprint

The muttprint package provides a convenient way to print out nicely formatted copies of e-mail messages. It's very easy to install configure and does not need any further explanation here. And despite the name, it can easily print e-mails from Pine and other Unix e-mail programs as well.

Standards support and integration

Mutt does an excellent job with the fundamentals of e-mail. It supports many folder types, and all of the important e-mail related standards that I'm aware of, including IMAP, MIME, SSL and PGP encryption. In most distributions these will be compiled-in by default. You do have the option to remove features at compile time if you consider them bloat. I find Mutt so responsive with the features available, I just assume leave support for everything in place.

Configurable Key Bindings

Mutt allows me to create any mapping I like between keys and the functions bound to them. For example, the distribution comes with a collection of Pine-like bindings to make switching from that program especially easy.

I found this feature most useful when integrating with the SpamAssassin spam filtering system. I was able to define key bindings for "Delete as Spam" and "Delete as Ham". These send mail to separate folders instead of being deleted immediately. From there, a cron script processes them to further train the filtering system about what spam is (and is not). Without configurable key-bindings this would not have been possible without fundamentally altering at the mail program. (Which is how Mozilla Mail and Apple Mail achieve much the same effect). With this system I spent very little time managing spam and less than 1% gets through the filter.

My .muttrc keybindings to integrate with SpamAssassin

    # SpamAssassin integration

    # Delete is re-bound to move messages to Trash. They will be filed as ham by a cron script later.
    macro index d "s=Trash\n" "move message to trash"
    macro pager d "s=Trash\n" "move message to trash"

    # Spam that SA missed is manually sent to the junkmail folder
    macro index X "s=junkmail\n" "file as Spam"
    macro pager X "s=junkmail\n" "file as Spam"

    # Junk/spam mail older than two days is automatically marked for deletion
    # because it will have already been processed as spam by a cron script
    folder-hook     "=junkmail" 'push "D~d>2d"\n'

My cron script to process to process spam and ham



    [ -w $TRASH ] || exit 1
    [ -w $SPAMBOX ] || exit 1

    # process Trash as ham
    if /usr/local/bin/sa-learn --mbox --ham $TRASH
      # delete Trash
      /bin/cat /dev/null > $TRASH
      echo "ham processed"
        echo "ham not processed";

    # process Spam, don't delete-- I'll review it by hand later
    /usr/local/bin/sa-learn --mbox --spam $SPAMBOX


Easily process many messages at once.

Mutt allows me to easily tag messages individually or based on a pattern I specify. So for example, I can tag several messages and then save them all to the same folder in one action. Or I could tag a bunch of messages that match the same pattern and delete them in one step.

My favorite use of this is to reply to multiple messages at once. This is great when someone has sent me several messages, and I want to send one reply to all the messages, quoting some text from each. I just tag some messages, use the 'apply' function, and the "reply" function.

Integrates with my favorite text editor.

With Mutt's focus on mail, it doesn't include it's own message editor, but allows me to use one of my choosing. I consider this a feature. Using vim as my editor, I have Mutt configured to allow me to edit the full headers, opening the message with the cursor just below the subject line. For that I've added the following to my .muttrc file:
set edit_headers
set editor="vim +/^$ ++1"

Editing the full headers is nice because I don't to have to worry about how to add a standard or non-standard header to a message. I can edit them all with the ease I perform other text editing.

On the vim side, I have it configured to recognize the temporary files that Mutt creates as "mail" files, and highlight and format them accordingly. The relevant line in .vimrc file looks like this:

" set up syntax highlighting for my e-mail
au BufRead,BufNewFile .followup,.article,.letter,/tmp/pico*,nn.*,snd.*,/tmp/mutt* :set ft=mail 

It's the little things that make a difference

Here's an absolutely simple feature of Mutt that I appreciate: To jump to a specific message, I can just start typing the message number. (Mutt displays the message numbers in the index view). Pine has a "jump to message" keystroke, but with Mutt no other typing is required besides the message number. It's such a simple thing to save a keystroke there, but it's one of many small time-savers that make Mutt feel so efficient to use.

The beauty of being so configurable is that Mutt can be setup with time-savers particular to the way you like to use it.

Here's a small customization that has improved my experience. By default, the "help" keystroke displays the man page for Mutt. I re-bound those keys to display the HTML version of the documentation instead, which is much faster for me to navigate.

# w3m is a console web browser, replace it with whatever you want
macro generic <f1> "!w3m /usr/doc/mutt/html/manual.html\n" "Show Mutt documentation"
macro index   <f1> "!w3m /usr/doc/mutt/html/manual.html\n" "Show Mutt documentation"
macro pager   <f1> "!w3m /usr/doc/mutt/html/manual.html\n" "Show Mutt documentation"

Further resources

If you are considering trying Mutt, i recommend the My First Mutt website. If you are a Pine user, be aware that the first Pine2Mutt utility you might find isn't the most useful. There is a better Pine2Mutt Addressbook converter script.

Mark Stosberg