Chapter 2. Getting Started

This section is intended as a brief overview of how to use Mutt. There are many other features which are described elsewhere in the manual. There is even more information available in the Mutt FAQ and various web pages. See the Mutt homepage for more details.

The keybindings described in this section are the defaults as distributed. Your local system administrator may have altered the defaults for your site. You can always type ``?'' in any menu to display the current bindings.

The first thing you need to do is invoke mutt, simply by typing mutt at the command line. There are various command-line options, see either the mutt man page or the reference.

Mutt is a text-based application which interacts with users through different menus which are mostly line-/entry-based or page-based. A line-based menu is the so-called ``index'' menu (listing all messages of the currently opened folder) or the ``alias'' menu (allowing you to select recipients from a list). Examples for page-based menus are the ``pager'' (showing one message at a time) or the ``help'' menu listing all available key bindings.

The user interface consists of a context sensitive help line at the top, the menu's contents followed by a context sensitive status line and finally the command line. The command line is used to display informational and error messages as well as for prompts and for entering interactive commands.

Because Mutt allows for customizing almost all key bindings, there're so-called ``functions'' which can be executed manually (using the command line) or in macros. Macros allow the user to bind a sequence of commands to a single key or a short key sequence instead of repeating a sequence of actions over and over.

Many commands (such as saving or copying a message to another folder) can be applied to a single message or a set of messages (so-called ``tagged'' messages). To help selecting messages, Mutt provides a rich set of message patterns (such as recipients, sender, body contents, date sent/received, etc.) which can be combined into complex expressions using the boolean and and or operations as well as negating. These patterns can also be used to (for example) search for messages or to limit the index to show only matching messages.

Mutt supports a ``hook'' concept which allows the user to execute arbitrary configuration commands and functions in certain situations such as entering a folder, starting a new message or replying to an existing one. These hooks can be used to highly customize Mutt's behaviour including managing multiple identities, customizing the display for a folder or even implementing auto-archiving based on a per-folder basis and much more.

Mutt maintains a history for the built-in editor. The number of items is controlled by the history variable and can be made persistent using an external file specified using historyfile. You may cycle through them at an editor prompt by using the <history-up> and/or <history-down> commands.

Mutt maintains several distinct history lists, one for each of the following categories:

  • muttrc commands

  • addresses and aliases

  • shell commands

  • filenames

  • patterns

  • everything else

Mutt automatically filters out repeated items from the history. It also mimics the behavior of some shells by ignoring items starting with a space. The latter feature can be useful in macros to not clobber the history's valuable entries with unwanted entries.

Similar to many other mail clients, there are two modes in which mail is read in Mutt. The first is the index of messages in the mailbox, which is called the ``index'' in Mutt. The second mode is the display of the message contents. This is called the ``pager.''

The next few sections describe the functions provided in each of these modes.

Common keys used to navigate through and manage messages in the index are shown in Table 2.3. How messages are presented in the index menu can be customized using the indexformat variable.

In addition to who sent the message and the subject, a short summary of the disposition of each message is printed beside the message number. Zero or more of the ``flags'' in Table 2.4 may appear, some of which can be turned on or off using these functions: <set-flag> and <clear-flag> bound by default to ``w'' and ``W'' respectively.

Furthermore, the flags in Table 2.5 reflect who the message is addressed to. They can be customized with the tochars variable.

By default, Mutt uses its builtin pager to display the contents of messages. The pager is very similar to the Unix program less though not nearly as featureful.

In addition to key bindings in Table 2.6, many of the functions from the index menu are also available in the pager, such as <delete-message> or <copy-message> (this is one advantage over using an external pager to view messages).

Also, the internal pager supports a couple other advanced features. For one, it will accept and translate the ``standard'' nroff sequences for bold and underline. These sequences are a series of either the letter, backspace (H), the letter again for bold or the letter, backspace, ``'' for denoting underline. Mutt will attempt to display these in bold and underline respectively if your terminal supports them. If not, you can use the bold and underline color objects to specify a color or mono attribute for them.

Additionally, the internal pager supports the ANSI escape sequences for character attributes. Mutt translates them into the correct color and character settings. The sequences Mutt supports are:

ePs;Ps;..Ps;m

where Ps can be one of the codes shown in Table 2.7.

Mutt uses these attributes for handling text/enriched messages, and they can also be used by an external autoview script for highlighting purposes. Note: If you change the colors for your display, for example by changing the color associated with color2 for your xterm, then that color will be used instead of green.

Note that the search commands in the pager take regular expressions, which are not quite the same as the more complex patterns used by the search command in the index. This is because the pager only performs simple text search, whereas the index provides boolean filtering on several aspects of messages.

