Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
347 views

Using Mutt

The document provides guidance on using the Mutt email client. It begins with an introduction explaining why Mutt is useful, highlighting its efficiency, configurability, and keyboard-based interface. The document then covers basic Mutt usage, including getting help, reading emails, composing messages, attachments, and advanced customization options. It aims to help users learn Mutt's features to facilitate efficient email use.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
347 views

Using Mutt

The document provides guidance on using the Mutt email client. It begins with an introduction explaining why Mutt is useful, highlighting its efficiency, configurability, and keyboard-based interface. The document then covers basic Mutt usage, including getting help, reading emails, composing messages, attachments, and advanced customization options. It aims to help users learn Mutt's features to facilitate efficient email use.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

The Woodnotes Guide to the Mutt Email Client

Randall Wood (www.therandymon.com) December 2, 2009

Contents
1 2 Introduction Why Mutt? Usage: The Basics 2.1 2.2 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reading Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 2.2.2 2.2.3 2.2.4 2.3 2.4 Your Inbox (Index View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sorting and Threading Messages in the Index View . . . . . . . . . . . . . . . . . . Reading Messages (Pager View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 4 5 5 6 6 7 7 8 9 9 9 9 10 11 11 12 12 12 13

Composing Messages and Saving Drafts (Postponing Messages) . . . . . . . . . . . . . . . Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 2.4.2 Forwarding Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting and Undeleting Attachments . . . . . . . . . . . . . . . . . . . . . . . . .

2.5 2.6 2.7 2.8

Printing Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reading Mail in Other Folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saving Messages to Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operating on Multiple Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.1 2.8.2 2.8.3 2.8.4 Selection Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tagging and Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Limiting Messages Shown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Patterns to Archive Groups of Messages . . . . . . . . . . . . . . . . . . . .

2.9

Using the Address Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

CONTENTS

Conguring Mutt 3.1 3.2 Basic Conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting Up Your Mail Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 3.2.2 3.2.3 3.3 3.4 3.5 Downloading from a server (POP3) . . . . . . . . . . . . . . . . . . . . . . . . . . Accessing your Mail at the Server (IMAP) . . . . . . . . . . . . . . . . . . . . . . Ofine IMAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13 13 14 15 15 16 17 19 19 19 20 21 22 22 22 23 24 25 25 26 26 26 26 28 30 30 31 32 33 34 34

Sending Mail: Sendmail and Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Your Sent Mail box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conguring Your Address Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 Alias File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Abook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Querying an LDAP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Little Brother Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rolo Addressbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.6 3.7 3.8 3.9

Choosing an Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dealing with HTML Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dealing with Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.10 Dealing with Word Doc Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.11 Dealing with URLs in Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Advanced Customization 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 Using Mutt with different congurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conguring Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rebinding Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Writing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the Index View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the Pager View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dealing with non-ASCII Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dealing With Particularly Troublesome Characters . . . . . . . . . . . . . . . . . . . . . . Advanced Printing: Mutt-Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.10 Hooks for Sending, Accounts, and More . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Other Resources and More Information 5.1 5.2 Information and Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other Software with which Mutt Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . .

34 34 35 36 37 37 37 39 41 41 41 41 42 42 43 43 43 44

A Appendix: Patterns B Appendix: Functions available for Macros B.1 Generic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2 The Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.3 The Pager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.4 Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.5 Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.6 The Attach menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.7 The Compose menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.8 The Postpone menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.9 Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.10 PGP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.11 The Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C Appendix: Acknowledgments and License D Appendix: Version History

1 Introduction Why Mutt?


Writing, reading, and sending email is most satisfying when the tools you use facilitate your work. And Mutt will help you do just that. Mutt is a console mail user agent (MUA). It is not graphical, and makes no use of the mouse. Rather, it runs from the command prompt, so you can use it on consoles where the X Window environment is not running, in virtual terminals, and in remote shell sessions. It has no buttons, sliders, or icons: its text based. Mutt doesnt do some things you might be used to, but it does several things you never knew were possible and it does them well. Its lean and mean, and once you learn how to make mutt work for you its hard to use anything else without feeling like the software impedes your efciency. Mutt is efcient and highly-congurable (like most Unix/Linux software, it has more conguration options than youll probably ever use). One mutt user can sit down at another users computer and be unable to do anything useful at all its that congurable. That means this Woodnotes guide will get you started, but you will quickly modify the keystrokes and commands to suit your own environment and make this guide obsolete. No offense taken!

2 USAGE: THE BASICS

Mutt is not the tool of choice for everybody, but if you prefer the keyboard to the mouse, appreciate simplicity but not at the expense of power, and are particular enough about your work environment to choose tools that provide maximum congurability, learning how to use Mutt will make email a lot more fun to deal with. Top reasons to use mutt over another mail client: 1. its fast and efcient, and lets you keep your hands on the keyboard, where they belong. 2. mutt makes maximum use out of your limited screen real estate 3. you can use it with the editor of your choice (emacs, vi, nedit, pico, etc.) 4. you know exactly what you like and therefore appreciate mutts unsurpassed congurability 5. you want fast keystroke access to functionality and therefore appreciate mutts powerful macro capability 6. you grew up in the stone age, like me, and prefer distraction-free, text-based computing Great tricks to do with Mutt: 1. cut to the chase when receiving a message inside a message inside a message (sec. 2.4) 2. automatically fold Word doc attachments right into the text of the message (sec. 3.10) 3. archive hundreds of messages at once in one simple step (sec. 2.8.4) 4. make annoying HTML email look like plain text (sec. 3.8) 5. on a dial-up connection, queue up your mail in a sendmail spool le, which is automatically sent the moment an internet connection is detected without any further interaction needed (sec. 3.4) 6. write powerful macros to make complex tasks into a single keystroke (sec. 4.4) 7. delete just attachments from a message without deleting the whole message (sec. 2.4.2) 8. color code messages in your inbox to indicate their origin, or the address the messages were sent to, and more (sec. 4.2)

2 Usage: The Basics


2.1 Getting Help
First of all, in any screen you may press the ? key to be taken to a help menu listing the current key bindings relative to the task at hand. You can search through this help screen for specic topics of interest to you the way you would when using the vi editor or less: hit the / key to enter your search term, and n and p to cycle through the next and previous occurences of that term throughout the document. Type q to exit the help screen. Once you know how to get help, youll be more tempted to explore, and you should. If your version of mutt has been properly congured, you can type F1 to get to a help le (the man page, actually),

2.2 Reading Messages

but if not, you can type man mutt or man muttrc at a terminal prompt to read the man pages. Other help resources are listed in section 5 of this Woodnotes guide. Assuming little gnomes and trolls have already magically congured your system for you, you can open a virtual terminal window and type mutt to proceed directly to reading your mail; otherwise, skim the next sections and proceed to section 3 to read about conguring your system for mutt.

2.2 Reading Messages


2.2.1 Your Inbox (Index View) As you launch mutt the programs initial view is of the message index, presenting a list of all messages currently in your inbox. Mutt does the best it can with column widths given the size of your screen or virtual terminal, showing you as much as it can of the author and subject elds.

Figure 1: Mutts Index View The rst column shows you the message number, and you can navigate to messages just by typing the number. The second, third, and fourth columns show you the status ags associated with each message, such as N for new mail, T for messages in which you are on the To line, C where youre copied, and so on. See gure 2 below for a complete list. Use the arrow keys or j and k to navigate up and down through the messages, or type the number of the message and press enter to jump straight to it. When the cursor bar is highlighting a message, press return to read it (that is, go to the pager view). When youve nished reading it, press q to return to the index view. As the menu bar at the top of the screen indicates, you can press f to forward a message, r to reply, and m to compose a new message.

6 Flag N O r D d T F C + L s Meaning new message old message message to which youve replied message marked for deletion message with attachments marked for deletion message where you are on the to line message from you message where you are on the cc line message sent only to you message sent to a subscribed mailing list message which has been tagged (see section 2.8.2) message with a PGP signature Figure 2: Message Flags 2.2.2 Sorting and Threading Messages in the Index View

2 USAGE: THE BASICS

By default, the messages in your index view are shown in date order, but you can sort on any number of criteria, including date, sender, recipient, message size, and subject, among others. To sort messages, press o and select your criterion. A capital letter indicates reverse sort, so if you press z for size, the messages will be presented in size order from small to large, but if you press Z they will be sorted from large to small. The most useful view, in my opinion, is the threaded view (press t or T), which groups messages into conversations and manages to keep track even when message subjects change through the course of a conversation. Mutts display of threaded messages is unrivalled in other software and I miss it everywhere else.1 A bit later, well look at limiting the messages you see in this view, which is another powerful way of looking at some of the messages in your inbox (see section 2.8.3). 2.2.3 Reading Messages (Pager View) From the index view, pressing return with the cursor on any message takes you to the pager view for reading that message. There, mutt provides some functions in the pager that can be extremely useful. While reading a message, press h to toggle the Header view, in which all the messages headers are shown, and h again to toggle it back to the view without headers. This is useful when you would like to know something about along which route your message traveled, or which program your correspondent used to compose a message, or (these days) what caused a message to be agged as spam. You can also press T to hide all quoted text from the view. This only works with messages whose quoted portions are preceded by > signs, but in those cases its quite useful. Its a toggle, so press t again to include the quoted text again. While in the pager view, mutt might report that the message arrived with attachments. You can press v to see a folder tree of the attachments, their text labels, and sizes. See section 2.4 for dealing with attachments.
1 Im

told the algorithm that does this is more powerful in mutt than in other software which simply sorts by subject line and date.

2.3 Composing Messages and Saving Drafts (Postponing Messages)

Figure 3: Mutts Pager View 2.2.4 Deleting Messages When you press d in the index or pager views to delete a message mutt will ag it with a D in the index view (it may also reect the deletion using color: my mutt is congured to show deleted messages in red. Well look at the options available to you in sec. 4.2) but doesnt actually delete the message until you either change to a new folder or sync the mailbox to commit the changes. To make the deletion permanent, press the $ key, which is the default command to sync the index with the server and actually deletes all messages agged for deletion. Up until that moment, you still have the option to undelete those messages. Undelete a message by putting the cursor over the desired message and pressing the u key. You can navigate there either by using the message number, or by holding down shift as you type J and K. Otherwise, the cursor will cavalierly jump right over all deleted messages as you navigate.

2.3 Composing Messages and Saving Drafts (Postponing Messages)


Dealing with individual messages is straightforward. The basic commands for dealing with email messages are printed in the menu bar at the top of your console window, and are shown in table 4 below. These commands are available to you either from the index (when you can see all of the contents of your mailbox) or the pager (when youre reading a particular message). Once you press a key to reply to, forward, or compose a message, mutt launches your favorite text editor so you can compose your text2 The text message is created by default in a temporary directory (with a name probably like /tmp/mutt-2502.txt), and you can save the message as you go along. If Mutt ever crashes,
2 Mutt

adheres more strongly than most programs to the Unix philosophy of do one thing only but do it well, and rather than

8 Key d r f s g m Command delete message reply to message forward message save message (group) reply to all (mail) compose new message Figure 4: Mail Commands (Reply, Forward, Etc.)

2 USAGE: THE BASICS

you can often search for the temporary text les in the /tmp directory. When youre ready, save the le one last time and exit your editor. Mutt will take you back to the screen where you can add or modify recipient addresses to the address elds, if you havent already done so. Follow the prompts at the top of the screen (t for the To line, c for the Cc: line, and so on), separating addresses with a comma. If you would like to attach some le to your message, you can do so from this same screen by pressing a. When you have nished writing your message and adding your attachments, pressing y sends the message. If you decide at the last minute to cancel the composition of your message and return to it later, instead of pressing y at this point, press q. Mutt will ask you if youd like to postpone or kill the current message. Postponing it puts the message into a queue of postponed messages saved locally. When you are ready to continue, pressing Control-r will bring up the message and open your editor to begin working on it, or in the case youve got several postponed messages, will bring up an index of them so you can choose which one to continue. Mutt is surprisingly capable of performing much more complicated tasks at this point. For starters, you can press i to spellcheck your message with Ispell (if you havent already done so using your text editor), and by pressing e with the cursor over the temp le, you can re-edit your message. You can rename attachments, and much more. For a taste of what else is possible, press the ? key (press q to exit the help menu when you have nished).

2.4 Attachments
Either from the index or from the pager view, pressing v will take you to a list of all attachments of the message. This might be more informative than you think! For example, many messages come with both plain text and HTML parts (see Figure 5, showing a message sent in both ASCII and HTML and including a picture). You can also take advantage of this to drill down to the heart of messages that have been forwarded and re-forwarded through many senders. Open up the list of attachments, and note which one has the greatest size; put the cursor over it and press enter to read the joke ten people thought so funny they had to forward it to all of their friends. Isnt that easier than mail software that makes you double click on each of the ten messages in turn?
incorporate its own text editor relegates the task to programs better suited to it. As such, because you are guaranteed of being able to use the text editor you like best to write your message. If you havent specied an editor in your conguration le, the system default probably vi or vim will launch. Well cover this conguration in section 3.

2.5 Printing Messages

Figure 5: Mutts Display of the Different Parts of an Email Including Attachments 2.4.1 Forwarding Attachments If you forward a message, odds are the text of the message will not include any attached les, unless you specify so. This is important. If someone sends you, say a picture, and you would like to forward it onto someone else, you must specify the attachment for forwarding. From this menu, put the cursor next to anything youd like to forward and tag it (press t). Then press ;f (note the semicolon) to forward everything thats been tagged. While at rst this might seem like a hassle, once you get used to it you will appreciate the efciency. For bonus points, assuming you too want to forward the message to someone else, clean it up by deleting all those other parts of the message so the next recipient doesnt have to dig. For details, continue reading the next section. 2.4.2 Deleting and Undeleting Attachments Its often convenient to remove an attachment from your inbox but not the message itself. To delete an attachment from a message without deleting the message itself, open a message and then press v to see the list of attachments. Put the cursor over the one youd like to delete and press d. When you return to the index, the index will show a lowercase d next to the message to indicate the change, and when you sync the mailbox by pressing $, the change will be committed (and the index will reect the changed size of the message). This is a good way of reducing the size of mail in your mailbox without having to delete any message text, and once you get used to being able to do this, youll miss it in other software.

2.5 Printing Messages


Mutt hails from the line printer days, so on a Linux or Mac box, the CUPS print server or equivalent should be ready to accept messages sent to the LPR command. You should be able to just press the p key to print a message, assuming your line printer has been set up. The text printed lacks any sort of embellishment, which is ne for most but annoying to some. You can have additional printing functionality by installing A the mutt-print package for your distribution. The mutt-print package uses the L TEX software on your Linux system to make printed email look gorgeous (see sec. 4.9).

2.6 Reading Mail in Other Folders


No one lives out of just their inbox anymore; email users use dozens of folders to separate and store mail of one form or another. Use the c command to change folders, that is to navigate to a different mail folder, and s to save the current message to a different folder. There are only two tricks you need to remember:

10

2 USAGE: THE BASICS

rst, ! refers to your spool le, or inbox, and second, the = key refers to any non-inbox folder. So to change to the Work folder, enter c=Work and hit return. To return to the inbox, hit c! and hit return. Hitting c alone makes mutt prompt you to see a list of folders. At the prompt, hit the ? key to be shown a list of folders. Arrow down through them and hit return to change folders. At just about any time, mutt will try to complete words for you, so you might be able to get away with hitting simply c=W and then pressing tab. If you have no other folders that begin with W the word Work will be completed for you. Likewise, the s key saves the current message to a folder of your choosing. From the index, select the message and hit s=Work to save the current message to the folder called Work. If the folder doesnt already exist mutt will query you if youd like to create it, and will probably suggest a folder name based on that messages senders name unless congured otherwise. Below is a list of the key mail boxes. Key ! + or = < ~ Location Inbox/Spool folder collection (archives) sent mail folder (e.g. =FamilyMail) home directory on local (not remote) system Figure 6: Special Mailboxes

Special case: IMAP Shared Folders: If you are accessing an IMAP server, there may be shared folders. Exhaustive experimentation reveals that you can access a shared IMAP folder called Users/Shared/FunStuff by entering c imap://mail.server.com/Users.Shared.FunStuff. Thats a lot of typing, so save yourself some trouble and bind that expression to a keystroke (see section 4.3).

2.7 Saving Messages to Files


Lets say you want to convert an email message to a text le saved somewhere on your computer. You can do so while retaining the message in your mailbox, or convert it to a text le and remove it from your mail. You can copy it to a text le without removing it from your mailbox by pressing C (capital c, since lower case c is the change directory command). Mutt will ask you copy message to folder? Type the address of where you would like to save the le, for example ~/Desktop/New, or equivalent.3 That le will include the entire set of internet headers that traveled with the message, which is probably more than you wanted. In that case, press esc-C (escape and then capital c) to access the save decoded copy function, which does the same thing but in a more reasonable format. Both of these functions leave the message in your mailbox. If you want to simultaneously remove the message from your inbox, use esc-s (escape, followed by a lower case s) for decode save, which will remove the message from your inbox once its created the text le for you. I nd this very useful for archiving individual messages.
3 Note that the variable mbox_type determines whether a text le will be created in that location or an annoying maildir style folder hierarchy. If you get folders, type :set mbox_type=mbox and then try again.

2.8 Operating on Multiple Messages

11

2.8 Operating on Multiple Messages


2.8.1 Selection Patterns This is where mutt starts getting powerful: lots of operations can affect many messages at once. You can tag a group of messages (see section 2.8.2 below) and do something to them (delete them, move them, print them), or you can limit the number of messages shown in the index view (see section 2.8.3 below) by providing criteria for what youd like to show. Both of these require an understanding of selection patterns. A brief description of patterns follows, and a complete list can be found in section A at the end of this document. If theyre confusing, dont use them, but if you can get the hang of using patterns you can do lots of interesting things that will speed up your emailing. Two of these tricks are group actions on a set of email (you tag them and then do what you want with them), and limiting the messages shown to you in the index based on some sort of criteria. These are both described in the next two sections. But rst, here are a couple of simple ones. Limiter ~t ~f ~c ~U ~R ~N ~O ~b ~B Limits messages shown to: mail sent TO mail sent FROM mail cc:ed TO unread messages read messages new messages old messages messages that contain a certain expression in the body messages that contain a certain expression in any header or the body Figure 7: Simple Patterns You can use multiple criteria by separating them with a space, like this. For example, the following selects all messages that were sent by someone with Wood in the address eld AND that were sent within the last two weeks: ~f Wood ~d<2w and the following would select any message that is both new and from Ericka: ~N ~f Ericka The logical OR is indicated with the pipe symbol, so the following would select anything with the word viagra or OEM in the subject line (e.g., for deletion): l viagra|OEM and the following would select all messages from Wood or Feldman or Dordyke: ~f Wood|~f Feldman|~f Dordyke Watch out for spaces after the pipe symbol, which will interfere with your expression.

12

2 USAGE: THE BASICS

2.8.2 Tagging and Flags To operate on many messages at a time you need to tag them rst, then choose your command. Use the t key to tag messages. Its a toggle, so hit t again to untag them. Once youve selected the messages youd like to operate on, preface your command with a semicolon to indicate the command should be applied to all tagged messages. For example, the command ;s=Nicaragua will save all tagged messages to the mail folder by the name of Nicaragua and ;d will delete them. You can tag messages individually if you like, but its faster to use a pattern to select them. Shift-T tags messages that match a pattern, and control-T untags messages that match a pattern. Escape-T will tag a whole thread, if youve chosen to display your messages based on threads. Once youve tagged a group of messages, you can do anything you want to them. For example, you can even tag several messages and hit r for reply and mutt will combine the text of all those messages into a single message and, once youve composed your message text, send it to the authors of each of those messages. This is useful if you correspond with a person who sends you 6 separate emails about 6 separate topics. 2.8.3 Limiting Messages Shown Limiting is another way that patterns increase your efciency. More often than not, youve got too much mail in your box to deal with. Limiting how much of it you see is convenient and helpful, and only a keystroke away. The l command (lower case L) limits the messages shown in the index. It doesnt delete anything, it just limits which messages are presented in the index according to your criteria, which you can specify using regular expressions or certain keys. For example, hit l and then type the word proje and hit return. Of all the messages in the index, only those that have the expression proje somewhere in the subject or address elds will be shown. To remove the limitation, hit l. (thats L followed by a period), which shows messages that contain any character at all, that is, every message. See section 7 for a complete list of patterns. For example, to limit by date, l ~d>2w to limit the index to all messages whose received date (~d) is greater than two weeks (>2w), or set l ~N to see only messages that have been agged new. If you forget what your criteria for limiting was, or would just like to conrm whether or not you are limiting them, pressing Esc-L will reveal in the status bar what the current limiter is. The ~d sequence limits messages based on date criteria. This is highly useful. An example is worth a thousand words, so let the following serve as guides: Limiter l ~d 20/1/05-31/10 l ~d<1d l ~d 15/1/2001*2w Limits messages to: all messages whose date is between 20 Jan 1995 and 31 Oct of the current year all messages less than one day old, that is, all messages received today all messages plus or minus two weeks from 15 Jan 2001 Figure 8: Criteria for Working with Dates

2.8.4 Using Patterns to Archive Groups of Messages By tagging groups of messages and saving them to off-line folders you can easily archive in a format that remains readable rather than some mysterious binary format. The format of that le will either be a mailbox

2.9 Using the Address Book

13

(i.e., a single, at le), a maildir like those on IMAP systems, depending on the default for your system (see sec. 3.7 on how to set this variable). I like to use tags to gather messages by date range and archive them to a at le, then zip the le to save space on my hard drive. When I want to read through archives I can do so by starting mutt from the -f command. First tag the messages, using T ~d>30d, which will tag all messages greater than 30 days old. THen save them to a le called sept-2006 using the command ;s=~/Documents/Mailarchives/sept-2006 To read the messages in that archive, treat it like a mailbox and read it using mutt -f ~/Documents/ Mailarchives/ sept-2006.

2.9 Using the Address Book


Mutt allows you to determine who youd like to send the message to either before or after launching your text editor to compose the message. You are free to type in the entire email address, of course, but that isnt very effective. To access the addresses you have stored in your mutt address book, simply hit the tab key at any point where an address is requested of you. If you type a couple of letters before hitting tab, mutt will limit the entries in the address book to those that match (eri will match Ericka, Erico, Erik, Erin, and so on). Navigate to the address you want or hit the forward slash key to search for one, and press Return to have that address be added to the list. You can select multiple addresses using the space bar. While looking at the message index you can view the senders email address by pressing the @ key. On the status line at the bottom of the screen you should see the senders complete email address. Hit a to add that sender to your address book. You will be asked to conrm the name and email address of the sender (which is a great time to modify it for your own purposes if youd like to do so). In the context of more complicated programs that integrate the address book with other software (like instant messaging clients: Kontact/Kmail/Kopete on Linux and Addressbook/Ichat/Mail on Apple Mac OS X), the rudimentary mutt address book is somewhat of a disappointment. It is simply a text le containing a list of names and email addresses organized by aliases (nicknames) that you assign them. Each entry, one per line looks like this: alias randall_wood Randall Wood <rwood@therandymon.com> alias dogcito Dogcito and Oso <dogcito@zafiro.com> You can add additional entries as described above, edit the text le directly any way you like, or try integrating an add-on address book with a bit more functionality. In section 3.5 Ill discuss how to congure the mutt address book, and in 3.5.2 below Ill discuss how to interface with more powerful address book components.

3 Conguring Mutt
3.1 Basic Conguration
Mutt is a mail user agent (MUA), and makes no effort to provide native ability to download, upload, or compose messages, relinquishing responsibility for those tasks to programs better suited to the job. Neither

14

3 CONFIGURING MUTT

does it deal with HTML mail, attachments, or help you click on a URL in the text to be taken to the relevant web page. Rather, mutt interfaces with lots of other programs that already perform these tasks admirably. This means to use mutt you have to congure several different programs, including sendmail or equivalent for uploading (sending), fetchmail for downloading (assuming you have a POP3 account rather than IMAP), the lynx text browser for viewing HTML messages, and urlview for dealing with URLs in mail. In general, you will need the following conguration les on your system: .muttrc Denes all settings for Mutt itself .mailcap Tells mutt which software to associate with different attachments .fetchmailrc For downloading mail from a POP3 server, if thats how you are connecting a mail spool le probably /var/mail/spool/$USERNAME an alias le of your choosing, such as .mutt-alias. This is your address book The spool le is where mutt expects to nd mail thats been downloaded from your ISP (i.e. your inbox). Youll also want to choose and congure your favorite text editor. Unix and Linux systems come with several text editors already installed, so its just a matter of your choosing which one you like. Mutt also requires an address book called an alias le, and will help you develop one as you go through your mail, if you like. More on each of these things below. Your .muttrc le is a conguration le that should be stored in your home directory. If you dont have one in your home directory mutt will utilize the system-wide conguration le at /etc/Muttrc (note the capital M). You can copy that le to your home directory, calling it .muttrc (note the period; its a dot-le). This is the le you will modify to set up mutt to your liking. Alternatively, you can start a new .muttrc le using the text editor of your choice using the code in this document as a base. The .muttrc le contains code that determines mutts keybindings (which keys perform which function), code that determines what mutt looks like, including colors, and code that determines how mutt behaves. First of all, the hash mark (#) is interpreted as a comment sign, so any text after a hash mark is ignored when mutt processes its les. If you want to try a test .muttrc you can name it something different and start mutt from the command line with mutt -F TESTFILE to use it in place of your .muttrc. However, you can also test out commands one by one once mutt is running, by pressing the colon sign and entering the command. You wouldnt want to do that for large sets of commands, obviously, but if you simply want to try something both ways, you can do so in this way. Still another way is to get mutt started, then make edits to your .muttrc le, and have mutt reload the conguration le by entering :source .muttrc. This is my favorite way of testing congurations as I go.

3.2 Setting Up Your Mail Accounts


Unless stated otherwise, all these conguration statements go in your .muttrc conguration le. No matter what your email set-up, you will need to set the variables mailboxes, spoolfile, and folders to tell Mutt where to nd your mail account, inbox, and folders. You will probably also need to set record to choose where to store copies of your sent messages.

3.2 Setting Up Your Mail Accounts

15

3.2.1 Downloading from a server (POP3) Getting your mail: In this scenario, your ISP has provided you with a mailbox, and you download its contents and deal with your mail ofine. If this is your situation, mutt expects to nd your mail waiting for you on your system at the location /var/spool/mail/USERNAME, and you will use Fetchmail to retrieve it from the server. First, Fetchmail: Fetchmail is included on all Linux distributions worth their salt these days. In your home directory you should create a dot le (conguration le) by the name of .fetchmailrc. In it, provide your download information. Fetchmail is well documented, so either start with your systems sample fetchmail le (/etc/fetchmailrc) or read the man page for fetchmail to get an idea of all the things fetchmail is capable of. For any POP3 account Ive ever had, all Ive needed has been something like the following. Replace the UPPERCASE terms with your own information; USERNAME is the name by which your ISP knows you; LOCALUSERNAME is the name by which you log onto your Linux box. poll MAIL.MYISP.COM with protocol pop3 user USERNAME with pass PASSWORD is LOCALUSERNAME here; To get your mail, open up a terminal and download it by entering the command fetchmail. Some distros like SUSE set up your machine so your mail is automatically downloaded every time you establish an internet connection. When you sit down at your computer you can open up a terminal and rst run fetchmail, then run mutt. Or you can start with mutt, and run fetchmail by entering ! fetchmail. The exclamation point is the mechanism for getting to a shell from within mutt. After ! you could easily input any shell command you like (less, sort, ls, vim, etc.) Now, mutt: If your log-in name on your system is randymon, mutt expects to nd a text le with appropriate permissions (that is, user can read and write) at /var/spool/mail/randymon. If that le doesnt exist, root will have to create it for you. Remember, its a le, not a directory, so you can create it with the touch command and then set the permissions using chmod. mailboxes /var/spool/mail/randymon set spoolfile=/var/spool/mail/randymon set folder="$HOME/Mail" set record="$HOME/Mail/Sent"

Sending your mail: If youre working ofine, you will probably be using Sendmail or Postx as a mail transfer agent (MTA), or something equivalent, and your Linux box will send off the queued mail whenever you connect. See section 3.3 for other options.

3.2.2 Accessing your Mail at the Server (IMAP) Getting your mail: If you use IMAP, your mail never gets downloaded. There are lots of advantages to this method. Use something like the following in your .muttrc

16

3 CONFIGURING MUTT

mailboxes imap://myfirstisp.com set folder="imap://myfirstisp.com/INBOX" set imap_user="myusername" #your IMAP user name or login set imap_pass="password" #your IMAP password If you are uncomfortable about having your IMAP password stored in plain text, set the permissions for .muttrc using the chmod command so only you can read and write to the le, no one else. In this same section of your .muttrc, show mutt where to nd your IMAP inbox. This is sometimes not apparent, even when youve specied where to nd your mail. set spoolfile="imap://myfirstisp.com" Header Caching: Mutt suffers from one of IMAPs deciencies: every time you enter a new IMAP folder Mutt has to reread the contents of the entire folder in order to present you with the index. For folders with a lot of messages, or any folder if youre working over a slow connection, that can be the source of a very lengthy pause. Caching the headers takes care of the problem, by providing mutt with a mechanism for storing the headers locally; mutt then only needs to compare the contents of your IMAP folder with the local cache, and react accordingly. For most IMAP users, this is a huge improvement. Prior to about 2008, header caching was a patch you had to compile in yourself. These days, its standard (it came automatically with my SUSE 9.2 distro). The header cache can take two forms: a folder of les, or a single le. If .muttheadercache (or whatever you call it) is a le, your cache will be a single le. I prefer it to be a folder of les, so simply mkdir .mutt-headercache to do so. Make it a dot le so you dont have to look at it every day in my home folder. Once youve created a home for the cache, simply tell mutt where to nd it, as follows: set header_cache=/home/randymon/.mutt-headercache Sending your mail: Again, youll either be using Sendmail or an equivalent, to send email. But here, Mutts internal SMTP capability is also available to you, since you will have a live Internet connection while youre working. The trick in this scenariois to ensure youve congured your Sent Mail folder correctly so that all your sent messages are registered on the server instead of simply being saved locally. See section 3.3. 3.2.3 Ofine IMAP Getting your mail: From a users point of view, Mac OSXs Mail program got it right: your IMAP account is cached locally, and updates changes whenever you connect. It does away with Im not connected to the Net so I cant access my old mail and basically allows the user not to care what kind of mail account hes using. Mutt users can now do the same. Ofineimap is a package of Python scripts that replicates your entire IMAP account locally, sub-folders and all. The rst time you sync, it can take some time, but afterwards the program runs quickly, and you can even set it to run in the background. First, download and install ofineimap. It requires a somewhat modern version of Python. Next, give ofineimap a place to store its local cache (this will turn into a gigabyte- or greater-sized directory, so choose

3.3 Sending Mail: Sendmail and Friends

17

carefully): mkdir .mailcache. The man page will walk you through the next steps, but essentially, you need only to declare the parameters for the local and IMAP accounts, and then execute the program periodically. Heres a sample ofineimap conguration: [general] accounts = personalmail [Account personalmail] localrepository = local remoterepository = remote [Repository local] type = Maildir localfolders = ~/.mailcache sep = / [Repository remote] type = IMAP remotehost = MYISP.WHATEVER.NET remoteuser = MYLOGINNAME ssl = yes remotepass = MYPASSWORD Finally, since you will now be accessing not your IMAP account but the local, replicated repository, your .muttrc should point to it as follows: set folder=$HOME/.mailcache/INBOX/ set spoolfile=$HOME/.mailcache/INBOX set record="=Sent" # or whatever your sent mailbox is called

Sending your mail: You have two options: one is to use the sendmail installed on your system, having congured it for ofine mode (mail is queued locally, and sent only when your machine detects a network connection). Your second option is to use putmail.py-queue, a partner script to putmail. Putmail.py-queue stores outgoing mail in a folder, and then sends it to putmail one by one when you instruct it to dequeue. In that case, you would use set sendmail=/usr/local/bin/putmail_enqueue.py in your .muttrc. When you get a net connection, run putmail_dequeue.py to send out all the stored mail youve accumulated.

3.3 Sending Mail: Sendmail and Friends


Sendmail: Before version 1.5.17, you were required to congure a mail transport agent, like sendmail. For old times sake, and for those using older versions of mutt, this is how to do so. Provided sendmail, postx, qmail, or another SMTP mail sending program has been installed and congured on your system, simply tell

18

3 CONFIGURING MUTT

mutt where to nd the sendmail program. In most cases, sendmail is located at /usr/sbin/sendmail, so the following line should sufce. Postx even provides a simlink at that location to deal with mail programs expecting to nd sendmail there. So once you know where to nd sendmail, put a line in your .muttrc le that tells mutt where to hand off written mail for sending, as follows: set sendmail=/usr/sbin/sendmail However, installing and conguring Postx or Sendmail is not fun in an age when any self-respecting ISP requires authentication to stem the spamood, so choosing a distribution that does this for you, like SUSE, will take a lot of pain out the process (Ubuntu users, you are out of luck, change distros or learn how to congure sendmail). If youre just a casual emailer instead of a systems administrator, and just need a simple and easy way to get your mail to your ISP, perhaps a full-blown Postx conguration is overkill. There are several alternatives created for the likes of mutt users who just need an easy way to send mail to their ISP, and nothing fancier than that. Mutts own SMTP: Starting with version 1.5.17, mutt now miracle of miracles has the capability of sending your messages without the need for another program like sendmail. This goes essentially against the mutt philosophy, but was requested by enough users that the decision was made to include SMTP capability. To take advantage of this, in your muttrc le you would add your log in information in the following format: set smtp_url="smtp[s]://[user[:pass]@]host[:port]/" Lets say you have a mail account whose SMTP address is outmail.mailhost.com, where you log in using the name squeaker with password bear. set smtp_url="smtp://squeaker:bear@outmail.mailhost.com" SSMTP: The rst is ssmtp (simple SMTP),a package that allows you to send mail via the SMTP protocol to your ISP, authenticating with a username and password. For most people, thats all you need to do anyway, and choosing this option simplies the process of installing mail transport agents that were really intended to go on servers and handle immense volumes of mail, spam, and bounces every day. If thats the mechanism you choose, your .muttrc le should look like this: set sendmail="/usr/sbin/ssmtp -audUserName@domain -apSecretPassword" Putmail.py: Just as easy, if not easier, is Putmail.py, a tiny python script that provides a dead simple interface for sending mail. Its a simple 13 KB download and an even simpler 5 line conguration le, and you are up and running. Once it is working you can even congure other software to use it, such as the slrn newsreader. This is now my preferred conguration on the Macintosh, which lacks easy postx conguration utilities, while on SUSE I stick with YaST2 and Postx.4 There are two packages: putmail.py and putmail-queue.py. The latter allows you to build up a queue of outgoing mail while youre ofine, then send it all at once. A putmail.py conguration le is as simple as the following. In most cases, your email address and username should be the same:
4 Thanks to Kevin Neely for convincing me to take another look at Putmail.py. It so impressed me Im taking a much harder look at Python in general!

3.4 Your Sent Mail box

19

[config] server = OUTGOING.MAIL.SERVER email = YOUR@FROMMAIL.ADDRESS password = PASS username = USERNAME@FROMMAIL.ADDRESS Others: There are several other light SMTP agents that do what the ssmtp program does, including esmtp, msmtp, nullmailer, and others. See the Mutt Wiki for a complete list (see section 5). Otherwise, welcome to the wonderful world of conguring mail transfer agents. That task is beyond the scope of this guide. The most useful resource for conguring postx for the purposes of a mutt user (that is, you just need it to send mail to your ISP) is entitled Postx State of Mind. See the Appendices for its URL.

3.4 Your Sent Mail box


This depends a lot on whether you will be mostly working online (IMAP) or ofine. If you are working ofine (downloading via POP3 or equivalent), the following is good enough: set copy=yes #keep copies of outgoing mail. set record="/home/randymon/Mail/sent-mail " #This is for locally stored mail If youre using IMAP, then you should store your sent messages on the server, as follows: set record="=Sent Items" #This is for the Sent Items folder on an IMAP account. # Note the equals sign, which makes it clear # this a subdirectory of the inbox. And if youre using ofineimap, you can store your sent messages in the local Sent Mail repository, and will sync up to the IMAP server when ofineimap runs. Use set copy=yes #keep copies of outgoing mail. set record="/home/randymon/.mailcache/INBOX/Sent" Lastly, an advanced trick: you can specify which folder to use on a per-message basis using send-hooks (see section 4.10).

3.5 Conguring Your Address Book


3.5.1 Alias File This is the simplest conguration, and the default. Out of the box, Mutt stores your email addresses in any le of your choosing in the following format:

20

3 CONFIGURING MUTT

alias linux_lover Linux Lover

<linuxlover@yahoo.com>

where linux_lover is an alias you choose for the address, the next couple of words are the persons real name, and everything between brackets is the email address. We source that le (identify it as a le to be read into memory when using mutt to make it available by identifying it as our alias le (again, if it doesnt exist, youll have to create it yourself rst). set alias_file="~/.muttalias" And heres a neat trick: we set reverse_alias so that any mail sent to us by a person in our address book is shown using the name in our address book, not the name their mail goes out with. That is, if our correspondent is really an idiot, our alias can read alias Idiot Firstname Lastname <coworker@myworkplace.com>

and our mailbox will show mail from that person as coming from the name Idiot. A better use of this trick is to deal with people whose names arent easy understandable, like x36gd9o_33a@hotmail.com. And no, the other person will not know youve labeled him Idiot, it simply changes the display of his name in your mailbox, not in your messages. set reverse_alias #use names from my own address book, if they exist There are more sophisticated ways to manage your address book, by using external programs like abook. See section 3.5.2 for details. If youd like more functionality in your address book without leaving the console, think about helping mutt interface with something more powerful. There are several small console-based address books with which mutt is able to interface, but unfortunately no real way to interface with something truly powerful like Apples Addressbook or Kmails KAddressbook.

3.5.2 Abook Abook is a simple console address book that stores all your information in text les and interfaces well with mutt. Written by Jaakko Heinonen, it is undergoing active development as of September 2006. Abook is easy to congure and use. It does not, however, understand the vcard standard le format: this is its most serious limitation. Also, in earlier versions, abook ran parallel to your alias le and you had to manually syncronize them every so often, which was not very convenient; fortunately, that has been dealt with, and these days, for a decent address book and an easy interface with mutt, abook is hard to beat. To use abook, rst download and install it (see section 5.2 for the link), and get familiar with how it works by running it from a console. Its pretty straightforward, and you can either type in a couple of addresses to practice with or import your mutt alias le. Now that youve got some addresses to work with, integrate it with mutt. The rst step is to remove the links to the mutt alias le, so assuming you called your alias le .mutt-alias, make sure to remove the following two lines from your .muttrc:

3.5 Conguring Your Address Book

21

set alias_file=".mutt-alias" source .mutt-alias And now add the following two lines in their place: set query_command= "abook --mutt-query %s" macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook" The rst line sets up the link to abook for extracting addresses from your addressbook, and the second one creates a macro so that when you press A just about anywhere, the email address of that messages sender will be sent to abook. Lastly, get used to using "query" functionality instead of alias functionality, as mutt treats them differently. Lets say you start a new message by pressing m in the index view. Mutt presents you with "To: " and waits for you to enter the address of your recipient. Normally youd press tab at this point for a quick search of the aliases in your alias le. Instead, now you press Control-T in order to do the same thing, but via a query to abook instead of your alias le. Put the cursor over the person youd like to write and press enter to start the message. If youd like to several people from the abook, tag them using the t key and then press ;m to have them all placed on the "To:" line of your message. You can add additional queries to the same line by pressing A. For example, type Control-t to start a query, "Do" to search for names that start with "Do." You select a few by pressing t and then press A to search for additional names using a different criteria. Press "Ri" to search for names that start with "Ri" and select them in the same way. When youve tagged everyone youd like to mail, press ";m" to send all those addresses to the "To: " line. Repeat this process for the "Cc: " line and so on. Some people like to use the abook and the alias le in parallel, keeping good/important addresses in the abook and using the alias le to collect addresses from mail they read. This is a bit inelegant since it forces you to manually synchronize from time to time, but has its advantages, since, for one, the alias le allows you to include a mailing list composed of other names present in the alias le, while abook does not. Nothing is simple, but take a look at http://wolfermann.org/abook-autoexport for one way of doing so.

3.5.3 Querying an LDAP Server Mutts query command (Q, pressed at any prompt, or control-T after youve input a couple of characters to search for) is powerful and impressive. To query an LDAP server, rst download the mutt-ldap.pl script (nd a link to it at the mutt wiki) and save it to someplace where you can execute les (I saved it to ~/bin). You need to update just four lines in the perl script, and you are good to go. Increasingly, this is how I deal with addresses.5
5 Of course, since its just an executable perl script, you can call it from the command line at any time. From the command prompt, just enter mutt-ldap.pl hoozit to search your LDAP server for a user named hoozit.

22

3 CONFIGURING MUTT

3.5.4 The Little Brother Database You can get the Little Brother Database (lbdb) from its sourceforge site (see 5). Set mutt to query the LBDB for addresses by adding the following to your muttrc: set query_command="lbdb %s" The LBDB can query different sources of information to manage your addresses. See the Marks Mutt Fan and Tip Page (Resources) for more information on how to congure the LBDB with mutt. In particular, the LBDB is a useful way for Mac users to get Mutt to interface with the Apple Addressbook that comes standard on Mac OS X. Vincent Danen does a tremendously good job at describing not just how to get this link to happen but also how to set up and use Mutt on Mac OS X in general. His website is listed in the Resources section of this guide. 3.5.5 Rolo Addressbook The Rolo Address book purports to do what Abook does, but using the vcard standard. I havent used it so I cant say, but working with vcards is an important step toward being able to import and export addressbooks from other software packages. See the references in section 5 for the source of this software.

3.6 Choosing an Editor


Mutt doesnt come with its own facility for writing email because on Unix/Linux systems (etc.) more good quality text editors are available than you could ever hope for. So its just a matter of choosing whichever one you like the best. Then, whenever you go to write a new email, mutt will launch your editor for you. When you exit the editor, that text will be transfered to mutt and incorporated into your email ready to send. Which editor you choose is a personal decision. Set it with the command set editor= and enjoy. The following lines are some samples; note four of them have been commented out leaving emacs -nw as my editor of choice. When I get sick of emacs, I just comment out that line and uncomment another one, and Im ready to go. I tend to mostly switch between emacs and jed, as jed is a little faster and lighter-weight, but emacs is more feature rich. Again, its personal. A nal note: the editors I use tend to be console based, so no external windows are launched and I can work as easily at a virtual console as I can in an xterm window. If you dont use the console and live in the XWindow environment, you can launch a GUI editor like emacs, xemacs, nedit, kate, kwrite, gedit, and so on just as simply, paying only the price of a slightly slower launch time. To set your editor, choose one of the lines below and remove the hash mark at the beginning, leaving the other lines as comments: # set editor="vim +:set textwidth=77 +:set wrap" #use vim with wordwrap at 77 set editor="emacs -nw" # set editor="joe" # set editor="jed" # set editor="pico"

3.7 General Settings

23

3.7 General Settings


In this section of the .muttrc le we establish a couple of general things. set charset determines which character set your terminal is using. In many cases its not important, but if your display is showing funny characters in place of accented characters like or or even the little arrows that show where the messages have been threaded, this is how you can deal with it. unset beep disables annoying beeps. conrmappend is a setting that has mutt ask you every time you save messages to a given folder, and use domain is an option that adds the local domain name to any email sent to an address without an @ sign (so if you send a message to jeremy, not jeremy@sample.com mutt will change the name to jeremy@localhost). Thats not usually useful, so I usually unset it. Turning off the recall function prevents mutt from asking you at the start of every session if youd like to resume a postponed message (provided postponed messages exist, of course). Since I infrequently start messages I dont nish, I turn off that attribute. And you can always resume postponed messages any time you want by pressing Control-r in mutt. Finally, push <show-version> simply tells mutt to display its version number upon start up, just for fun. # Starting up, General Settings set charset=UTF8 #depending on our environment it could be ISO-8859-1 (Western Latin) set mailbox_type=maildir #default mailbox format (could be maildir, mbox or several others) unset beep #dont need no beeping software set print_command="lpr -p" #Send your message to the line printer. If youve added the mutt-print #package, use the following line instead: set print_command="mutt-print %s" unset confirmappend #append what? unset use_domain set recall=no #dont resume postponed messages push <show-version> #get Mutt to show its version on startup set quit=ask-yes #Ask before quitting, but default to yes set nomove #keep messages in MAIL, dont ask about moving them anywhere when quitting

24

3 CONFIGURING MUTT

unset mark_old #dont mark messages as old when I pass over them with the cursor These are just several of the hundreds of conguration parameters over which mutt gives you control. This is what people mean when they say mutt is highly congurable. For more settings and a glimpse of what your options are, read the muttrc man page or mutts online documentation (see sec. 5 for the URL). Now lets look at the settings that affect our general interaction with mutt. The following lines of code establish my name and email address. set include gives you the opportunity of automatically stripping out the message youre replying to in the text of your email. Mutt can also by default hide the Cc and Bcc lines of the address if you dont typically use them. I dont BCC anybody, so in my .muttrc I have unset that option, leaving only ccs. unset self is a great feature I wish other email clients would implement. When replying to a group email, mutt is smart enough to recognize and remove your address from the list of recipients so you dont accidentally send yourself the message. The following two lines deal with attribution of replies and forwarded messages. You could change this so that in an email reply, underneath your text it reads On July 4, 2005, you vomited up the following nonsense: or equivalent. # Composing Messages set from="Randall Wood <my_email@address.com>" #My name and email address as shown in other peoples inboxes set include=yes #include message in replies set askcc #include a cc: line on which to add recipients # set askbcc #include a bcc: line set fcc_attach #forward attachments unset reply_self #dont include myself when replying to a group set attribution="On %d, %n wrote:" set forward_format="Fwd: %s" set indent_str="> " #indented text prefaced by this string. set postpone=ask-no #default for postponing a message is to confirm, default to no set tilde

3.8 Dealing with HTML Messages


Lets start with HTML. Mutt alone doesnt handle HTML text on its own, but since the console web browser lynx does, we can leverage its power to lter out the HTML markup and present it to us in text format. This is extremely useful. To do this, as well as deal with other attachments, we need to create a .mailcap le in our

3.9 Dealing with Attachments

25

home directory that lists possible MIME types (attachment types) and how to deal with them. Your .mailcap le is a simple text le and may already exist in your home directory, depending on your distribution. If it does exist, simply add the following line: text/html; lynx -dump -force_html %s; needsterminal; copiousoutput

Once your .mailcap tells mutt how to process HTML les, you must tell mutt to rst source the .mailcap, and second to process the HTML and present it inline, instead of treating it as an attachment to be shown separately. This takes away the HTML mystery of your friends who insist on using hotmail: mutt will lter out the text and simply present it without the formatting. If you respond to or forward the message, the text will remain and the formatting will be permanently removed. People who tend to gravitate towards console email clients tend to like this ability to strip out all extraneous formatting that makes email large and unwieldy. Once youve modied the .mailcap le, add the following lines to your .muttrc: set implicit_autoview auto_view text/html application/x-pgp-message set mailcap_path="~/.mailcap" The rst line tells mutt to automatically show everything it knows how to show without being prompted, the second line tells mutt which types of les to show as part of the body text, and the third line tells mutt where to nd the mailcap.

3.9 Dealing with Attachments


The mailcap is the place to indicate to mutt (and other programs, incidentally; such is Unix) how to interface with other programs to process attachments. Images are an important one to get right. Add something like the following in order to process PDFs and graphics images.: application/pdf; acroread %s image/jpeg; xv %s image/gif; xv %s & image/GIF; xv %s & image/JPG; xv %s & image/jpg; xv %s & Above, Im using the program xv to deal with graphics, because its super fast relative to the KDE and Gnome equivalents and SUSE provides it. But its not included on a lot of distributions (including anything based on Debian) because of licensing concerns, so you can substitute kview, gwenview, eog (Eye of Gnome), or something else for xv.

3.10 Dealing with Word Doc Attachments


The most important one to include is also the one that can make mutt so much more useful than other mail clients: an interface with antiword. This is a program that reads Microsoft Word documents and translates

26

4 ADVANCED CUSTOMIZATION

them to plain text. Its highly useful on its own as a document tool, but combined with mutt it becomes more powerful still. Assuming you have installed antiword on your machine, add the following to your mailcap le: application/msword; antiword %s ; copiousoutput And Word doc text will be displayed inline. This is an extraordinarily useful trick! If your distribution doesnt include antiword, try the application wvText instead, which works just as well. This doesnt solve all your problems, but should solve many of them. Some broken webmail email applications dont label MIME types appropriately, which will hinder Mutts ability to appropriately determine which application to use to open the le.

3.11 Dealing with URLs in Messages


Many messages have URLs embedded in the text. Urlview is the right tool to deal with them. You can congure it to launch a graphical browser like Firefox, Opera, or Konqueror if you have the X Window system running and launch lynx or links if you dont. Fortunately its easy for urlview to distinguish whether or not youre using X and proceed smoothly from there. First, install urlview. Second, add the following lines to your .muttrc: macro index \cb |urlview\n call urlview to extract URLs out of a message The macro above sets the key binding control-B to launch urlview (more about macros in section 4.4). Try it once and youll see how nice a system it is.

4 Advanced Customization
4.1 Using Mutt with different congurations
If you wind up using mutt sometimes with IMAP and sometimes with ofineimap, or once for your home account and once for your work account, you will need different congurations. My simple solution is simply to use different .muttrc les, and create aliases to run them. For example, create .mutt-home, .muttschool, and .mutt-home-ofine les. Then in your .bashrc le, create aliases, so that homemutt becomes a command that runs mutt -F .mutt-home. In your .bashrc, that would be alias homemutt=mutt -F .mutt-home. Do the same for your other congurations.

4.2 Conguring Colors


Colors are available to you in terminals that support them, including most Linux virtual terminals, and many terminals for the X Window system like xterm, aterm, and so on. You may want different color schemes for different circumstances though: xterms are black-on-white unless you specify otherwise, but virtual

4.2 Conguring Colors

27

consoles are white on black. In addition, aterm, gnome-terminal, and konsole are all terminal emulators capable of using transparency and background images, both of which are very pleasant effects. So instead of committing yourself to colors in your .muttrc le its better to put groups of colors in additional les and source them as necessary. For example, create .mutt-clear, which will be the color conguration when you use mutt in a transparent terminal, .mutt-white for black on white scenarios, and .mutt-black for white on black scenarios. Then once mutt is running you can source the one you would like to use by entering: : source ~/.mutt-clear Note the colon at the beginning of the line, which indicates to mutt youd like to enter a command. Alternately, you can simply source the le in your .muttrc le by adding that line to your .muttrc. Color works as follows: You indicate which object youd like to dene a color for and its foreground and background colors, plus a regular expression if the color is to be conditional (for example, to provide color for text that looks like an email address). You can remove a color with the uncolor command, something Ive never had ocassion to do. The following three lines are examples of the format, and you can then choose an object from chart 9 and a color from the following list: white, black, green, magenta, blue, cyan, yellow, red, default, colorx. The foreground color can also be prexed with the keyword bright to make the foreground color boldfaced (e.g., brightred). If you run mutt in a clear terminal, make sure to choose default as your background color in order to preserve the transparency. color object foreground background [ regexp ] color index foreground background pattern uncolor index pattern [ pattern ... ] As usual, an example is worth its weight in gold. The following are my color selections, including some that I copied from the defaults that come along with the Debian package for mutt. In general, this provides a black background, white text, attachment labels in yellow, quoted text in green, and deleted messages in red. In addition, email addresses and URLs are highlighted in bright colors in the message body. color color color color color color color color color color normal white black attachment brightyellow black hdrdefault cyan black indicator black cyan markers brightred black quoted green black signature cyan black status brightgreen blue tilde blue black tree red black

color index red black ~D color index magenta black ~T #color header brightgreen black ^From: #color header brightcyan black ^To:

28 Name attachment body bold error header hdrdefault index indicator markers message normal quoted quoted1 . . . quotedN search signature status tilde tree underline

4 ADVANCED CUSTOMIZATION
Description any attachments present match regexp in the body of messages highlighting bold patterns in the body of messages error messages printed by Mutt match regexp in the message header default color of the message header in the pager match pattern in the message index arrow or bar used to indicate the current item in a menu the + markers at the beginning of wrapped lines in the pager informational messages normal (not quoted) text text matching $quote_regexp in the body of a message higher levels of quoting highlighting of words in the pager any text beneath the signature line mode lines used to display info about the mailbox or message the ~ used to pad blank lines in the pager thread tree drawn in the message index and attachment menu hiliting underlined patterns in the body of messages Figure 9: Parts (Objects) of Messages that can be Highlighted

#color header brightcyan black ^Reply-To: #color header brightcyan black ^Cc: #color header brightblue black ^Subject: color body brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # identifies email addresses color body brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # identifies URLs Heres one way to make it useful. Lets say you receive mail at both penguin@iceberg.net and penguin@school.edu, and the latter account simply forwards all received mail to your iceberg.net account. You can different between the two types of mail in your inbox by including in your .muttrc color index green default C penguin. Any mail where the word penguin appears in the to: or CC: lines will be shown as green.

4.3 Rebinding Keyboard Shortcuts


By binding keys to certain functions you can add shortcuts to maneuvering through your message list. For example, j and k are congured out of the box as up and down keys for moving around in the index. But you can just as easily bind them to something else if you like (for example if you use a non-standard

4.3 Rebinding Keyboard Shortcuts

29

keyboard layout like Dvorak). The bind command allows you to congure mutt the way you like to work. The command takes the following form: bind map key function. Maps can be one of the following: generic, alias, attach, browser, editor, index, compose, pager, pgp, and postpone, and determines in which context the key is to be bound, i.e. when you are maneuvering around the index, when you are in the pager, when you are searching for an alias in your address book, and so on. Key is the key (or key sequence) you wish to bind. To specify a control character, use the sequence \Cx, where x is the letter of the control character (for example, to specify control-A use \Ca). Note that the case of x as well as \C is ignored, so that \CA, \Ca, \cA and \ca are all equivalent. Mutt allows you to use non alpha-numeric keys on a lot of platforms, but I was unable to get the F keys (F1, F2, etc.) to work on my Macintosh, so its not universal. Using the brackets shown below you can access any key listed in table 10 below: Code \t <tab> \r \n \e <esc> <up> <down> <left> <right> <pageup> <pagedown> <backspace> <delete> <insert> <enter> <return> <home> <end> <space> <f1> <f10> Produces: tab tab carriage return newline escape escape up arrow down arrow left arrow right arrow Page Up Page Down Backspace Delete Insert Enter Return Home End Space bar function key 1 function key 10 Figure 10: Special keys to which you can bind functions These are some of the shortcuts I have bound keys to in order to facilitate easy navigation, but you can bind just about anything you like. See section B for a list of all the functions available to you when programming keys. bind generic - first-entry #minus sign takes me to the top of the list bind generic = last-entry

30

4 ADVANCED CUSTOMIZATION

#equals sign takes me to the bottom of the list bind generic L bottom-page #to the bottom, bind generic M middle-page # middle, and bind generic H top-page # top of the screen bind index [ previous-unread #to the previous unread message in the list bind index ] next-unread #or the next unread message. The keys bound to generic are congured for usage throughout the program. So above we have two key bindings that only function in the index, and in the pager while youre reading a message, the [ and ] keys will have no effect.

4.4 Writing Macros


When youd like a key stroke to execute something more complex than a simple command, use a macro to bind complex keystroke combinations to a key. Three examples will get you started. The rst one assigns to the F2 key the command change current folder to the inbox, which youd use if you were looking at the list of emails stored in another folder and wished to go back to the inbox. The second macro assigns to the F3 key the command change current folder to the Sent folder. The third macro assigns to the key combination comma-c the command save this message to the Linux-list folder. In each case, the backslash-n at the end is a carriage return. Far more complicated procedures are available to you in this way, using \r to hit carriage returns between events, and taking advantage of the long list of functions available to you (see section B for a complete list). macro index <f2> "c !\n" macro index <f3> "c =Sent\n" macro index ,c "s=Linux-list\r"

4.5 Changing the Index View


We can set some other functionality that affects how the index view works. The following command instructs mutt to use an arrow to indicate which message is currently selected instead of an inverse video bar. set arrow_cursor #Changes the bar cursor to an arrow.

Default is the bar.

4.6 Changing the Pager View

31

4.6 Changing the Pager View


From the index, once you select a message, youre in the pager. By default, mutt uses its own pager, but if you prefer something else (like less), you are welcome to use it. In the pager screen, the up and down arrow keys scroll the message up and down, but you can bind additional keys to control scrolling. set pager="builtin" #Use the built-in pager, not less set pager_context=5 #Paging down a message leaves 5 lines of overlap, so you dont get lost. ignore * # First, ignore all headers. # In the next line we specify which ones wed like to see. unignore From To Reply-To Subject X-Mailer Cc Date #Show these headers (ignoring all, then selecting some is easy) hdr_order From: Date: To: Cc: Subject #Order in which the headers are presented. At the top of the screen is a small window previewing a few lines of the index, usually 3-5 messages before and after the message youre reading. If youd like to change that, you can do so with the pager_index_lines command. Finally, you can at the same time congure which headers youd like to be shown by default (remember, you can see all of them by pressing the H key), and alter the order in which the headers are presented. set pager_index_lines=4 #Show 2 messages on either side of the message Im reading. alternative_order text/enriched text/plain text/html #In which order to show the body parts (I leave HTML for last)

Two additional variables are useful to set here. The rst is tilde, which, if set, pads the screen at the end of the message with tildes to indicate the end of le (the same way vim does). If thats interesting to you, include set tilde The other is resolve. When you operate on a message, by default, Mutt then takes you to the next message automatically. But if the next message includes a big attachment you will be stuck until Mutt nishes downloading the entire attachment, which might take a while and be annoying if you are working online, i.e. with an IMAP mail account. You can prevent this by unsetting the resolve variable, i.e.

32

4 ADVANCED CUSTOMIZATION

unset resolve Otherwise, redene the delete command so that it takes you back to the index before deleting the message. That way the cursor will move automatically to the next message but not automatically open/download it. Add this to your .muttrc:6 folder-hook . macro pager d "<exit><delete-message>" "Delete the message" See section 4.10 for more information about folder hooks and how this folder hook works. You can add lines like the following to ensure your pager works the way you think it will (up and down scrolling). I also added commands to go rapidly to the next message. Be creative. bind bind bind bind pager pager pager pager <up> previous-line <down> next-line [ previous-unread ] next-unread

4.7 Dealing with non-ASCII Character Sets


This is one of the more pesky conguration issues when using mutt and many other console programs and getting this part of your conguration will take the combination of several properly congured environments, including your console or xterm depending on which environment you use, the locale settings for your machine and user account, and even the fonts available to your system for displaying those characters. Your editor comes into play as well, as it must be capable of producing and properly encoding the non-Western characters you use. Its a big topic and merits a Woodnotes guide unto itself, and Im working on one at the moment7 so Ill put the basics here and refer you to sources better than this guide for more information. Start with the mutt wiki article about foreign character sets, which is the most complete source of information on this topic that I know of (see sec. 5). It tells you how to set your $LOCALE variables in your bash shell conguration. That is, if you modify .bashrc and re-log in, you will have informed your system that on the console you like to work in a particular character set. More complex character sets (Russian, Polish) may additionally require ensuring the terminal or console has the font necessary to print those characters. Another good site of information on how to use Mutt in UTF-8 mode is available at Rano.org (see sec. 5). You should, at the minimum, let mutt know what character set you write in. Consider this step optional if you are a native English speaker/writer, but if you write in any other language this step becomes more important. Add a line like the following to your .muttrc to let mutt know the order in which it should search for a character set with all the requested characters in it. Its an ordered list of character sets separated by colons. set send_charset="iso-8859-1:utf-8"
6 Thanks 7 January

to Tim Brown for this trick. 2007: visit http://www.therandymon.com for details.

4.8 Dealing With Particularly Troublesome Characters

33

4.8 Dealing With Particularly Troublesome Characters


Blame mutt for doing exactly what its told to do. Character sets have very strict denitions of their character codes, and mutt takes those instructions literally, assuming other email software is telling the truth. But a lot of messages from Windows users either include Microsofts extensions (like smart quotes and en-dashes) or include characters cut and pasted from other character sets but not reported. Some Microsoft email software, many web mail programs, and some news readers on various platforms report they are encoding characters in the ISO-8859-1 (Western Latin) character set but then proceed to use characters from the CP1252 (Windows) character set. This causes you to read a lot extraneous characters in messages which Mutt presents to you in numerical form, like 221, 222, and 223. These numbers refer to octal codes for the characters, and appear when mutt doesnt know what to do with them. The following table shows some of the characters you are most likely to encounter: Octal 221 222 223 224 226 Character Left single quote Right single quote Left double quote Right double quote En dash Figure 11: Special Character Octal Codes A relatively clean way of dealing with this problem is to add a character set hook to your .muttrc, as follows. This instructs mutt to present characters using one character set when an email message reports that it has been encoded in another, as such: charset-hook windows-1250 CP1250. Repeat for CP1252 through CP1258, for example. Alain Bench recommends you follow up with the iconv program (read about it in the man pages), which converts text from one character set to another. Mutt includes a mechanism for substituting one character for another in whats called a display lter. Add the following to your muttrc le to declare characters youd like to substitute: set display_filter="tr \\221\\222\\223\\224\\226 \\047\\047\\042\\042\\055" This is a command that passes those characters through the Unix tr (translate) command, and Ive had trouble with it on some mutt installations. Another recommendation is to install John Walkers demoronizer Perl script (see section 5)on your machine, and pass messages through the demoronizer as follows (for the record, I dont think this script works well if you are working in an UTF-8 encoded environment). set display_filter="perl demoroniser.pl" Take care to set the display lter to the actual path to where youve installed the demoroniser Perl script. I saved it in my home directory, so I had to use set display_filter="perl ~/demoroniser.pl"

34

5 OTHER RESOURCES AND MORE INFORMATION

4.9 Advanced Printing: Mutt-Print


I very infrequently print email, but mutt-print is in my opinion a very worthwhile addition to the mutt software ecosphere and I now install it everywhere I use mutt. First download the mutt-print package (see section 5.2). You need to compile it yourself unless youre running a Debian derivative like Ubuntu, and in order to compile I had to download the iconv library and a Perl module, both of which were provided on my SUSE install disks, so theyre by no means obscure software. Unpack the TGZ le and follow the A instructions, and you will be ne. Mutt-Print uses L TEX and Perl to format the les that are sent the printer, and they are gorgeous to look at, little penguin logo and all.

4.10 Hooks for Sending, Accounts, and More


Hooks are great ways to provide conditional functionality. They perform actions when certain criteria are met. For example, a set of folder hooks could say list all my mailboxes in date received order except the Ofce Jerks folder, which I want listed by sender; a send hook could say whenever the recipient is Charlie change my return address to the following; an account hook could say whenever Im looking at the imap://ISP-two.com account, my password is the following. Thats all there is to it. Hooks come in many avors: folder-hooks, send-hooks, message-hooks, save-hook, mbox-hook, fcc-hook, and fcc-save-hook. I mostly use folder-hooks to choose a sorting pattern appropriate to the folder Im looking at. Here are some examples, but if you think about the possibilities this functionality provides youll see just how powerful they are. # Folder Hooks folder-hook /var/spool/mail/randymon set sort=date-received folder-hook Avalon-list set sort=threads folder-hook ! set sort=received # Send Hooks send-hook ~t tgw@ISP-one.com$ my_hdr From: Fat Penguin <eatmore@fish.com> send-hook ~t @hotmail.com$ my_hdr From: Tough Guy <name@address.com>

5 Other Resources and More Information


5.1 Information and Tips
mutt and muttrc man pages: Type man muttrc for a glimpse at all the fabulous functionality available to you if you just take the time to congure it, and youll see this Woodnotes Guide just scratches the surface. The mutt home page: www.mutt.org A tremendous source of links to other resources, plus the wiki, sample cong les, and more.

5.2 Other Software with which Mutt Interfaces

35

The mutt manual: http://www.mutt.org/doc/manual/manual.html The denitive guide to mutt. Mutt Newsgroup: comp.news.mutt a very active usenet newsgroup, but watch your netiquette and do some Googling before asking simple questions. The mutt-users mailing list: http://www.mutt.org/mail-lists.html Marks Mutt Fan and Tip Page: http://mark.stosberg.com/Tech/mutt.html My First Mutt, by Bruno Postle: http://mutt.blackfish.org.uk A good start for many new users, and very user friendly The Mutt Wiki: Character Sets http://wiki.mutt.org Good information on working with nonLatin character sets (Greek, Polish, Russian, etc.) light SMTP agents, and a lot more Rano.org Unicode Mutt: http://www.rano.org/mutt.html info on getting mutt to work in a unicode environment Postx state of mind: http://postfix.state-of-mind.de/patrick.koetter/smtpauth/ smtp_auth_mailservers.html: info on setting up Postx to the point where you can send mail to your ISP. Wolferman: A neat little script for keeping your mutt alias le and your abook addressle in synch: http: //wolfermann.org/abook-autoexport Vincent Danen: Using Mutt on Mac OS X: http://linsec.ca/Using_mutt_on_OS_X In addition, many people have posted their .muttrc les to the internet. Google for muttrc to nd some of them.

5.2 Other Software with which Mutt Interfaces


The Little Brother Database: http://www.spinnaker.de/lbdb/ The Rolo project: http://rolo.sourceforge.net Demoronizer: http://www.fourmilab.ch/webtools/demoroniser/ or http://freshmeat. net/projects/demoroniser/ Mutt-print: http://muttprint.sourceforge.net Putmail.py: http://putmail.sourceforge.net mutt-ldap.pl: http://www.bsdconsulting.no/tools/mutt-ldap.pl

36

A APPENDIX: PATTERNS

Appendix: Patterns

~A ~b ~B ~c ~C ~D ~d ~E ~e ~F ~f ~g ~G ~h ~k ~i ~L ~l ~m ~n ~N ~O ~p ~P ~Q ~R ~r ~S ~s ~T ~t ~U ~v ~x ~y ~z ~=

EXPR EXPR USER EXPR [MIN]-[MAX] EXPR USER

EXPR ID EXPR [MIN]-[MAX] [MIN]-[MAX]

[MIN]-[MAX] SUBJECT USER

EXPR EXPR [MIN]-[MAX]

all messages messages which contain EXPR in the message body messages which contain EXPR in the whole message messages carbon-copied to USER message is either to: or cc: EXPR deleted messages messages with date-sent in a Date range expired messages message which contains EXPR in the Sender field flagged messages messages originating from USER PGP signed messages PGP encrypted messages messages which contain EXPR in the message header message contains PGP key material message which match ID in the Message-ID field message is either originated or received by EXPR message is addressed to a known mailing list message in the range MIN to MAX *) messages with a score in the range MIN to MAX *) new messages old messages message is addressed to you (consults $alternates) message is from you (consults $alternates) messages which have been replied to read messages messages with date-received in a Date range superseded messages messages having SUBJECT in the Subject field. tagged messages messages addressed to USER unread messages message is part of a collapsed thread. messages which contain EXPR in the References field messages which contain EXPR in the X-Label field messages with a size in the range MIN to MAX *) duplicated messages (see $duplicate_threads)

