mutt is an ideal mail reader for people who need to access their mail from anywhere, have grown used to the shell and prefer console-style operations, or spend more time than they can really spare dealing with email and would like to be more efficient. With a reputation for being flexible enough to work however you want to work, mutt is a strong contender for console-based email client of your choice.
mutt is very well documented at http://www.mutt.org/, so this chapter will only look at basic survival and then some interesting customisations that you'd have to nut out yourself or perhaps never find out about.
When you first start mutt it will display the contents of your inbox. This view is called the index. Note the selection of useful keybindings along the top of the screen and the reminder that pressing `?' takes you to a comprehensive list of available keys.
Move up and down the list with the arrow keys or PgUp/PgDn. View a message by pressing Enter. This view is called the pager.
|Tab||Jump to the next unread message|
|Enter||Open the message at the current cursor position|
|/||Search for a word in authors or subjects|
|d||Mark an email as to-be-deleted|
||Delete all to-be-deleted emails without quitting|
Each mail in the pager view is numbered (leftmost column). You can jump directly to a mail simply by typing the number.
|Space||Next page, or next message if you reach the end|
|i||Return to the index|
|m||Send a new mail|
|r||Reply to the author of the current message|
|g||Reply to the author and all recipients of the current message|
|L||Reply to the mailing list the current message was sent to|
|f||Forward the current message|
After you supply or confirm the recipients and subject of your email, you'll be dropped into an editor to write the body. By default this editor is vi. You may not be a fan of vi, so feel free to change it as described in the next section. When you're done writing, save and quit the editor.
|a||Attach a file|
|D||Detach a file|
|t||Change the To: field|
|Esc-f||Change the From: field|
|s||Change the Subject: field|
|c||Change the cc: field|
|b||Change the bcc: field|
|q||Don't send it|
|P||Save it to send or edit later|
When a lengthy discussion arises, especially between more than two people, the order in which mail arrives or was sent is not necessarily the order in which it should be read. The last person to join a discussion may compose a reply to one of the earliest emails, and it makes sense to read this directly after the mail to which it was in reply. mutt's threading mode sorts emails by thread of conversation.
922 N Peter Bittner (1.4K) [mod_python] How can I have sensible URLs? 923 N Gregory (Grisha) Tru (2.0K) |-> 924 N Peter Bittner (3.6K) | `-> 925 N Adrien Plisson (1.1K) | |-> 926 N Peter Bittner (1.8K) | | `-> 927 N Christoph Fritzsch (1.0K) | | |-> 928 N Adrien Plisson (1.2K) | | | `-> 929 N Gregory (Grisha) Tru (1.7K) | | `-> 930 N Peter Bittner (2.5K) | `-> 931 N Mateusz Korniak (0.8K) | |-> 932 N Peter Bittner (2.3K) | `->[mod_python] Modifying publisher for se... 933 N David Higgs (1.9K) | `-> 934 N vio (1.3K) | |-> 935 N Peter Bittner (1.9K) | `-> 936 N Martin Pool (1.3K) `->
Figure 10.1 shows a discussion that split off in four different directions. You can read it in conversation order, as shown. Even more usefully, if you don't care about that topic press Ctrl-d to delete the entire thread.
You will want to make threading the default sort order for mail. To do this write set sort=threads in your configuration file (see Section 10.3).
To change your mutt configuration edit .muttrc in your home directory. Some configuration items are variables, so you write set variable or set variable = value. Other items are commands, so you write command arguments ....
You can set your name, the domain name attached to your email address, and where you want your folders of saved mail.
set realname = "Ford Prefect" set hostname = "progsoc.org" set folder = "/home/example/mail"
Set the editor configuration variable. Some good ones are
set editor="emacs -nw" # run emacs, but don't let it try to open an X window
If you use emacs, get the post-mode from http://www.astro.utoronto.ca/;SPMtilde;reid/mutt/.
The next two are for vim, and are useful if you decide to set edit_headers and autoedit, which skip the To: and Subject: dialogs for composing mail and allow you to write them in your editor instead.
set editor="vim '+/^$'" # use vim, move the cursor to the first empty line # (i.e. right after the header) set editor="vim -c ':0;/^Subject: '" # use vim, move the cursor to the Subject header line
First make a file called .mutt.mailcap in your home directory. In it write
text/html; w3m -dump -T text/html %s; copiousoutput
Then in your configuration file add
set mailcap_path="/home/example/.mutt.mailcap" auto_view text/html
The w3m console-based web browser needs to be installed on the system for this to work.
If you're using procmail or some other mail processor to sort your incoming mail, you might have several mailboxes that messages can show up in. Tell mutt about them with the mailboxes configuration command.
mailboxes /var/mail/example /home/example/mail/lists/progsoc /home/example/mail/lists/freebsd
mutt will monitor each mailbox for new mail, and alert you if new mail appears in a mailbox other than the one currently displayed in the index. If you press c to change mailboxes, that mailbox will be the default.
If you use this feature, you might want to also configure this convenient macro:
macro index I "c!\n" macro pager I "c!\n"
This will allow you to return to your ``main'' inbox from anywhere by pressing I.
mutt has special features for handling mail to and from mailing lists. You should look into them if you are subscribed to mailing lists. They are covered in the mutt online documentation.
set alternates = (firstname.lastname@example.orgemail@example.comfirstname.lastname@example.org) # the above is a regular expression, if that helps set reverse_name = yes
Firstly, this will allow mutt to better recognise emails sent to you personally. These are marked differently in the index view. Secondly, if you reply to a mail sent to an alternate address, mutt will set your From: address to match.
Sometimes it's not enough for mail to be sent with a customised From: address. You might want to have different signatures to go with your different email addresses, or add extra headers when sending as your work address. The following configuration example automates some of that, by letting you define rules that set out when each personality should be used. Use this in conjunction with reverse_name described above.
# Defaults: # Read my signature from the usual place, set a typical From: header, no Organisation: send-hook . "set signature=~/.signature" send-hook . "my_hdr From: Ford Prefect
" send-hook . unmy_hdr organisation # Configuration for sending email to university staff/students: # Load a different signature, perhaps with room, phone number and CRICOS code in it send-hook '~t ^.*@it.uts.edu.au' "set signature=~/sigs/uts" send-hook '~t ^.*@it.uts.edu.au' "my_hdr From: Dr Ford Prefect " # For replying to any email sent to the work address # You do have to re-set the From: address even with reverse_name in operation, # because otherwise it'll be over-ridden by the default send-hook above send-hook '~f ^email@example.com' "set signature=~/sigs/worksig send-hook '~f ^firstname.lastname@example.org' "my_hdr From: Ford Prefect - Net Eng. " send-hook '~f ^email@example.com' "my_hdr Organisation: Example Widgetry (Australia)" # If you've subscribed to a mailing list using a separate account to avoid spammers, # you can automatically set the right From: address when mailing the list send-hook '~t ^.*@lists.example.net' "my_hdr From: firstname.lastname@example.org" # Sometimes it's more useful to match on the subject of the email you're replying to send-hook '~s Website\ Feedback\ Form' "set signature=~/sigs/webmaster" send-hook '~s Website\ Feedback\ Form' "my_hdr From: Webmaster " send-hook '~s Website\ Feedback\ Form' "my_hdr Organisation: Website Outsourcing P/L"
There is a huge range of possibilities both for matching conditions and for reconfiguration based on matches. As a more esoteric example, you could set a different outbound mail server based on the email address you were mailing from.
You can display a few lines of index view, including the current email, while in pager view. This may help you keep context when reading conversations.
set pager_index_lines = 6 # use 6 lines of the pager for an index view
Restrict which headers are displayed in pager mode to only the most important ones.
# Screen all headers, display only the ones we specify ignore * unignore from date subject to cc reply-to: unignore organization organisation x-mailer: x-newsreader: x-mailing-list: # Some people like to see these. #unignore posted-to: #unignore message-id:
Use the h key in pager view to display all the headers of a message.
These are some small things that don't rate their own sections. Try them out and see if they appeal to you.
set move=no # Disable the prompt to remove read emails from your inbox and move them # to ~/mbox, because this is annoying set status_on_top # Move the status bar to the top and the keybindings bar to the bottom set arrow_cursor # Indicate the current mail with an arrow instead of a highlighted line # Useful for slow connections set pager_stop # Don't open the next message when
is pressed at the end of an email set forw_format="(forw) %s" # A nicer default subject when forwarding emails set hdr_format="%4C %Z %-20.20F (%4c) %s" # Alternate format for each email in the index view set status_format="%v: %f (%s) [%M/%m] %?n?N=%n ?%?t?*=%t ?%?p?post=%p ?%?b?new=%b?" # Alternate format for the status bar in index view set pager_format="%S [%C/%m] %n (%l) %s" # Alternate format for the status bar in pager view set attribution = "* %n <%a> [%(%Y-%m-%d %H:%M)]:" # A minimalist attribution format (inserted above quoted text) # You may prefer: # set attribution="On %d, %n wrote:" set quote_regexp="^ *[a-zA-Z]*>|}()%:=-]>|}():=-]*" # Changes how mutt detects quoted text (for colourisation). # This one takes into account more variations of quoting style
Back to table of contents