If you're a Mutt user, you already know that you're using the fastest, coolest and most customizable e-mail client available. What you might not know, however, is that under Mutt's hood are a bunch of powerful features that can help you interact with your e-mail more efficiently. The best part? They're not even particularly difficult to use.
In this brief tutorial, we'll be looking under the hood to introduce you to some of Mutt's less well-known capabilities. The tips discussed below apply to Mutt v1.2.4, which freely available from Mutt.org.
Note: All the directives below can be entered "live" during a Mutt session, or placed in the Mutt configuration file.
1. Use the threaded view
If you subscribe to mailing lists, you'll be pleased to know about Mutt's threading features. Mutt automatically sorts messages by topic, so that messages with the same topic end up organized sequentially. You can then use the cursor keys to navigate between messages in the same thread, allowing you to quickly view all the replies to a particular message. To use this feature, issue the following command to sort by thread.set sort=threads
Note: In threaded mode, a number of additional functions become available: you can delete all messages in a thread, collapse or expand a thread, mark a thread as read or unread, and jump to the start or end of a thread. See the Mutt manual for information on the keystrokes to access these functions.
2. Use nicknames and group aliases
Mutt lets you create an address book of frequently-used addresses with the alias command. This command lets you define a short "alias" which is automatically expanded to one or more e-mail addresses by Mutt before the message is sent. Here's an example:aliasjoe firstname.lastname@example.org
You can also create group aliases, by using multiple e-mail addresses separated with commas. Here's an example:email@example.com,firstname.lastname@example.org,email@example.com
3. Receive automatic notification of new mail
Mutt lets you define certain mailboxes as "active"—that is, mailboxes which are likely to receive new mail on an ongoing basis. When any of these active mailboxes receives a new message, Mutt will alert you with a status bar notification. To use this feature, list the mailboxes to be monitored with the mailboxes command, as follows:mailboxes "=inbox"
4. Tag messages
Mutt lets you "tag" multiple messages for action so that you can copy or delete them all at once with a single command. To use this feature, select each message with the t key command. Mutt will place an asterisk next to the message, indicating that it has been tagged. Once tagging is complete, use the ;c or ;d key shortcuts to copy or delete all the tagged messages simultaneously.
5. Customize message headers
Mutt lets you add your own custom headers to a message. This is useful if, for example, you want to publish your company name or your PGP key in the messages you send out. To do this, use the my_hdr command followed by the custom header to be added, as in the examples below:my_hdr Company: CNET TechRepublic
my_hdr X-URL: http://www.techrepublic.com/
6. Read mail on a remote POP3 server
Assuming your version of Mutt supports the POP3 protocol, you can access mail on a remote POP3 server directly through Mutt. To do this, type c to open a new mailbox and issue the mailbox name pop://user@mailhost/. Mutt will attempt to connect to the remote POP3 server, ask for your POP3 password, and, once successfully connected, display the contents of your mailbox. You can then read and delete messages in the normal way, as though you were manipulating your local mail spool.
7. Search and filter messages
Mutt lets you efficiently search inside messages using regular expressions and patterns. You can search both message headers and bodies for fragments matching a particular query string, and even automatically tag all matching messages for action. To do this, use the T command, followed by an appropriate selector. For example, the command T ~B techfinds and tags all messages containing the string "tech".
You can also search messages by size or date. For example, the command T ~r 25/3/2005tags all messages received on 25 Mar 2005.
Within a message or message index, you can use the / command to find the next message matching a pattern. For example, the command / monfinds the next message (line) containing the word fragment mon in its headers (body).
8. Add color to your mail
Mutt lets you colorize almost any aspect of a message, making it easier to visually distinguish between, for example, a reply and text quoted from an earlier message. It's also possible to find and highlight regular expressions in either the body or headers of an e-mail message, and display them in different colors—for example, e-mail addresses in yellow and URLs in green. To do this, issue the color command with appropriate parameters, as in the examples below:color hdrdefault white black # headers white on black
color header brightgreen black ^From: # sender's name in green
color quoted cyan black # quoted text in blue
color signature red black # signature in red
9. Browse embedded URLs
You can have Mutt automatically activate Lynx (or any other Web browser) when it encounters hyperlinks embedded in an e-mail message. To do this, download and install the add-on urlview program from the Mutt Web site, and then create a macro to launch it from the message viewer, like this:
macro pager \cu |urlview\n
Now, whenever you're reading a message containing URLs, you can simply type <Ctrl>-u to launch the URL viewer and select a link to browse.
10. Get help
At any point in your Mutt session, you can use the ?command to obtain a detailed list of available commands, and the key strokes to activate them. This can come in handy in case you forget which key does what.