37

B Appendix: Functions available for Macros


B.1 Generic Functions

The generic menu is not a real menu, but species common functions (such as movement) available in all menus except for pager and editor. Changing settings for this menu will affect the default bindings for all menus (except as noted). bottom-page current-bottom current-middle current-top enter-command exit first-entry half-down half-up help jump last-entry middle-page next-entry next-line next-page previous-entry previous-line previous-page refresh search search-next search-opposite search-reverse select-entry shell-escape tag-entry tag-prefix top-page L not bound not bound not bound : q = ] [ ? number * M j > z k < Z ^L / n not bound ESC / RET ! t ; H move to the bottom of the page move current entry to bottom of page move current entry to middle of page move current entry to top of page enter a muttrc command exit this menu move to the first entry scroll down 1/2 page scroll up 1/2 page this screen jump to an index number move to the last entry move to the middle of the page move to the next entry scroll down one line move to the next page move to the previous entry scroll up one line move to the previous page clear and redraw the screen search for a regular expression search for next match search for next match in opposite direction search backwards for a regular expression select the current entry run a program in a subshell toggle the tag on the current entry apply next command to tagged entries move to the top of the page

B.2

The Index
remail a message to another user open a different folder open a different folder in read only mode check for classic pgp clear a status flag from a message

bounce-message b change-folder c change-folder-readonly ESC c check-traditional-pgp ESC P clear-flag W

38

B APPENDIX: FUNCTIONS AVAILABLE FOR MACROS

copy-message C create-alias a decode-copy ESC C decode-save ESC s delete-message d delete-pattern D delete-subthread ESC d delete-thread ^D display-address @ display-toggle-weed h display-message RET edit e edit-type ^E exit x extract-keys ^K fetch-mail G flag-message F forget-passphrase ^F forward-message f group-reply g limit l list-reply L mail m mail-key ESC k next-new TAB next-subthread ESC n next-thread ^N next-undeleted j next-unread not bound parent-message P pipe-message | previous-new ESC TAB previous-page Z previous-subthread ESC p previous-thread ^P previous-undeleted k previous-unread not bound print-message p query Q quit q read-subthread ESC r read-thread ^R recall-message R reply r resend-message ESC e save-message s

copy a message to a file/mailbox create an alias from a message sender decode a message and copy it to a file/mailbox decode a message and save it to a file/mailbox delete the current entry delete messages matching a pattern delete all messages in subthread delete all messages in thread display full address of sender display message and toggle header weeding display a message edit the current message edit the current messages Content-Type exit without saving changes extract PGP public keys retrieve mail from POP server toggle a messages important flag wipe PGP passphrase from memory forward a message with comments reply to all recipients show only messages matching a pattern reply to specified mailing list compose a new mail message mail a PGP public key jump to the next new message jump to the next subthread jump to the next thread move to the next undeleted message jump to the next unread message jump to parent message in thread pipe message/attachment to a shell command jump to the previous new message move to the previous page jump to previous subthread jump to previous thread move to the last undelete message jump to the previous unread message print the current entry query external program for addresses save changes to mailbox and quit mark the current subthread as read mark the current thread as read recall a postponed message reply to a message resend message and preserve MIME structure save message/attachment to a file

B.3 The Pager

39

set-flag show-version show-limit sort-mailbox sort-reverse sync-mailbox tag-pattern tag-thread toggle-new toggle-write undelete-message undelete-pattern undelete-subthread undelete-thread untag-pattern view-attachments

w V ESC l o O $ T ESC t N % u U ESC u ^U ^T v

set a status flag on a message show the Mutt version number and date show currently active limit pattern, if any sort messages sort messages in reverse order save changes to mailbox tag messages matching a pattern tag/untag all messages in the current thread toggle a messages new flag toggle whether the mailbox will be rewritten undelete the current entry undelete messages matching a pattern undelete all messages in subthread undelete all messages in thread untag messages matching a pattern show MIME attachments

B.3

The Pager
bound b c ESC c ESC P C a ESC C ESC s d ESC d ^D @ h e ^E : i ^K F ^F f g bound bound ? jump to the bottom of the message remail a message to another user open a different folder open a different folder in read only mode check for classic pgp copy a message to a file/mailbox create an alias from a message sender decode a message and copy it to a file/mailbox decode a message and save it to a file/mailbox delete the current entry delete all messages in subthread delete all messages in thread display full address of sender display message and toggle header weeding edit the current message edit the current messages Content-Type enter a muttrc command return to the main-menu extract PGP public keys toggle a messages important flag wipe PGP passphrase from memory forward a message with comments reply to all recipients move up one-half page move down one-half page this screen

bottom not bounce-message change-folder change-folder-readonly check-traditional-pgp copy-message create-alias decode-copy decode-save delete-message delete-subthread delete-thread display-address display-toggle-weed edit edit-type enter-command exit extract-keys flag-message forget-passphrase forward-message group-reply half-up not half-down not help

40

B APPENDIX: FUNCTIONS AVAILABLE FOR MACROS

list-reply mail mail-key mark-as-new next-line next-entry next-new next-page next-subthread next-thread next-undeleted next-unread parent-message pipe-message previous-line previous-entry previous-new previous-page previous-subthread previous-thread previous-undeleted previous-unread print-message quit read-subthread read-thread recall-message redraw-screen reply save-message search search-next search-opposite search-reverse search-toggle shell-escape show-version skip-quoted sync-mailbox tag-message toggle-quoted top undelete-message undelete-subthread undelete-thread view-attachments

L m ESC k N RET J TAB ESC n ^N j not bound P | BackSpace K not bound ESC p ^P k not bound p Q ESC r ^R R ^L r s / n not bound ESC / \ ! V S $ t T ^ u ESC u ^U v

reply to specified mailing list compose a new mail message mail a PGP public key toggle a messages new flag scroll down one line move to the next entry jump to the next new message move to the next page jump to the next subthread jump to the next thread move to the next undeleted message jump to the next unread message jump to parent message in thread pipe message/attachment to a shell command scroll up one line move to the previous entry jump to the previous new message move to the previous page jump to previous subthread jump to previous thread move to the last undelete message jump to the previous unread message print the current entry save changes to mailbox and quit mark the current subthread as read mark the current thread as read recall a postponed message clear and redraw the screen reply to a message save message/attachment to a file search for a regular expression search for next match search for next match in opposite direction search backwards for a regular expression toggle search pattern coloring invoke a command in a subshell show the Mutt version number and date skip beyond quoted text save changes to mailbox tag a message toggle display of quoted text jump to the top of the message undelete the current entry undelete all messages in subthread undelete all messages in thread show MIME attachments

B.4 Aliases

41

B.4

Aliases
/ n ESC / search for a regular expression search for next match search backwards for a regular expression

search search-next search-reverse

B.5

Queries
a m Q A / n not bound ESC / create an alias from a message sender compose a new mail message query external program for addresses append new query results to current results search for a regular expression search for next match search for next match in opposite direction search backwards for a regular expression

create-alias mail query query-append search search-next search-opposite search-reverse

B.6

The Attach menu


b v d h ^E ^K f g L | p r ESC e s u RET m T remail a message to another user toggle display of subparts delete the current entry display message and toggle header weeding edit the current entrys Content-Type extract PGP public keys forward a message with comments reply to all recipients reply to specified mailing list pipe message/attachment to a shell command print the current entry reply to a message resend message and preserve MIME structure save message/attachment to a file undelete the current entry view attachment using mailcap entry if necessary force viewing of attachment using mailcap view attachment as text

bounce-message collapse-parts delete-entry display-toggle-weed edit-type extract-keys forward-message group-reply list-reply pipe-entry print-entry reply resend-message save-entry undelete-entry view-attach view-mailcap view-text

B.7

The Compose menu


a A ESC k attach a file(s) to this message attach message(s) to this message attach a PGP public key

attach-file attach-message attach-key

42

B APPENDIX: FUNCTIONS AVAILABLE FOR MACROS

copy-file detach-file display-toggle-weed edit-bcc edit-cc edit-description edit-encoding edit-fcc edit-from edit-file edit-headers edit edit-mime edit-reply-to edit-subject edit-to edit-type filter-entry forget-passphrase ispell new-mime pgp-menu pipe-entry postpone-message print-entry rename-file send-message toggle-unlink view-attach write-fcc

C D h b c d ^E f ESC f ^X e E e m r s t ^T F ^F i n p | P l R y u RET w

save message/attachment to a file delete the current entry display message and toggle header weeding edit the BCC list edit the CC list edit attachment description edit attachment transfer-encoding enter a file to save a copy of this message in edit the from: field edit the file to be attached edit the message with headers edit the message edit attachment using mailcap entry edit the Reply-To field edit the subject of this message edit the TO list edit attachment type filter attachment through a shell command wipe PGP passphrase from memory run ispell on the message compose new attachment using mailcap entry show PGP options pipe message/attachment to a shell command save this message to send later print the current entry rename/move an attached file send the message toggle whether to delete file after sending it view attachment using mailcap entry if necessary write the message to a folder

B.8

The Postpone menu


d u delete the current entry undelete the current entry

delete-entry undelete-entry

B.9

Browser
c TAB m / n ESC / change directories check mailboxes for new mail enter a file mask search for a regular expression search for next match search backwards for a regular expression

change-dir check-new enter-mask search search-next search-reverse

B.10 PGP

43

select-new sort sort-reverse toggle-mailboxes view-file subscribe unsubscribe toggle-subscribed

N o O TAB SPACE s u T

select a new file in this directory sort messages sort messages in reverse order toggle whether to browse mailboxes or all files view file subscribe to current mailbox (IMAP Only) unsubscribe to current mailbox (IMAP Only) toggle view all/subscribed mailboxes (IMAP Only)

B.10

PGP
% c view the keys user id verify a PGP public key

view-name verify-key

B.11

The Editor
BackSpace ^B ESC b ^A Space ESC c TAB ^T ^D ESC l ^E ^F ESC f not bound not bound ^K ESC d ^U ^W ^V not bound ESC u delete the char in front of the cursor move the cursor one character to the left move the cursor to the previous word jump to the beginning of the line cycle among incoming mailboxes uppercase the first character in the word complete filename or alias complete address with query delete the char under the cursor lowercase all characters in current word jump to the end of the line move the cursor one character to the right move the cursor to the next word scroll down through the history list scroll up through the history list delete chars from cursor to end of line delete chars from cursor to end of word delete all chars on the line delete the word in front of the cursor quote the next typed key transpose character under cursor with previous uppercase all characters in current word

backspace backward-char backward-word bol buffy-cycle capitalize-word complete complete-query delete-char downcase-word eol forward-char forward-word history-down history-up kill-eol kill-eow kill-line kill-word quote-char transpose-chars upcase-word

Appendix: Acknowledgments and License

This Woodnotes Guide is my own, in that the many weeks that went into researching, writing, editing, and correcting this document were mine; nevertheless I am indebted to the many sources of mutt information

44

D APPENDIX: VERSION HISTORY

I have taken and modied to learn about mutt myself and develop this Woodnotes Guide, including the archives of the mutt newsgroup and the personal mutt web pages of scores of mutt acionados. They are too numerous to name individually, so instead I dedicate this document to them and release it to the public without charge. As I am a writer, not a programmer by trade, this is my contribution to the community in appreciation of the software that other volunteers have made available to me for free. Such is the Open Source community. This document is published under the Creative Commons Attribution-NonCommercial-ShareAlike 2.5 license as described at http://creativecommons.org/licenses/by-nc-sa/2.5/. Please send comments, criticism, and corrections to me at the email address found at my website. Enjoy this guide: I enjoyed creating it.

Appendix: Version History


2 December 2009: ofineimap and concept of usage scenarios, wvText, querying an LDAP server, coloring the index, trimmed out some banter and discussion of mutt-ng, reorganization including appendices 3 March 2008: SMTP, forwarding attachments 14 April 2007: putmail.py, Mutt on Macs 6 March 2007: expanded abook and muttprint, more about pager view, attachments and resolve, added IMAP header caching, default sending character set, and light smtp packages, some reorganization. 24 November 2006: major edits to And/Or tagging and agging. Thanks to Chris Moore for spotting the errors. Also edits to fetchmail, postx/sendmail, some capitalization xes, and edits to the pager view. 18 November 2006: minor edits to Macros and Dealing with Word Docs 6 October 2006: Added licensing information and moved acknowledgments and version history to the top. Over 5000 people have already downloaded this guide! 13 May 2006: Updated some of the section about character sets, with help and suggestions from Alain Bench. 09 March 2006: Radically expanded version including major reorganization and appendices. This is more what I had in mind when I set out to write this guide. Page count approx. 37 pages. 08 September 2005: Initial version, written during a long sejour in Mozambique. Muito obrigado!

You might also like