In addition, the index and pager menus have these interesting functions:

<create-alias> (default: a)

Creates a new alias based upon the current message (or prompts for a new one). Once editing is complete, an alias command is added to the file specified by the aliasfile variable for future use. Note: Mutt does not read the aliasfile upon startup so you must explicitly source the file.

<check-traditional-pgp> (default: Esc P)

This function will search the current message for content signed or encrypted with PGP the ``traditional'' way, that is, without proper MIME tagging. Technically, this function will temporarily change the MIME content types of the body parts containing PGP data; this is similar to the <edit-type> function's effect.

<edit> (default: e)

This command (available in the index and pager) allows you to edit the raw current message as it's present in the mail folder. After you have finished editing, the changed message will be appended to the current folder, and the original message will be marked for deletion; if the message is unchanged it won't be replaced.

<edit-type> (default: E on the attachment menu, and in the pager and index menus; T on the compose menu)

This command is used to temporarily edit an attachment's content type to fix, for instance, bogus character set parameters. When invoked from the index or from the pager, you'll have the opportunity to edit the top-level attachment's content type. On the attachment menu, you can change any attachment's content type. These changes are not persistent, and get lost upon changing folders.

Note that this command is also available on the compose menu. There, it's used to fine-tune the properties of attachments you are going to send.

<enter-command> (default: ``:'')

This command is used to execute any command you would normally put in a configuration file. A common use is to check the settings of variables, or in conjunction with macros to change settings on the fly.

<extract-keys> (default: K)

This command extracts PGP public keys from the current or tagged message(s) and adds them to your PGP public key ring.

<forget-passphrase> (default: F)

This command wipes the passphrase(s) from memory. It is useful, if you misspelled the passphrase.

<list-reply> (default: L)

Reply to the current or tagged message(s) by extracting any addresses which match the regular expressions given by the lists or subscribe commands, but also honor any Mail-Followup-To header(s) if the honorfollowupto configuration variable is set. Using this when replying to messages posted to mailing lists helps avoid duplicate copies being sent to the author of the message you are replying to.

<pipe-message> (default: )

Asks for an external Unix command and pipes the current or tagged message(s) to it. The variables pipedecode, pipesplit, pipesep and waitkey control the exact behavior of this function.

<resend-message> (default: Esc e)

Mutt takes the current message as a template for a new message. This function is best described as "recall from arbitrary folders". It can conveniently be used to forward MIME messages while preserving the original mail structure. Note that the amount of headers included here depends on the value of the weed variable.

This function is also available from the attachment menu. You can use this to easily resend a message which was included with a bounce message as a message/rfc822 body part.

<shell-escape> (default: !)

Asks for an external Unix command and executes it. The waitkey can be used to control whether Mutt will wait for a key to be pressed when the command returns (presumably to let the user read the output of the command), based on the return status of the named command. If no command is given, an interactive shell is executed.

<toggle-quoted> (default: T)

The pager uses the quoteregexp variable to detect quoted text when displaying the body of the message. This function toggles the display of the quoted material in the message. It is particularly useful when being interested in just the response and there is a large amount of quoted text in the way.

<skip-quoted> (default: S)

This function will go to the next line of non-quoted text which comes after a line of quoted text in the internal pager.

The bindings shown in Table 2.10 are available in the index and pager to start a new message.

Bouncing a message sends the message as-is to the recipient you specify. Forwarding a message allows you to add comments or modify the message you are forwarding. These items are discussed in greater detail in the next chapter ``Forwarding and Bouncing Mail.''

Mutt will then enter the compose menu and prompt you for the recipients to place on the ``To:'' header field. Next, it will ask you for the ``Subject:'' field for the message, providing a default if you are replying to or forwarding a message. See also askcc, askbcc, autoedit, bounce, fastreply, and include for changing how Mutt asks these questions.

Mutt will then automatically start your editor on the message body. If the editheaders variable is set, the headers will be at the top of the message in your editor. Any messages you are replying to will be added in sort order to the message, with appropriate attribution, indentstring and postindentstring. When forwarding a message, if the mimeforward variable is unset, a copy of the forwarded message will be included. If you have specified a signature, it will be appended to the message.

Once you have finished editing the body of your mail message, you are returned to the compose menu providing the functions shown in Table 2.11 to modify, send or postpone the message.

The compose menu is also used to edit the attachments for a message which can be either files or other messages. The <attach-message> function to will prompt you for a folder to attach messages from. You can now tag messages in that folder and they will be attached to the message you are sending. Note that certain operations like composing a new mail, replying, forwarding, etc. are not permitted when you are in that folder. The r in statusformat will change to a ``A'' to indicate that you are in attach-message mode.

