While the default configuration (or ``preferences'') make Mutt usable right
out of the box, it is often desirable to tailor Mutt to suit your own tastes.
When Mutt is first invoked, it will attempt to read the ``system''
configuration file (defaults set by your local system administrator), unless
command line option is
specified. This file is typically
it looks for a file in your home directory named
.muttrc. In this file
is where you place
commands to configure Mutt.
In addition, mutt supports version specifc configuration files that are
parsed instead of the default files as explained above. For intance, if
your system has a
Muttrc-0.88 file in the system configuration
directory, and you are running version 0.88 of mutt, this file will be
sourced instead of the
Muttrc file. The same is true of the user
configuration file, if you have a file
.muttrc-0.88.6 in your home
directory, when you run mutt version 0.88.6, it will source this file
instead of the default
.muttrc file. The version number is the
same which is visible using the ``-v''
command line switch or using the
show-version key (default:
V) from the index menu.
An initialization file consists of a series of commands, each on its own line. The hash mark, or pound sign (``#''), is used as a ``comment'' character. You can use it to annotate your initialization file. All text after the comment character to the end of the line is ignored. For example,
my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
Single quotes (') and double quotes (") can be used to quote strings which contain spaces or other special characters. The difference between the two types of quotes is similar to that of many popular shell programs, namely that a single quote is used to specify a literal string (one that is not interpreted for shell variables or quoting with a backslash [see next paragraph]), while double quotes indicate a string for which should be evaluated. For example, backtics are evaluated inside of double quotes, but not for single quotes.
\ quotes the next character, just as in shells such as bash and zsh. For example, if want to put quotes ``"'' inside of a string, you can use ``\'' to force the next character to be a literal instead of interpreted character.
set realname="Michael \"MuttDude\" Elkins"
``\\'' means to insert a literal ``\'' into the line. ``\n'' and ``\r'' have their usual C meanings of linefeed and carriage-return, respectively.
A \ at the end of a line can be used to split commands over multiple lines, provided that the split points don't appear in the middle of command names.
It is also possible to substitute the output of a Unix command in an initialization file. This is accomplished by enclosing the command in backquotes (``). For example,
The output of the Unix command ``uname -a'' will be substituted before the line is parsed. Note that since initialization files are line oriented, only the first line of output from the Unix command will be substituted.
my_hdr X-Operating-System: `uname -a`
For a complete list of the commands understood by mutt, see the command reference.
alias key address [ , address, ... ]
It's usually very cumbersome to remember or type out the address of someone you are communicating with. Mutt allows you to create ``aliases'' which map a short string to a full address.
Note: if you want to create an alias for a group (by specifying more than one address), you must separate the addresses with a comma (``,'').
To remove an alias or aliases:
unalias addr [ addr ... ]
alias muttdude email@example.com (Michael Elkins) alias theguys manny, moe, jack
Unlike other mailers, Mutt doesn't require aliases to be defined
in a special file. The
alias command can appear anywhere in
a configuration file, as long as this file is
sourced. Consequently, you can have multiple alias files, or
you can have all aliases defined in your muttrc.
On the other hand, the
function can use only one file, the one pointed to by the
$alias_file variable (which is
~/.muttrc by default). This file is not special either,
in the sense that Mutt will happily append aliases to any file, but in
order for the new aliases to take effect you need to explicitely
source this file too.
source /usr/local/share/Mutt.aliases source ~/.mail_aliases set alias_file=~/.mail_aliases
To use aliases, you merely use the alias at any place in mutt where mutt prompts for addresses, such as the To: or CC: prompt. You can also enter aliases in your editor at the appropirate headers if you have the $edit_hdrs variable set.
In addition, at the various address prompts, you can use the tab character to expand a partial alias to the full alias. If there are multiple matches, mutt will bring up a menu with the matching aliases. In order to be presented with the full list of aliases, you must hit tab with out a partial alias, such as at the beginning of the prompt or after a comma denoting multiple addresses.
In the alias menu, you can select as many aliases as you want with the select-entry key (default: RET), and use the exit key (default: q) to return to the address prompt.
bind map key function
This command allows you to change the default key bindings (operation invoked when pressing a key).
map specifies in which menu the binding belongs. The currently defined maps are:
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. An alternative form is to specify the key as a three digit octal number prefixed with a ``\'' (for example \177 is equivalent to \c?).
In addition, key may consist of:
\t tab \r carriage return \n newline \e escape up up arrow down down arrow left left arrow right right arrow pageup Page Up pagedown Page Down backspace Backspace delete Delete insert Insert enter Enter home Home end End f1 function key 1 f10 function key 10
key does not need to be enclosed in quotes unless it contains a space (`` '').
function specifies which action to take when key is pressed.
For a complete list of functions, see the
reference. The special function
noop unbinds the specify key
folder-hook [!]pattern command
It is often desirable to change settings based on which mailbox you are reading. The folder-hook command provides a method by which you can execute any configuration command. pattern is a regular expression specifying in which mailboxes to execute command before loading. If a mailbox matches multiple folder-hook's, they are executed in the order given in the muttrc.
Note: if you use the ``!'' shortcut for $spoolfile at the beginning of the pattern, you must place it inside of double or single quotes in order to distinguish it from the logical not operator for the expression.
Note that the settings are not restored when you leave the mailbox. For example, a command action to perform is to change the sorting method based upon the mailbox being read:
folder-hook mutt set sort=threads
However, the sorting method is not restored to its previous value when reading a different mailbox. To specify a default command, use the pattern ``.'':
folder-hook . set sort=date-sent
macro menu key sequence
Macros are useful when you would like a single key to perform a series of actions. When you press key in menu menu, Mutt will behave as if you had typed sequence. So if you have a common sequence of commands you type, you can create a macro to execute those commands with a single key.
key and sequence are expanded by the same rules as the key bindings, with the addition that control characters in sequence can also be specified as ^x. In order to get a caret (``^'') you need to use ^^.
Note: Macro definitions (if any) listed in the help screen(s), are silently truncated at the screen width, and are not wrapped.
color object foreground background [ regexp ]
If your terminal supports color, you can spice up Mutt by creating your own color scheme. To define the color of an object (type of information), you must specify both a foreground color and a background color (it is not possible to only specify one or the other).
object can be one of:
foreground and background can be one of the following:
foreground can optionally be prefixed with the keyword
bright to make
the foreground color boldfaced (e.g.,
If your terminal supports it, the special keyword default can be used as a transparent color. The value brightdefault is also valid. If Mutt is linked against the S-Lang library, you also need to set the COLORFGBG environment variable to the default colors of your terminal for this to work; for example (for Bourne-like shells):
set COLORFGBG="green;black" export COLORFGBG
Note: The S-Lang library requires you to use the lightgray and brown keywords instead of white and yellow when setting this variable.
Mutt also recognizes the keywords color0, color1, ..., colorN-1 (N being the number of colors supported by your terminal). This is useful when you remap the colors for your display (for example by changing the color associated with color2 for your xterm), since color names may then lose their normal meaning.
If your terminal does not support color, it is still possible change the video attributes through the use of the ``mono'' command:
mono <object> <attribute> [ regexp ]
where attribute is one of the following:
[un]ignore pattern [ pattern ... ]
Messages often have many header fields added by automatic processing systems, or which may not seem useful to display on the screen. This command allows you to specify header fields which you don't normally want to see.
You do not need to specify the full header field name. For example, ``ignore content-'' will ignore all header fields that begin with the pattern ``content-''.
To remove a previously added token from the list, use the ``unignore'' command. Note that if you do ``ignore x-'' it is not possible to ``unignore x-mailer,'' for example. The ``unignore'' command does not make Mutt display headers with the given pattern.
``unignore *'' will remove all tokens from the ignore list.
# Sven's draconian header weeding ignore * unignore from date subject to cc unignore organization organisation x-mailer: x-newsreader: x-mailing-list: unignore posted-to:
[un]lists address [ address ... ]
Mutt has a few nice features for handling mailing lists. In order to take advantage of them, you must specify which addresses belong to mailing lists.
It is important to note that you should never specify the domain name ( the part after the ``@'') with the lists command. You should only specify the ``mailbox'' portion of the address (the part before the ``@''). For example, if you've subscribed to the Mutt mailing list, you will receive mail addressed to firstname.lastname@example.org. So, to tell Mutt that this is a mailing list, you would add ``lists mutt-users'' to your initialization file.
The ``unlists'' command is to remove a token from the list of mailing-lists. Use ``unlists *'' to remove all tokens.
mbox-hook [!]pattern mailbox
This command is used to move read messages from a specified mailbox to a different mailbox automatically when you quit or change folders. pattern is a regular expression specifying the mailbox to treat as a ``spool'' mailbox and mailbox specifies where mail should be saved when read.
Unlike some of the other hook commands, only the first matching pattern is used (it is not possible to save read mail in more than a single mailbox).
mailboxes [!]filename [ filename ... ]
This command specifies folders which can receive mail and which will be checked for new messages. By default, the main menu status bar displays how many of these folders have new messages.
When changing folders, pressing space will cycle through folders with new mail.
Pressing TAB in the directory browser will bring up a menu showing the files
specified by the
mailboxes command, and indicate which contain new
messages. Mutt will automatically enter this mode when invoked from the
command line with the
Note: new mail is detected by comparing the last modification time to
the last access time. Utilities like
frm or any other
program which accesses the mailbox might cause Mutt to never detect new mail
for that mailbox if they do not properly reset the access time.
Note: the filenames in the
mailboxes command are resolved when
the command is executed, so if these names contain
shortcut characters (such as ``='' and ``!''), any variable
definition that affect these characters (like
should be executed before the
unmy_hdr field [ field ... ]
The ``my_hdr'' command allows you to create your own header fields which will be added to every message you send.
For example, if you would like to add an ``Organization:'' header field to all of your outgoing messages, you can put the command
my_hdr Organization: A Really Big Company, Anytown, USA
Note: space characters are not allowed between the keyword and the colon (``:''). The standard for electronic mail (RFC822) says that space is illegal there, so Mutt enforces the rule.
If you would like to add a header field to a single message, you should either set the edit_hdrs variable, or use the edit-headers function (default: ``E'') in the send-menu so that you can edit the header of your message along with the body.
To remove user defined header fields, use the ``unmy_hdr'' command. You may specify an asterisk (``*'') to remove all header fields, or the fields to remove. For example, to remove all ``To'' and ``Cc'' header fields, you could use:
unmy_hdr to cc
hdr_order header1 header2 header3
With this command, you can specify an order in which mutt will attempt to present headers to you when viewing messages.
hdr_order From Date: From: To: Cc: Subject:
save-hook [!]regexp filename
This command is used to override the default filename used when saving messages. filename will be used as the default filename if the message is From: an address matching regexp or if you are the author and the message is addressed to: something matching regexp.
See matching messages for information on the exact format of regexp.
save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins save-hook aol\\.com$ +spam
Also see the fcc-save-hook command.
fcc-hook [!]regexp mailbox
This command is used to save outgoing mail in a mailbox other than $record. Mutt searches the initial list of message recpients for the first matching regexp and uses mailbox as the default Fcc: mailbox. If no match is found the message will be saved to $record mailbox.
See matching messages for information on the exact format of regexp.
fcc-hook aol.com$ +spammers
The above will save a copy of all messages going to the aol.com domain to the `+spammers' mailbox by default. Also see the fcc-save-hook command.
fcc-save-hook [!]regexp mailbox
This command is a shortcut, equivalent to doing both a fcc-hook and a save-hook with its arguments.
send-hook [!]regexp command
This command can be used to execute arbitrary configuration commands based upon recipients of the message. regexp is a regular expression matching the desired address. command is executed when regexp matches recipients of the message. When multiple matches occur, commands are executed in the order they are specified in the muttrc.
See matching messages for information on the exact format of regexp.
send-hook mutt "set mime_fwd signature=''"
Another typical use for this command is to change the values of the $attribution, $signature and $locale variables in order to change the language of the attributions and signatures based upon the recipients.
Note: the send-hook's are only executed ONCE after getting the initial list of recipients. Adding a recipient after replying or editing the message will NOT cause any send-hook to be executed.
This command adds the named string to the keyboard buffer. You may use it to automatically run a sequence of commands at startup, or when entering certain folders.
score pattern value
unscore pattern [ pattern ... ]
score commands adds value to a message's score if pattern
matches it. pattern is a string in the format described in the
searching section. value is a positive or
negative integer. A message's final score is the sum total of all matching
score entries. However, you may optionally prefix value with an
equal sign (=) to cause evaluation to stop at a particular entry if there is
a match. Negative final scores are rounded up to 0.
unscore command removes score entries from the list. You must
specify the same pattern specified in the
score command for it to be
removed. The pattern ``*'' is a special token which means to clear the list
of all score entries.
set [no|inv]variable[=value] [ variable ... ]
toggle variable [variable ... ]
unset variable [variable ... ]
This command is used to set (and unset) configuration variables. There are four basic types of variables: boolean, number, string and quadoption. boolean variables can be set (true) or unset (false). number variables can be assigned a positive integer value.
string variables consist of any number of printable characters. strings must be enclosed in quotes if they contain spaces or tabs. You may also use the ``C'' escape sequences \n and \t for newline and tab, respectively.
quadoption variables are used to control whether or not to be prompted for certain actions, or to specify a default action. A value of yes will cause the action to be carried out automatically as if you had answered yes to the question. Similarly, a value of no will cause the the action to be carried out as if you had answered ``no.'' A value of ask-yes will cause a prompt with a default answer of ``yes'' and ask-no will provide a default answer of ``no.''
Prefixing a variable with ``no'' will unset it. Example:
For boolean variables, you may optionally prefix the variable name with
inv to toggle the value (on or off). This is useful when writing
toggle command automatically prepends the
inv prefix to all
unset command automatically prepends the
no prefix to all
Using the enter-command function in the index menu, you can query the value of a variable by prefixing the name of the variable with a question mark:
The question mark is actually only required for boolean variables.
This command allows the inclusion of initialization commands
from other files. For example, I place all of my aliases in
~/.mail_aliases so that I can make my
~/.muttrc readable and keep my aliases private.
If the filename begins with a tilde (``~''), it will be expanded to the path of your home directory.