dcsimg

Start Taming Your Mutt

By Joe Brockmeier (Send Email)
Posted Mar 7, 2011


Mutts can be lovable companions, but they still must be trained. The same is true of the Mutt mail client. Out of the proverbial box it's a powerful mail client, but that's nothing compared to what you can do with a well-trained Mutt.

Mutts can be lovable companions, but they still must be trained. The same is true of the Mutt mail client. Out of the proverbial box it's a powerful mail client, but that's nothing compared to what you can do with a well-trained Mutt.

A few weeks ago I covered setting up OfflineIMAP and msmtp to fetch and send (respectively) email for Mutt. This time I'd like to take a look at configuring Mutt itself.

One way to configure Mutt is to dig into the manual and muttrc man page. You could spend a lot of time tweaking the ~/.muttrc that way to get a basic configuration.

An easier way to get started is to take the muttrc builder for a spin. Just what it sounds like -- a Web-based tool to create a detailed muttrc that you can drop in and start being productive in Mutt. If you don't already have a Mutt configuration, this is a good way to get started. It's also a good way to configure sections (like composition or crypto) that you haven't set up fully.

What it doesn't do is really customize Mutt for your use. For example, if you want to change Mutt keybindings to be a bit more like another mailer or just more intuitive in general. (Who thought that Z would be intuitive for "page down"?)

To change Mutt's default keybindings, you'll want to set up a bind entry in your muttrc. For example, if you want to change page down (next-page) to something sane, you can use bind to set an alias for the space key (or whatever you prefer) as next-page:

bind browser ' ' next-page
bind index ' ' next-page
bind pager ' ' next-page

Here you're telling Mutt to use the spacebar (' ') to forward one screen. If you're reading a message, for example, that is longer than one screen, it will move you through the message. If you're at the end of a message or if it takes up one only display, it will move to the next message. If you're in the message index, it will move the cursor down one screen or to the last message.

As you can see, Mutt has several contexts (e.g., browser, index or pager) that you must specify for the keybindings. Just setting the keybinding in the index won't affect the pager (to view messages), and so on. See the Mutt manual for more on changing the default keybindings.

If you're familiar with Pine, and want to make the most of the muscle memory from your Pine days, you can find a muttrc to simulate Pine keybindings. It's not perfect, but it's pretty close.

You can also set up macros that operate like several keystrokes. For instance, if you want to go directly to the list of mailboxes with one keystroke, by default you need to hit c and then ? to see all mailboxes. To reduce this to one keystroke set this macro:

macro index l "c?"

Finally, to get the most out of Mutt, you must to embrace hooks. Hooks are a way to execute a command or change a configuration setting depending on the context. For instance, you might want to change your "from" address depending on which mailbox you're reading or when you're sending mail to specific addresses. If you use Mutt for personal and work, you might want to set a hook that sets the address as your work email when sending to your boss:

send-hook '~t ^boss@mycompany.com$' 'my_hdr From: Me at Work '

It's impossible to cover all the configuration options for Mutt in a short tip like this. Actually, given Mutt's flexibility, you could write a book and not hit all the options -- but if you're using Mutt, understand that it can probably do just about anything that you think a mail client ought to do. With some time and patience, you can turn Mutt into a loyal companion that helps you process email even more quickly and effectively.

Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at jzb@zonker.net and follow him on Twitter.

Follow ServerWatch on Twitter

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.