When editing the header because of editheaders being set, there are a several pseudo headers available which will not be included in sent messages.

If you have told mutt to PGP or S/MIME encrypt a message, it will guide you through a key selection process when you try to send the message. Mutt will not ask you any questions about keys which have a certified user ID matching one of the message recipients' mail addresses. However, there may be situations in which there are several keys, weakly certified user ID fields, or where no matching keys can be found.

In these cases, you are dropped into a menu with a list of keys from which you can select one. When you quit this menu, or mutt can't find any matching keys, you are prompted for a user ID. You can, as usually, abort this prompt using G. When you do so, mutt will return to the compose screen.

Once you have successfully finished the key selection, the message will be encrypted using the selected public keys when sent out.

Most fields of the entries in the key selection menu (see also pgpentryformat) have obvious meanings. But some explanations on the capabilities, flags, and validity fields are in order.

The flags sequence (f) will expand to one of the flags in Table 2.12.

The capabilities field (c) expands to a two-character sequence representing a key's capabilities. The first character gives the key's encryption capabilities: A minus sign (``-'') means that the key cannot be used for encryption. A dot (``.'') means that it's marked as a signature key in one of the user IDs, but may also be used for encryption. The letter ``e'' indicates that this key can be used for encryption.

The second character indicates the key's signing capabilities. Once again, a ``-'' implies ``not for signing'', ``.'' implies that the key is marked as an encryption key in one of the user-ids, and ``s'' denotes a key which can be used for signing.

Finally, the validity field (t) indicates how well-certified a user-id is. A question mark (``?'') indicates undefined validity, a minus character (``-'') marks an untrusted association, a space character means a partially trusted association, and a plus character (``+'') indicates complete validity.

You may also have compiled mutt to co-operate with Mixmaster, an anonymous remailer. Mixmaster permits you to send your messages anonymously using a chain of remailers. Mixmaster support in mutt is for mixmaster version 2.04 (beta 45 appears to be the latest) and 2.03. It does not support earlier versions or the later so-called version 3 betas, of which the latest appears to be called 2.9b23.

To use it, you'll have to obey certain restrictions. Most important, you cannot use the Cc and Bcc headers. To tell Mutt to use mixmaster, you have to select a remailer chain, using the mix function on the compose menu.

The chain selection screen is divided into two parts. In the (larger) upper part, you get a list of remailers you may use. In the lower part, you see the currently selected chain of remailers.

You can navigate in the chain using the <chain-prev> and <chain-next> functions, which are by default bound to the left and right arrows and to the h and l keys (think vi keyboard bindings). To insert a remailer at the current chain position, use the <insert> function. To append a remailer behind the current chain position, use <select-entry> or <append>. You can also delete entries from the chain, using the corresponding function. Finally, to abandon your changes, leave the menu, or <accept> them pressing (by default) the Return key.

Note that different remailers do have different capabilities, indicated in the c entry of the remailer menu lines (see mixentryformat). Most important is the ``middleman'' capability, indicated by a capital ``M'': This means that the remailer in question cannot be used as the final element of a chain, but will only forward messages to other mixmaster remailers. For details on the other capabilities, please have a look at the mixmaster documentation.

Mutt only supports setting the required format=flowed MIME parameter on outgoing messages if the textflowed variable is set, specifically it does not add the trailing spaces.

After editing the initial message text and before entering the compose menu, mutt properly space-stuffes the message. Space-stuffing is required by RfC3676 defining format=flowed and means to prepend a space to:

  • all lines starting with a space

  • lines starting with the word ``From'' followed by space

  • all lines starting with ``>'' which is not intended to be a quote character

Note that mutt only support space-stuffing for the first two types of lines but not for the third: It is impossible to safely detect whether a leading > character starts a quote or not. Futhermore, Mutt only applies space-stuffing once after the initial edit is finished.

All leading spaces are to be removed by receiving clients to restore the original message prior to further processing.

At times it is desirable to delay sending a message that you have already begun to compose. When the <postpone-message> function is used in the compose menu, the body of your message and attachments are stored in the mailbox specified by the postponed variable. This means that you can recall the message even if you exit Mutt and then restart it at a later time.

Once a message is postponed, there are several ways to resume it. From the command line you can use the ``-p'' option, or if you compose a new message from the index or pager you will be prompted if postponed messages exist. If multiple messages are currently postponed, the postponed menu will pop up and you can select which message you would like to resume.

Note: If you postpone a reply to a message, the reply setting of the message is only updated when you actually finish the message and send it. Also, you must be in the same folder with the message you replied to for the status of the message to be updated.

See also the postpone quad-option.