1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Configuration</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="gettingstarted.html" title="Chapter 2. Getting Started" /><link rel="next" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><style xmlns="" type="text/css">
4 body { margin-left:2%; margin-right:2%; font-family:serif; }
5 .toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
6 h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
7 em.replaceable code { font-family:sans-serif; }
8 p { text-align:justify; }
9 div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
10 .email, .email a { font-family:monospace; }
11 div.table-contents table { border-collapse:collapse; border:1px solid #c0c0c0; }
12 div.table-contents table td, div.table-contents table th { padding:5px; text-align:left; }
13 div.table-contents table th {
14 font-family:sans-serif;
19 pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; }
20 div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
21 div.note h3:after { content: ":" }
22 div.note { margin-bottom: 5px; }
24 </style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Configuration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="configuration"></a>Chapter 3. Configuration</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="configuration.html#configuration-files">1. Location of initialization files</a></span></dt><dt><span class="sect1"><a href="configuration.html#muttrc-syntax">2. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">3. Address groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">4. Defining/Using aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">5. Changing the default key bindings</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">6. Defining aliases for character sets </a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">7. Setting variables based upon mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">8. Keyboard macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">9. Using color and mono video attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#ignore">10. Message header display</a></span></dt><dt><span class="sect1"><a href="configuration.html#alternates">11. Alternative addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">12. Mailing lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">13. Using Multiple spool mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">14. Monitoring incoming mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">15. User defined headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">16. Specify default save mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">17. Specify default Fcc: mailbox when composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">18. Specify default save filename and default Fcc: mailbox at once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">19. Change settings based upon message recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">20. Change settings before formatting a message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">21. Choosing the cryptographic key of the recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">22. Adding key sequences to the keyboard buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">23. Executing functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">24. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">25. Spam detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">26. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#set-commands">26.1. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">26.2. User-defined variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">27. Reading initialization commands from another file</a></span></dt><dt><span class="sect1"><a href="configuration.html#ifdef">28. Configuring features conditionnaly</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">29. Removing hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">30. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">30.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">30.2. Filters</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="configuration-files"></a>1. Location of initialization files</h2></div></div></div><p>
25 While the default configuration (or “<span class="quote">preferences</span>”) make Mutt
26 usable right out of the box, it is often desirable to tailor Mutt to
27 suit your own tastes. When Mutt is first invoked, it will attempt to
28 read the “<span class="quote">system</span>” configuration file (defaults set by your local
29 system administrator), unless the “<span class="quote">-n</span>” <a class="link" href="reference.html#commandline" title="1. Command line options">command line</a> option is specified. This file is typically
30 <code class="literal">/usr/local/share/mutt/Muttrc</code> or <code class="literal">/etc/Muttrc</code>. Mutt
31 will next look for a file named <code class="literal">.muttrc</code> in your home
32 directory. If this file does not exist and your home directory has
33 a subdirectory named <code class="literal">.mutt</code>, mutt try to load a file named
34 <code class="literal">.mutt/muttrc</code>.
36 <code class="literal">.muttrc</code> is the file where you will usually place your <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a> to configure Mutt.
38 In addition, mutt supports version specific configuration files that are
39 parsed instead of the default files as explained above. For instance, if
40 your system has a <code class="literal">Muttrc-0.88</code> file in the system configuration
41 directory, and you are running version 0.88 of mutt, this file will be
42 sourced instead of the <code class="literal">Muttrc</code> file. The same is true of the user
43 configuration file, if you have a file <code class="literal">.muttrc-0.88.6</code> in your home
44 directory, when you run mutt version 0.88.6, it will source this file
45 instead of the default <code class="literal">.muttrc</code> file. The version number is the
46 same which is visible using the “<span class="quote">-v</span>” <a class="link" href="reference.html#commandline" title="1. Command line options">command line</a> switch or using the <code class="literal">show-version</code> key (default:
47 V) from the index menu.
48 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="muttrc-syntax"></a>2. Syntax of Initialization Files</h2></div></div></div><p>
49 An initialization file consists of a series of <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a>. Each line of the file may contain one or more commands.
50 When multiple commands are used, they must be separated by a semicolon
52 </p><div class="example"><a id="ex-rc-multiple-cmds"></a><p class="title"><b>Example 3.1. Multiple configuration commands per line</b></p><div class="example-contents"><pre class="screen">
53 set realname='Mutt user' ; ignore x-
54 </pre></div></div><br class="example-break" /><p>
55 The hash mark, or pound sign
56 (“<span class="quote">#</span>”), is used as a “<span class="quote">comment</span>” character. You can use it to
57 annotate your initialization file. All text after the comment character
58 to the end of the line is ignored. For example,
59 </p><div class="example"><a id="ex-ec-comment"></a><p class="title"><b>Example 3.2. Commenting configuration files</b></p><div class="example-contents"><pre class="screen">
60 my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
61 </pre></div></div><br class="example-break" /><p>
62 Single quotes (') and double quotes (") can be used to quote strings
63 which contain spaces or other special characters. The difference between
64 the two types of quotes is similar to that of many popular shell programs,
65 namely that a single quote is used to specify a literal string (one that is
66 not interpreted for shell variables or quoting with a backslash [see
67 next paragraph]), while double quotes indicate a string for which
68 should be evaluated. For example, backticks are evaluated inside of double
69 quotes, but <span class="bold"><strong>not</strong></span> for single quotes.
71 \ quotes the next character, just as in shells such as bash and zsh.
72 For example, if want to put quotes “<span class="quote">"</span>” inside of a string, you can use
73 “<span class="quote">\</span>” to force the next character to be a literal instead of interpreted
75 </p><div class="example"><a id="ex-rc-quote"></a><p class="title"><b>Example 3.3. Escaping quotes in congfiguration files</b></p><div class="example-contents"><pre class="screen">
76 set realname="Michael \"MuttDude\" Elkins"
77 </pre></div></div><br class="example-break" /><p>
78 “<span class="quote">\\</span>” means to insert a literal “<span class="quote">\</span>” into the line.
79 “<span class="quote">\n</span>” and “<span class="quote">\r</span>” have their usual C meanings of linefeed and
80 carriage-return, respectively.
82 A \ at the end of a line can be used to split commands over
83 multiple lines, provided that the split points don't appear in the
84 middle of command names.
86 It is also possible to substitute the output of a Unix command in an
87 initialization file. This is accomplished by enclosing the command in
88 backticks (``). For example,
89 </p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><b>Example 3.4. Using external command's output in configuration files</b></p><div class="example-contents"><pre class="screen">
90 my_hdr X-Operating-System: `uname -a`
91 </pre></div></div><br class="example-break" /><p>
92 The output of the Unix command “<span class="quote">uname -a</span>” will be substituted before the
94 </p><div class="note"><h3 class="title">Note</h3><p>
95 Since initialization files are line oriented, only
96 the first line of output from the Unix command will be substituted.
98 Both environment variables and mutt variables can be accessed by
99 prepending “<span class="quote">$</span>” to the name of the variable. For example,
100 </p><div class="example"><a id="ex-rc-env"></a><p class="title"><b>Example 3.5. Using environment variables in configuration files</b></p><div class="example-contents"><pre class="screen">
101 set record=+sent_on_$HOSTNAME
102 </pre></div></div><br class="example-break" /><p>
103 will cause mutt to save outgoing messages to a folder named
104 “<span class="quote">sent_on_kremvax</span>” if the environment variable HOSTNAME is set to
105 “<span class="quote">kremvax.</span>” (See <a class="link" href="reference.html#record" title="3.242. record">$record</a> for
108 Mutt expands the variable when it is assigned, not when it is used. If
109 the value of a variable on the right-hand side of an assignment
110 changes after the assignment, the variable on the left-hand side will
113 The commands understood by mutt are explained in the next paragraphs.
114 For a complete list, see the <a class="link" href="reference.html#commands" title="2. Configuration Commands">command reference</a>.
116 All configuration files are expected to be in the current locale as
117 specified by the <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a> variable
118 which doesn't have a default value since it's determined by Mutt at startup.
119 If a configuration file is not encoded in the same character set the
120 <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a>
121 variable should be used: all lines starting with the next are recoded
122 from $config_charset to $charset.
124 This mechanism should be avoided if possible as it has the
125 following implications:
126 </p><div class="itemizedlist"><ul type="disc"><li><p>These variables should be set early in a configuration
127 file with $charset preceding $config_charset so Mutt
128 know what character set to convert to.</p></li><li><p>If $config_charset is set, it should be set
129 in each configuration file because the value is global and <span class="emphasis"><em>not</em></span>
130 per configuration file.</p></li><li><p>Because Mutt first recodes a line before it attempts to parse it,
131 a conversion introducing question marks or other characters as
132 part of errors (unconvertable characters, transliteration) may introduce syntax
133 errors or silently change the meaning of certain tokens (e.g. inserting
134 question marks into regular expressions).</p></li></ul></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="addrgroup"></a>3. Address groups</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">group</code> [
135 <code class="option">-group</code>
136 <em class="replaceable"><code>name</code></em>
138 <code class="option">-rx</code>
139 <em class="replaceable"><code>expr</code></em>
141 <code class="option">-addr</code>
142 <em class="replaceable"><code>expr</code></em>
143 ... }</p></div><div class="cmdsynopsis"><p><code class="command">ungroup</code> [
144 <code class="option">-group</code>
145 <em class="replaceable"><code>name</code></em>
147 <em class="replaceable"><code>*</code></em>
149 <code class="option">-rx</code>
150 <em class="replaceable"><code>expr</code></em>
152 <code class="option">-addr</code>
153 <em class="replaceable"><code>expr</code></em>
155 <code class="literal">group</code> is used to directly add either addresses or
156 regular expressions to the specified group or groups. The different
157 categories of arguments to the <code class="literal">group</code> command can be
158 in any order. The flags <code class="literal">-rx</code> and
159 <code class="literal">-addr</code> specify what the following strings (that cannot
160 begin with a hyphen) should be interpreted as: either a regular
161 expression or an email address, respectively.
163 These address groups can also be created implicitly by the
164 <a class="link" href="configuration.html#alias" title="4. Defining/Using aliases">alias</a>, <a class="link" href="configuration.html#lists" title="12. Mailing lists">lists</a>,
165 <a class="link" href="configuration.html#lists" title="12. Mailing lists">subscribe</a> and
166 <a class="link" href="configuration.html#alternates" title="11. Alternative addresses">alternates</a> commands by specifying the
167 optional <code class="literal">-group</code> option.
169 Once defined, these address groups can be used in
170 <a class="link" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">patterns</a> to search for and limit the
171 display to messages matching a group.
173 <code class="literal">ungroup</code> is used to remove addresses or regular
174 expressions from the specified group or groups. The syntax is similar to
175 the <code class="literal">group</code> command, however the special character
176 <code class="literal">*</code> can be used to empty a group of all of its
178 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>4. Defining/Using aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
179 <code class="option">-group</code>
180 <em class="replaceable"><code>name</code></em>
182 <em class="replaceable"><code>key</code></em>
184 <em class="replaceable"><code>address</code></em>
186 <em class="replaceable"><code>address</code></em>
188 It's usually very cumbersome to remember or type out the address of someone
189 you are communicating with. Mutt allows you to create “<span class="quote">aliases</span>” which map
190 a short string to a full address.
191 </p><div class="note"><h3 class="title">Note</h3><p>
192 If you want to create an alias for more than
193 one address, you <span class="bold"><strong>must</strong></span> separate the addresses with a comma (“<span class="quote">,</span>”).
195 The optional <code class="literal">-group</code> argument to
196 <code class="literal">alias</code> causes the aliased address(es) to be added to
197 the named <span class="emphasis"><em>group</em></span>.
199 To remove an alias or aliases (“<span class="quote">*</span>” means all aliases):
200 </p><div class="cmdsynopsis"><p><code class="command">unalias</code> [
201 <code class="option">-group</code>
202 <em class="replaceable"><code>name</code></em>
204 <em class="replaceable"><code>*</code></em>
206 <em class="replaceable"><code>key</code></em>
207 ... }</p></div><pre class="screen">
208 alias muttdude me@cs.hmc.edu (Michael Elkins)
209 alias theguys manny, moe, jack
211 Unlike other mailers, Mutt doesn't require aliases to be defined
212 in a special file. The <code class="literal">alias</code> command can appear anywhere in
213 a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="27. Reading initialization commands from another file">sourced</a>. Consequently, you can have multiple alias files, or
214 you can have all aliases defined in your muttrc.
216 On the other hand, the <a class="link" href="gettingstarted.html#create-alias"><code class="literal"><create-alias></code></a>
217 function can use only one file, the one pointed to by the <a class="link" href="reference.html#alias-file" title="3.3. alias_file">$alias_file</a> variable (which is
218 <code class="literal">˜/.muttrc</code> by default). This file is not special either,
219 in the sense that Mutt will happily append aliases to any file, but in
220 order for the new aliases to take effect you need to explicitly <a class="link" href="configuration.html#source" title="27. Reading initialization commands from another file">source</a> this file too.
223 </p><div class="example"><a id="ex-alias-external"></a><p class="title"><b>Example 3.6. Configuring external alias files</b></p><div class="example-contents"><pre class="screen">
224 source /usr/local/share/Mutt.aliases
225 source ~/.mail_aliases
226 set alias_file=~/.mail_aliases
227 </pre></div></div><br class="example-break" /><p>
228 To use aliases, you merely use the alias at any place in mutt where mutt
229 prompts for addresses, such as the <span class="emphasis"><em>To:</em></span> or <span class="emphasis"><em>Cc:</em></span> prompt. You can
230 also enter aliases in your editor at the appropriate headers if you have the
231 <a class="link" href="reference.html#edit-headers" title="3.50. edit_headers">$edit_headers</a> variable set.
233 In addition, at the various address prompts, you can use the tab character
234 to expand a partial alias to the full alias. If there are multiple matches,
235 mutt will bring up a menu with the matching aliases. In order to be
236 presented with the full list of aliases, you must hit tab with out a partial
237 alias, such as at the beginning of the prompt or after a comma denoting
240 In the alias menu, you can select as many aliases as you want with the
241 <code class="literal">select-entry</code> key (default: <Return>), and use the
242 <span class="emphasis"><em>exit</em></span> key (default: q) to return to the address prompt.
243 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>5. Changing the default key bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
244 <em class="replaceable"><code>map</code></em>
246 <em class="replaceable"><code>key</code></em>
248 <em class="replaceable"><code>function</code></em>
250 This command allows you to change the default key bindings (operation
251 invoked when pressing a key).
253 <span class="emphasis"><em>map</em></span> specifies in which menu the binding belongs. Multiple maps may
254 be specified by separating them with commas (no additional whitespace is
255 allowed). The currently defined maps are:
256 </p><a id="maps"></a><div class="variablelist"><dl><dt><span class="term">generic</span></dt><dd><p>
257 This is not a real menu, but is used as a fallback for all of the other
258 menus except for the pager and editor modes. If a key is not defined in
259 another menu, Mutt will look for a binding to use in this menu. This allows
260 you to bind a key to a certain function in multiple menus instead of having
261 multiple bind statements to accomplish the same task.
262 </p></dd><dt><span class="term">alias</span></dt><dd><p>
263 The alias menu is the list of your personal aliases as defined in your
264 muttrc. It is the mapping from a short alias name to the full email
265 address(es) of the recipient(s).
266 </p></dd><dt><span class="term">attach</span></dt><dd><p>
267 The attachment menu is used to access the attachments on received messages.
268 </p></dd><dt><span class="term">browser</span></dt><dd><p>
269 The browser is used for both browsing the local directory structure, and for
270 listing all of your incoming mailboxes.
271 </p></dd><dt><span class="term">editor</span></dt><dd><p>
272 The editor is the line-based editor the user enters text data.
273 </p></dd><dt><span class="term">index</span></dt><dd><p>
274 The index is the list of messages contained in a mailbox.
275 </p></dd><dt><span class="term">compose</span></dt><dd><p>
276 The compose menu is the screen used when sending a new message.
277 </p></dd><dt><span class="term">pager</span></dt><dd><p>
278 The pager is the mode used to display message/attachment data, and help
280 </p></dd><dt><span class="term">pgp</span></dt><dd><p>
281 The pgp menu is used to select the OpenPGP keys used to encrypt outgoing
283 </p></dd><dt><span class="term">smime</span></dt><dd><p>
284 The smime menu is used to select the OpenSSL certificates used to encrypt outgoing
286 </p></dd><dt><span class="term">postpone</span></dt><dd><p>
287 The postpone menu is similar to the index menu, except is used when
288 recalling a message the user was composing, but saved until later.
289 </p></dd><dt><span class="term">query</span></dt><dd><p>
290 The query menu is the browser for results returned by
291 <a class="link" href="reference.html#query-command" title="3.234. query_command">$query_command</a>.
292 </p></dd><dt><span class="term">mix</span></dt><dd><p>
293 The mixmaster screen is used to select remailer options for outgoing
294 messages (if Mutt is compiled with Mixmaster support).
295 </p></dd></dl></div><p>
296 <span class="emphasis"><em>key</em></span> is the key (or key sequence) you wish to bind. To specify a
297 control character, use the sequence <span class="emphasis"><em>\Cx</em></span>, where <span class="emphasis"><em>x</em></span> is the
298 letter of the control character (for example, to specify control-A use
299 “<span class="quote">\Ca</span>”). Note that the case of <span class="emphasis"><em>x</em></span> as well as <span class="emphasis"><em>\C</em></span> is
300 ignored, so that <span class="emphasis"><em>\CA</em></span>, <span class="emphasis"><em>\Ca</em></span>, <span class="emphasis"><em>\cA</em></span> and <span class="emphasis"><em>\ca</em></span> are all
301 equivalent. An alternative form is to specify the key as a three digit
302 octal number prefixed with a “<span class="quote">\</span>” (for example <span class="emphasis"><em>\177</em></span> is
303 equivalent to <span class="emphasis"><em>\c?</em></span>). In addition, <span class="emphasis"><em>key</em></span> may
304 be a symbolic name as shown in <a class="xref" href="configuration.html#tab-key-names" title="Table 3.1. Symbolic key names">Table 3.1, “Symbolic key names”</a>.
305 </p><div class="table"><a id="tab-key-names"></a><p class="title"><b>Table 3.1. Symbolic key names</b></p><div class="table-contents"><table summary="Symbolic key names" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Symbolic name</th><th>Meaning</th></tr></thead><tbody><tr><td>\t</td><td>tab</td></tr><tr><td><tab></td><td>tab</td></tr><tr><td><backtab></td><td>backtab / shift-tab</td></tr><tr><td>\r</td><td>carriage return</td></tr><tr><td>\n</td><td>newline</td></tr><tr><td>\e</td><td>escape</td></tr><tr><td><esc></td><td>escape</td></tr><tr><td><up></td><td>up arrow</td></tr><tr><td><down></td><td>down arrow</td></tr><tr><td><left></td><td>left arrow</td></tr><tr><td><right></td><td>right arrow</td></tr><tr><td><pageup></td><td>Page Up</td></tr><tr><td><pagedown></td><td>Page Down</td></tr><tr><td><backspace></td><td>Backspace</td></tr><tr><td><delete></td><td>Delete</td></tr><tr><td><insert></td><td>Insert</td></tr><tr><td><enter></td><td>Enter</td></tr><tr><td><return></td><td>Return</td></tr><tr><td><home></td><td>Home</td></tr><tr><td><end></td><td>End</td></tr><tr><td><space></td><td>Space bar</td></tr><tr><td><f1></td><td>function key 1</td></tr><tr><td><f10></td><td>function key 10</td></tr></tbody></table></div></div><br class="table-break" /><p>
306 <span class="emphasis"><em>key</em></span> does not need to be enclosed in quotes unless it contains a
307 space (“<span class="quote"> </span>”) or semi-colon (“<span class="quote">;</span>”).
309 <span class="emphasis"><em>function</em></span> specifies which action to take when <span class="emphasis"><em>key</em></span> is pressed.
310 For a complete list of functions, see the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>. The special function <code class="literal"><noop></code> unbinds the specified key
312 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>6. Defining aliases for character sets </h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
313 <em class="replaceable"><code>alias</code></em>
315 <em class="replaceable"><code>charset</code></em>
316 </p></div><div class="cmdsynopsis"><p><code class="command">iconv-hook</code>
317 <em class="replaceable"><code>charset</code></em>
319 <em class="replaceable"><code>local-charset</code></em>
321 The <code class="literal">charset-hook</code> command defines an alias for a character set.
322 This is useful to properly display messages which are tagged with a
323 character set name not known to mutt.
325 The <code class="literal">iconv-hook</code> command defines a system-specific name for a
326 character set. This is helpful when your systems character
327 conversion library insists on using strange, system-specific names
329 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>7. Setting variables based upon mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
330 <em class="replaceable"><code>[!]regexp</code></em>
332 <em class="replaceable"><code>command</code></em>
334 It is often desirable to change settings based on which mailbox you are
335 reading. The folder-hook command provides a method by which you can execute
336 any configuration command. <span class="emphasis"><em>regexp</em></span> is a regular expression specifying
337 in which mailboxes to execute <span class="emphasis"><em>command</em></span> before loading. If a mailbox
338 matches multiple folder-hook's, they are executed in the order given in the
340 </p><div class="note"><h3 class="title">Note</h3><p>
341 If you use the “<span class="quote">!</span>” shortcut for <a class="link" href="reference.html#spoolfile" title="3.279. spoolfile">$spoolfile</a> at the beginning of the pattern, you must place it
342 inside of double or single quotes in order to distinguish it from the
343 logical <span class="emphasis"><em>not</em></span> operator for the expression.
344 </p></div><div class="note"><h3 class="title">Note</h3><p>
345 Settings are <span class="emphasis"><em>not</em></span> restored when you leave the mailbox.
346 For example, a command action to perform is to change the sorting method
347 based upon the mailbox being read:
348 </p></div><pre class="screen">
349 folder-hook mutt set sort=threads
351 However, the sorting method is not restored to its previous value when
352 reading a different mailbox. To specify a <span class="emphasis"><em>default</em></span> command, use the
353 pattern “<span class="quote">.</span>” before other folder-hooks adjusting a value on a per-folder basis
354 because folder-hooks are evaluated in the order given in the configuration file.
355 The following example will set the <a class="link" href="reference.html#sort" title="3.273. sort">sort</a> variable
356 to <code class="literal">date-sent</code> for all folders but to <code class="literal">threads</code>
357 for all folders containing “<span class="quote">mutt</span>” in their name.
358 </p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><b>Example 3.7. Setting sort method based on mailbox name</b></p><div class="example-contents"><pre class="screen">
359 folder-hook . set sort=date-sent
360 folder-hook mutt set sort=threads
361 </pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>8. Keyboard macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
362 <em class="replaceable"><code>menu</code></em>
364 <em class="replaceable"><code>key</code></em>
366 <em class="replaceable"><code>sequence</code></em>
368 <em class="replaceable"><code>description</code></em>
370 Macros are useful when you would like a single key to perform a series of
371 actions. When you press <span class="emphasis"><em>key</em></span> in menu <span class="emphasis"><em>menu</em></span>, Mutt will behave as if
372 you had typed <span class="emphasis"><em>sequence</em></span>. So if you have a common sequence of commands
373 you type, you can create a macro to execute those commands with a single
376 <span class="emphasis"><em>menu</em></span> is the <a class="link" href="configuration.html#maps">map</a> which the macro will be bound in.
377 Multiple maps may be specified by separating multiple menu arguments by
378 commas. Whitespace may not be used in between the menu arguments and the
379 commas separating them.
381 <span class="emphasis"><em>key</em></span> and <span class="emphasis"><em>sequence</em></span> are expanded by the same rules as the
382 <a class="link" href="configuration.html#bind" title="5. Changing the default key bindings">key bindings</a> with some additions. The
383 first is that control characters in <span class="emphasis"><em>sequence</em></span> can also be specified
384 as <span class="emphasis"><em>^x</em></span>. In order to get a caret (“<span class="quote">^</span>”) you need to use
385 <span class="emphasis"><em>^^</em></span>. Secondly, to specify a certain key such as <span class="emphasis"><em>up</em></span>
386 or to invoke a function directly, you can use the format
387 <span class="emphasis"><em><key name></em></span> and <span class="emphasis"><em><function name></em></span>. For a listing of key
388 names see the section on <a class="link" href="configuration.html#bind" title="5. Changing the default key bindings">key bindings</a>. Functions
389 are listed in the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>.
391 The advantage with using function names directly is that the macros will
392 work regardless of the current key bindings, so they are not dependent on
393 the user having particular key definitions. This makes them more robust
394 and portable, and also facilitates defining of macros in files used by more
395 than one user (e.g., the system Muttrc).
397 Optionally you can specify a descriptive text after <span class="emphasis"><em>sequence</em></span>,
398 which is shown in the help screens.
399 </p><div class="note"><h3 class="title">Note</h3><p>
400 Macro definitions (if any) listed in the help screen(s), are
401 silently truncated at the screen width, and are not wrapped.
402 </p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="color"></a>9. Using color and mono video attributes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">color</code>
403 <em class="replaceable"><code>object</code></em>
405 <em class="replaceable"><code>foreground</code></em>
407 <em class="replaceable"><code>background</code></em>
408 </p></div><div class="cmdsynopsis"><p><code class="command">color</code> {
409 <code class="option">header</code>
411 <code class="option">body</code>
413 <em class="replaceable"><code>foreground</code></em>
415 <em class="replaceable"><code>background</code></em>
417 <em class="replaceable"><code>regexp</code></em>
418 </p></div><div class="cmdsynopsis"><p><code class="command">color</code>
419 <code class="option">index</code>
421 <em class="replaceable"><code>foreground</code></em>
423 <em class="replaceable"><code>background</code></em>
425 <em class="replaceable"><code>pattern</code></em>
426 </p></div><div class="cmdsynopsis"><p><code class="command">uncolor</code>
427 <code class="option">index</code>
429 <em class="replaceable"><code>*</code></em>
431 <em class="replaceable"><code>pattern</code></em>
433 If your terminal supports color, you can spice up Mutt by creating your own
434 color scheme. To define the color of an object (type of information), you
435 must specify both a foreground color <span class="bold"><strong>and</strong></span> a background color (it is not
436 possible to only specify one or the other).
438 <span class="emphasis"><em>header</em></span> and <span class="emphasis"><em>body</em></span> match <span class="emphasis"><em>regexp</em></span>
439 in the header/body of a message, <span class="emphasis"><em>index</em></span> matches <span class="emphasis"><em>pattern</em></span>
440 (see <a class="xref" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">Section 2, “Patterns: Searching, Limiting and Tagging”</a>) in the message index.
442 <span class="emphasis"><em>object</em></span> can be one of:
443 </p><div class="itemizedlist"><ul type="disc"><li><p>attachment</p></li><li><p>bold (hiliting bold patterns in the body of messages)</p></li><li><p>error (error messages printed by Mutt)</p></li><li><p>hdrdefault (default color of the message header in the pager)</p></li><li><p>indicator (arrow or bar used to indicate the current item in a menu)</p></li><li><p>markers (the “<span class="quote">+</span>” markers at the beginning of wrapped lines in the pager)</p></li><li><p>message (informational messages)</p></li><li><p>normal</p></li><li><p>quoted (text matching <a class="link" href="reference.html#quote-regexp" title="3.237. quote_regexp">$quote_regexp</a> in the body of a message)</p></li><li><p>quoted1, quoted2, ..., quoted<span class="bold"><strong>N</strong></span> (higher levels of quoting)</p></li><li><p>search (hiliting of words in the pager)</p></li><li><p>signature</p></li><li><p>status (mode lines used to display info about the mailbox or message)</p></li><li><p>tilde (the “<span class="quote">˜</span>” used to pad blank lines in the pager)</p></li><li><p>tree (thread tree drawn in the message index and attachment menu)</p></li><li><p>underline (hiliting underlined patterns in the body of messages)</p></li></ul></div><p>
444 <span class="emphasis"><em>foreground</em></span> and <span class="emphasis"><em>background</em></span> can be one of the following:
445 </p><div class="itemizedlist"><ul type="disc"><li><p>white</p></li><li><p>black</p></li><li><p>green</p></li><li><p>magenta</p></li><li><p>blue</p></li><li><p>cyan</p></li><li><p>yellow</p></li><li><p>red</p></li><li><p>default</p></li><li><p>color<span class="emphasis"><em>x</em></span></p></li></ul></div><p>
446 <span class="emphasis"><em>foreground</em></span> can optionally be prefixed with the keyword <code class="literal">bright</code> to make
447 the foreground color boldfaced (e.g., <code class="literal">brightred</code>).
449 If your terminal supports it, the special keyword <span class="emphasis"><em>default</em></span> can be
450 used as a transparent color. The value <span class="emphasis"><em>brightdefault</em></span> is also valid.
451 If Mutt is linked against the <span class="emphasis"><em>S-Lang</em></span> library, you also need to set
452 the <span class="emphasis"><em>COLORFGBG</em></span> environment variable to the default colors of your
453 terminal for this to work; for example (for Bourne-like shells):
454 </p><pre class="screen">
455 set COLORFGBG="green;black"
457 </pre><div class="note"><h3 class="title">Note</h3><p>
458 The <span class="emphasis"><em>S-Lang</em></span> library requires you to use the <span class="emphasis"><em>lightgray</em></span>
459 and <span class="emphasis"><em>brown</em></span> keywords instead of <span class="emphasis"><em>white</em></span> and <span class="emphasis"><em>yellow</em></span> when
460 setting this variable.
461 </p></div><div class="note"><h3 class="title">Note</h3><p>
462 The uncolor command can be applied to the index object only. It
463 removes entries from the list. You <span class="bold"><strong>must</strong></span> specify the same pattern
464 specified in the color command for it to be removed. The pattern “<span class="quote">*</span>” is
465 a special token which means to clear the color index list of all entries.
467 Mutt also recognizes the keywords <span class="emphasis"><em>color0</em></span>, <span class="emphasis"><em>color1</em></span>, …,
468 <span class="emphasis"><em>color</em></span><span class="bold"><strong>N-1</strong></span> (<span class="bold"><strong>N</strong></span> being the number of colors supported
469 by your terminal). This is useful when you remap the colors for your
470 display (for example by changing the color associated with <span class="emphasis"><em>color2</em></span>
471 for your xterm), since color names may then lose their normal meaning.
473 If your terminal does not support color, it is still possible change the video
474 attributes through the use of the “<span class="quote">mono</span>” command:
475 </p><a id="mono"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mono</code>
476 <em class="replaceable"><code>object</code></em>
478 <em class="replaceable"><code>attribute</code></em>
479 </p></div><div class="cmdsynopsis"><p><code class="command">mono</code> {
480 <code class="option">header</code>
482 <code class="option">body</code>
484 <em class="replaceable"><code>attribute</code></em>
486 <em class="replaceable"><code>regexp</code></em>
487 </p></div><div class="cmdsynopsis"><p><code class="command">mono</code>
488 <code class="option">index</code>
490 <em class="replaceable"><code>attribute</code></em>
492 <em class="replaceable"><code>pattern</code></em>
493 </p></div><div class="cmdsynopsis"><p><code class="command">unmono</code>
494 <code class="option">index</code>
496 <em class="replaceable"><code>*</code></em>
498 <em class="replaceable"><code>pattern</code></em>
500 For <span class="emphasis"><em>object</em></span>, see the color command. <span class="emphasis"><em>attribute</em></span>
501 can be one of the following:
502 </p><div class="itemizedlist"><ul type="disc"><li><p>none</p></li><li><p>bold</p></li><li><p>underline</p></li><li><p>reverse</p></li><li><p>standout</p></li></ul></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ignore"></a>10. Message header display</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">ignore</code>
503 <em class="replaceable"><code>pattern</code></em>
505 <em class="replaceable"><code>pattern</code></em>
506 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unignore</code> {
507 <em class="replaceable"><code>*</code></em>
509 <em class="replaceable"><code>pattern</code></em>
511 Messages often have many header fields added by automatic processing systems,
512 or which may not seem useful to display on the screen. This command allows
513 you to specify header fields which you don't normally want to see in the pager.
515 You do not need to specify the full header field name. For example,
516 “<span class="quote">ignore content-</span>” will ignore all header fields that begin with the pattern
517 “<span class="quote">content-</span>”. “<span class="quote">ignore *</span>” will ignore all headers.
519 To remove a previously added token from the list, use the “<span class="quote">unignore</span>” command.
520 The “<span class="quote">unignore</span>” command will make Mutt display headers with the given pattern.
521 For example, if you do “<span class="quote">ignore x-</span>” it is possible to “<span class="quote">unignore x-mailer</span>”.
523 “<span class="quote">unignore *</span>” will remove all tokens from the ignore list.
526 </p><div class="example"><a id="ex-header-weeding"></a><p class="title"><b>Example 3.8. Header weeding</b></p><div class="example-contents"><pre class="screen">
527 # Sven's draconian header weeding
529 unignore from date subject to cc
530 unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
532 </pre></div></div><br class="example-break" /><a id="hdr-order"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
533 <em class="replaceable"><code>header</code></em>
535 <em class="replaceable"><code>header</code></em>
536 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unhdr_order</code> {
537 <em class="replaceable"><code>*</code></em>
539 <em class="replaceable"><code>header</code></em>
541 With the <code class="literal">hdr_order</code> command you can specify an order in
542 which mutt will attempt to present these headers to you when viewing messages.
544 “<span class="quote">unhdr_order *</span>” will clear all previous headers from the order list,
545 thus removing the header order effects set by the system-wide startup file.
546 </p><div class="example"><a id="ex-hdr-order"></a><p class="title"><b>Example 3.9. Configuring header display order</b></p><div class="example-contents"><pre class="screen">
547 hdr_order From Date: From: To: Cc: Subject:
548 </pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>11. Alternative addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
549 <code class="option">-group</code>
550 <em class="replaceable"><code>name</code></em>
552 <em class="replaceable"><code>regexp</code></em>
554 <em class="replaceable"><code>regexp</code></em>
555 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unalternates</code> [
556 <code class="option">-group</code>
557 <em class="replaceable"><code>name</code></em>
559 <em class="replaceable"><code>*</code></em>
561 <em class="replaceable"><code>regexp</code></em>
563 With various functions, mutt will treat messages differently,
564 depending on whether you sent them or whether you received them from
565 someone else. For instance, when replying to a message that you
566 sent to a different party, mutt will automatically suggest to send
567 the response to the original message's recipients -- responding to
568 yourself won't make much sense in many cases. (See <a class="link" href="reference.html#reply-to" title="3.245. reply_to">$reply_to</a>.)
570 Many users receive e-mail under a number of different addresses. To
571 fully use mutt's features here, the program must be able to
572 recognize what e-mail addresses you receive mail under. That's the
573 purpose of the <code class="literal">alternates</code> command: It takes a list of regular
574 expressions, each of which can identify an address under which you
577 As addresses are matched using regular expressions and not exact strict
578 comparisons, you should make sure you specify your addresses as precise
579 as possible to avoid mismatches. For example, if you specify:
580 </p><pre class="screen">
581 alternates user@example
583 mutt will consider “<span class="quote"><code class="literal">some-user@example</code></span>” as
584 being your address, too which may not be desired. As a solution, in such
585 cases addresses should be specified as:
586 </p><pre class="screen">
587 alternates '^user@example$'
589 The <code class="literal">-group</code> flag causes all of the subsequent regular expressions
590 to be added to the named group.
592 The <code class="literal">unalternates</code> command can be used to write exceptions to
593 <code class="literal">alternates</code> patterns. If an address matches something in an
594 <code class="literal">alternates</code> command, but you nonetheless do not think it is
595 from you, you can list a more precise pattern under an <code class="literal">unalternates</code>
598 To remove a regular expression from the <code class="literal">alternates</code> list, use the
599 <code class="literal">unalternates</code> command with exactly the same <span class="emphasis"><em>regexp</em></span>.
600 Likewise, if the <span class="emphasis"><em>regexp</em></span> for an <code class="literal">alternates</code> command matches
601 an entry on the <code class="literal">unalternates</code> list, that <code class="literal">unalternates</code>
602 entry will be removed. If the <span class="emphasis"><em>regexp</em></span> for <code class="literal">unalternates</code>
603 is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries</em></span> on <code class="literal">alternates</code> will be removed.
604 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>12. Mailing lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
605 <code class="option">-group</code>
606 <em class="replaceable"><code>name</code></em>
608 <em class="replaceable"><code>regexp</code></em>
610 <em class="replaceable"><code>regexp</code></em>
611 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unlists</code> [
612 <code class="option">-group</code>
613 <em class="replaceable"><code>name</code></em>
615 <em class="replaceable"><code>*</code></em>
617 <em class="replaceable"><code>regexp</code></em>
618 ... }</p></div><div class="cmdsynopsis"><p><code class="command">subscribe</code> [
619 <code class="option">-group</code>
620 <em class="replaceable"><code>name</code></em>
622 <em class="replaceable"><code>regexp</code></em>
624 <em class="replaceable"><code>regexp</code></em>
625 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unsubscribe</code> [
626 <code class="option">-group</code>
627 <em class="replaceable"><code>name</code></em>
629 <em class="replaceable"><code>*</code></em>
631 <em class="replaceable"><code>regexp</code></em>
633 Mutt has a few nice features for <a class="link" href="advancedusage.html#using-lists" title="8. Handling Mailing Lists">handling mailing lists</a>. In order to take advantage of them, you must
634 specify which addresses belong to mailing lists, and which mailing
635 lists you are subscribed to. Once you have done this, the <a class="link" href="gettingstarted.html#list-reply"><code class="literal"><list-reply></code></a> function will work for all known lists.
636 Additionally, when you send a message to a subscribed list, mutt will
637 add a Mail-Followup-To header to tell other users' mail user agents
638 not to send copies of replies to your personal address.
639 </p><div class="note"><h3 class="title">Note</h3><p>
640 The Mail-Followup-To header is a non-standard extension which is not
641 supported by all mail user agents. Adding it is not bullet-proof against
642 receiving personal CCs of list messages. Also note that the generation
643 of the Mail-Followup-To header is controlled by the
644 <a class="link" href="reference.html#followup-to" title="3.60. followup_to">$followup_to</a>
645 configuration variable.
647 More precisely, Mutt maintains lists of patterns for the addresses
648 of known and subscribed mailing lists. Every subscribed mailing
649 list is known. To mark a mailing list as known, use the “<span class="quote">lists</span>”
650 command. To mark it as subscribed, use “<span class="quote">subscribe</span>”.
652 You can use regular expressions with both commands. To mark all
653 messages sent to a specific bug report's address on mutt's bug
654 tracking system as list mail, for instance, you could say
655 “<span class="quote">subscribe [0-9]*@bugs.guug.de</span>”. Often, it's sufficient to just
656 give a portion of the list's e-mail address.
658 Specify as much of the address as you need to to remove ambiguity. For
659 example, if you've subscribed to the Mutt mailing list, you will receive mail
660 addressed to <span class="emphasis"><em>mutt-users@mutt.org</em></span>. So, to tell Mutt
661 that this is a mailing list, you could add “<span class="quote">lists mutt-users@</span>” to your
662 initialization file. To tell mutt that you are subscribed to it,
663 add “<span class="quote">subscribe mutt-users</span>” to your initialization file instead.
664 If you also happen to get mail from someone whose address is
665 <span class="emphasis"><em>mutt-users@example.com</em></span>, you could use
666 “<span class="quote">lists ^mutt-users@mutt\\.org$</span>”
667 or “<span class="quote">subscribe ^mutt-users@mutt\\.org$</span>” to
668 match only mail from the actual list.
670 The <code class="literal">-group</code> flag adds all of the subsequent regular expressions
673 The “<span class="quote">unlists</span>” command is used to remove a token from the list of
674 known and subscribed mailing-lists. Use “<span class="quote">unlists *</span>” to remove all
677 To remove a mailing list from the list of subscribed mailing lists,
678 but keep it on the list of known mailing lists, use “<span class="quote">unsubscribe</span>”.
679 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mbox-hook"></a>13. Using Multiple spool mailboxes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mbox-hook</code>
680 <em class="replaceable"><code>[!]pattern</code></em>
682 <em class="replaceable"><code>mailbox</code></em>
684 This command is used to move read messages from a specified mailbox to a
685 different mailbox automatically when you quit or change folders.
686 <span class="emphasis"><em>pattern</em></span> is a regular expression specifying the mailbox to treat as a
687 “<span class="quote">spool</span>” mailbox and <span class="emphasis"><em>mailbox</em></span> specifies where mail should be saved when
690 Unlike some of the other <span class="emphasis"><em>hook</em></span> commands, only the <span class="emphasis"><em>first</em></span> matching
691 pattern is used (it is not possible to save read mail in more than a single
693 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailboxes"></a>14. Monitoring incoming mail</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mailboxes</code>
694 <em class="replaceable"><code>mailbox</code></em>
696 <em class="replaceable"><code>mailbox</code></em>
697 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unmailboxes</code> {
698 <em class="replaceable"><code>*</code></em>
700 <em class="replaceable"><code>mailbox</code></em>
702 This command specifies folders which can receive mail and
703 which will be checked for new messages periodically.
705 <span class="emphasis"><em>folder</em></span> can either be a local file or directory
706 (Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP
707 support, <span class="emphasis"><em>folder</em></span> can also be a POP/IMAP folder
708 URL. The URL syntax is described in <a class="xref" href="optionalfeatures.html#url-syntax" title="1.2. URL syntax">Section 1.2, “URL syntax”</a>,
709 POP and IMAP are described in <a class="xref" href="optionalfeatures.html#pop" title="3. POP3 Support">Section 3, “POP3 Support”</a> and <a class="xref" href="optionalfeatures.html#imap" title="4. IMAP Support">Section 4, “IMAP Support”</a>
712 Mutt provides a number of advanced features for handling (possibly many)
713 folders and new mail within them, please refer to
714 <a class="xref" href="advancedusage.html#handling-folders" title="9. Handling multiple folders">Section 9, “Handling multiple folders”</a> for details (including in what
715 situations and how often Mutt checks for new mail).
717 The “<span class="quote">unmailboxes</span>” command is used to remove a token from the list
718 of folders which receive mail. Use “<span class="quote">unmailboxes *</span>” to remove all
720 </p><div class="note"><h3 class="title">Note</h3><p>
721 The folders in the <code class="literal">mailboxes</code> command are resolved when
722 the command is executed, so if these names contain <a class="link" href="advancedusage.html#shortcuts" title="7. Mailbox Shortcuts">shortcut characters</a> (such as “<span class="quote">=</span>” and “<span class="quote">!</span>”), any variable
723 definition that affects these characters (like <a class="link" href="reference.html#folder" title="3.58. folder">$folder</a> and <a class="link" href="reference.html#spoolfile" title="3.279. spoolfile">$spoolfile</a>)
724 should be set before the <code class="literal">mailboxes</code> command. If
725 none of these shorcuts are used, a local path should be absolute as
726 otherwise mutt tries to find it relative to the directory
727 from where mutt was started which may not always be desired.
729 For Mbox and Mmdf folders, new mail is detected by comparing access and/or
730 modification times of files: Mutt assumes a folder has new mail if it wasn't
731 accessed after it was last modified. Utilities like <code class="literal">biff</code> or
732 <code class="literal">frm</code> or any other program which accesses the mailbox might cause
733 Mutt to never detect new mail for that mailbox if they do not properly reset the
734 access time. Other possible causes of Mutt not detecting new mail in these folders
735 are backup tools (updating access times) or filesystems mounted without
736 access time update support.
738 In cases where new mail detection for Mbox or Mmdf folders appears to be
740 <a class="link" href="reference.html#check-mbox-size" title="3.24. check_mbox_size">$check_mbox_size</a>
741 option can be used to make Mutt track and consult file sizes for new
742 mail detection instead.
743 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>15. User defined headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
744 <em class="replaceable"><code>string</code></em>
745 </p></div><div class="cmdsynopsis"><p><code class="command">unmy_hdr</code> {
746 <em class="replaceable"><code>*</code></em>
748 <em class="replaceable"><code>field</code></em>
750 The <code class="literal">my_hdr</code> command allows you to create your own header
751 fields which will be added to every message you send.
753 For example, if you would like to add an “<span class="quote">Organization:</span>” header field to
754 all of your outgoing messages, you can put the command
755 </p><div class="example"><a id="ex-my-hdr"></a><p class="title"><b>Example 3.10. Defining custom headers</b></p><div class="example-contents"><pre class="screen">
756 my_hdr Organization: A Really Big Company, Anytown, USA
757 </pre></div></div><br class="example-break" /><p>
758 in your <code class="literal">.muttrc</code>.
759 </p><div class="note"><h3 class="title">Note</h3><p>
760 Space characters are <span class="emphasis"><em>not</em></span> allowed between the keyword and
761 the colon (“<span class="quote">:</span>”). The standard for electronic mail (RFC2822) says that
762 space is illegal there, so Mutt enforces the rule.
764 If you would like to add a header field to a single message, you should
765 either set the <a class="link" href="reference.html#edit-headers" title="3.50. edit_headers">$edit_headers</a> variable,
766 or use the <code class="literal"><edit-headers></code> function (default: “<span class="quote">E</span>”) in the compose menu so
767 that you can edit the header of your message along with the body.
769 To remove user defined header fields, use the <code class="literal">unmy_hdr</code>
770 command. You may specify an asterisk (“<span class="quote">*</span>”) to remove all header
771 fields, or the fields to remove. For example, to remove all “<span class="quote">To</span>” and
772 “<span class="quote">Cc</span>” header fields, you could use:
773 </p><pre class="screen">
775 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>16. Specify default save mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
776 <em class="replaceable"><code>[!]pattern</code></em>
778 <em class="replaceable"><code>mailbox</code></em>
780 This command is used to override the default mailbox used when saving
781 messages. <span class="emphasis"><em>mailbox</em></span> will be used as the default if the message
782 matches <span class="emphasis"><em>pattern</em></span>, see <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for information
785 To provide more flexibility and good defaults, Mutt applies the
786 expandos of <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> to
787 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
790 </p><div class="example"><a id="ex-save-hook-exando"></a><p class="title"><b>Example 3.11. Using %-expandos in <code class="literal">save-hook</code></b></p><div class="example-contents"><pre class="screen">
791 # default: save all to ~/Mail/<author name>
792 save-hook . ~/Mail/%F
794 # save from me@turing.cs.hmc.edu and me@cs.hmc.edu to $folder/elkins
795 save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
797 # save from aol.com to $folder/spam
798 save-hook aol\\.com$ +spam
799 </pre></div></div><br class="example-break" /><p>
800 Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify default save filename and default Fcc: mailbox at once">fcc-save-hook</a> command.
801 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>17. Specify default Fcc: mailbox when composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
802 <em class="replaceable"><code>[!]pattern</code></em>
804 <em class="replaceable"><code>mailbox</code></em>
806 This command is used to save outgoing mail in a mailbox other than
807 <a class="link" href="reference.html#record" title="3.242. record">$record</a>. Mutt searches the initial list of
808 message recipients for the first matching <span class="emphasis"><em>regexp</em></span> and uses <span class="emphasis"><em>mailbox</em></span>
809 as the default Fcc: mailbox. If no match is found the message will be saved
810 to <a class="link" href="reference.html#record" title="3.242. record">$record</a> mailbox.
812 To provide more flexibility and good defaults, Mutt applies the
813 expandos of <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> to
814 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
816 See <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format of <span class="emphasis"><em>pattern</em></span>.
818 Example: <code class="literal">fcc-hook [@.]aol\\.com$ +spammers</code>
820 The above will save a copy of all messages going to the aol.com domain to
821 the `+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify default save filename and default Fcc: mailbox at once">fcc-save-hook</a> command.
822 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>18. Specify default save filename and default Fcc: mailbox at once</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-save-hook</code>
823 <em class="replaceable"><code>[!]pattern</code></em>
825 <em class="replaceable"><code>mailbox</code></em>
827 This command is a shortcut, equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="17. Specify default Fcc: mailbox when composing">fcc-hook</a>
828 and a <a class="link" href="configuration.html#save-hook" title="16. Specify default save mailbox">save-hook</a> with its arguments,
829 including %-expansion on <span class="emphasis"><em>mailbox</em></span> according
830 to <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a>.
831 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>19. Change settings based upon message recipients</h2></div></div></div><a id="reply-hook"></a><a id="send2-hook"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">reply-hook</code>
832 <em class="replaceable"><code>[!]pattern</code></em>
834 <em class="replaceable"><code>command</code></em>
835 </p></div><div class="cmdsynopsis"><p><code class="command">send-hook</code>
836 <em class="replaceable"><code>[!]pattern</code></em>
838 <em class="replaceable"><code>command</code></em>
839 </p></div><div class="cmdsynopsis"><p><code class="command">send2-hook</code>
840 <em class="replaceable"><code>[!]pattern</code></em>
842 <em class="replaceable"><code>command</code></em>
844 These commands can be used to execute arbitrary configuration commands based
845 upon recipients of the message. <span class="emphasis"><em>pattern</em></span> is used to match
846 the message, see <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for details. <span class="emphasis"><em>command</em></span>
847 is executed when <span class="emphasis"><em>pattern</em></span> matches.
849 <code class="literal">reply-hook</code> is matched against the message you are <span class="emphasis"><em>replying to</em></span>,
850 instead of the message you are <span class="emphasis"><em>sending</em></span>. <code class="literal">send-hook</code> is
851 matched against all messages, both <span class="emphasis"><em>new</em></span>
852 and <span class="emphasis"><em>replies</em></span>.
853 </p><div class="note"><h3 class="title">Note</h3><p>
854 <code class="literal">reply-hook</code>s are matched <span class="bold"><strong>before</strong></span> the <code class="literal">send-hook</code>, <span class="bold"><strong>regardless</strong></span>
855 of the order specified in the user's configuration file.
857 <code class="literal">send2-hook</code> is matched every time a message is changed, either
858 by editing it, or by using the compose menu to change its recipients
859 or subject. <code class="literal">send2-hook</code> is executed after <code class="literal">send-hook</code>, and
860 can, e.g., be used to set parameters such as the <a class="link" href="reference.html#sendmail" title="3.260. sendmail">$sendmail</a> variable depending on the message's sender
863 For each type of <code class="literal">send-hook</code> or <code class="literal">reply-hook</code>, when multiple matches
864 occur, commands are executed in the order they are specified in the muttrc
865 (for that type of hook).
867 Example: <code class="literal">send-hook mutt "set mime_forward signature=''"</code>
869 Another typical use for this command is to change the values of the
870 <a class="link" href="reference.html#attribution" title="3.16. attribution">$attribution</a>, <a class="link" href="reference.html#signature" title="3.265. signature">$signature</a> and <a class="link" href="reference.html#locale" title="3.104. locale">$locale</a>
871 variables in order to change the language of the attributions and
872 signatures based upon the recipients.
873 </p><div class="note"><h3 class="title">Note</h3><p>
874 send-hook's are only executed once after getting the initial
875 list of recipients. Adding a recipient after replying or editing the
876 message will not cause any send-hook to be executed. Also note that
877 <code class="literal">my_hdr</code> commands which modify recipient headers, or the message's
878 subject, don't have any effect on the current message when executed
880 </p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>20. Change settings before formatting a message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
881 <em class="replaceable"><code>[!]pattern</code></em>
883 <em class="replaceable"><code>command</code></em>
885 This command can be used to execute arbitrary configuration commands
886 before viewing or formatting a message based upon information about the message.
887 <span class="emphasis"><em>command</em></span> is executed if the <span class="emphasis"><em>pattern</em></span> matches the message to be
888 displayed. When multiple matches occur, commands are executed in the order
889 they are specified in the muttrc.
891 See <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for
892 information on the exact format of <span class="emphasis"><em>pattern</em></span>.
895 </p><pre class="screen">
896 message-hook ~A 'set pager=builtin'
897 message-hook '~f freshmeat-news' 'set pager="less \"+/^ subject: .*\""'
898 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="crypt-hook"></a>21. Choosing the cryptographic key of the recipient</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">crypt-hook</code>
899 <em class="replaceable"><code>pattern</code></em>
901 <em class="replaceable"><code>keyid</code></em>
903 When encrypting messages with PGP/GnuPG or OpenSSL, you may want to associate a certain
904 key with a given e-mail address automatically, either because the
905 recipient's public key can't be deduced from the destination address,
906 or because, for some reasons, you need to override the key Mutt would
907 normally use. The <code class="literal">crypt-hook</code> command provides a
908 method by which you can specify the ID of the public key to be used
909 when encrypting messages to a certain recipient.
911 The meaning of <span class="emphasis"><em>keyid</em></span> is to be taken broadly in this context: You
912 can either put a numerical key ID here, an e-mail address, or even
914 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>22. Adding key sequences to the keyboard buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
915 <em class="replaceable"><code>string</code></em>
917 This command adds the named string to the keyboard buffer. The string may
918 contain control characters, key names and function names like the sequence
919 string in the <a class="link" href="configuration.html#macro" title="8. Keyboard macros">macro</a> command. You may use it to
920 automatically run a sequence of commands at startup, or when entering
921 certain folders. For example, the following command will automatically
922 collapse all threads when entering a folder:
923 </p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><b>Example 3.12. Embedding <code class="literal">push</code> in <code class="literal">folder-hook</code></b></p><div class="example-contents"><pre class="screen">
924 folder-hook . 'push <collapse-all>'
925 </pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>23. Executing functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
926 <em class="replaceable"><code>function</code></em>
928 <em class="replaceable"><code>function</code></em>
930 This command can be used to execute any function. Functions are
931 listed in the <a class="link" href="reference.html#functions" title="4. Functions">function reference</a>.
932 “<span class="quote">exec function</span>” is equivalent to “<span class="quote">push <function></span>”.
933 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="score-command"></a>24. Message Scoring</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">score</code>
934 <em class="replaceable"><code>pattern</code></em>
936 <em class="replaceable"><code>value</code></em>
937 </p></div><div class="cmdsynopsis"><p><code class="command">unscore</code> {
938 <em class="replaceable"><code>*</code></em>
940 <em class="replaceable"><code>pattern</code></em>
942 The <code class="literal">score</code> commands adds <span class="emphasis"><em>value</em></span> to a message's score if <span class="emphasis"><em>pattern</em></span>
943 matches it. <span class="emphasis"><em>pattern</em></span> is a string in the format described in the <a class="link" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">patterns</a> section (note: For efficiency reasons, patterns
944 which scan information not available in the index, such as <code class="literal">˜b</code>,
945 <code class="literal">˜B</code> or <code class="literal">˜h</code>, may not be used). <span class="emphasis"><em>value</em></span> is a
946 positive or negative integer. A message's final score is the sum total of all
947 matching <code class="literal">score</code> entries. However, you may optionally prefix <span class="emphasis"><em>value</em></span> with
948 an equal sign (=) to cause evaluation to stop at a particular entry if there is
949 a match. Negative final scores are rounded up to 0.
951 The <code class="literal">unscore</code> command removes score entries from the list. You <span class="bold"><strong>must</strong></span>
952 specify the same pattern specified in the <code class="literal">score</code> command for it to be
953 removed. The pattern “<span class="quote">*</span>” is a special token which means to clear the list
954 of all score entries.
955 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>25. Spam detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
956 <em class="replaceable"><code>pattern</code></em>
958 <em class="replaceable"><code>format</code></em>
959 </p></div><div class="cmdsynopsis"><p><code class="command">nospam</code> {
960 <em class="replaceable"><code>*</code></em>
962 <em class="replaceable"><code>pattern</code></em>
964 Mutt has generalized support for external spam-scoring filters.
965 By defining your spam patterns with the <code class="literal">spam</code> and <code class="literal">nospam</code>
966 commands, you can <span class="emphasis"><em>limit</em></span>, <span class="emphasis"><em>search</em></span>, and <span class="emphasis"><em>sort</em></span> your
967 mail based on its spam attributes, as determined by the external
968 filter. You also can display the spam attributes in your index
969 display using the <code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> variable. (Tip: try <code class="literal">%?H?[%H] ?</code>
970 to display spam tags only when they are defined for a given message.)
972 Your first step is to define your external filter's spam patterns using
973 the <code class="literal">spam</code> command. <span class="emphasis"><em>pattern</em></span> should be a regular expression
974 that matches a header in a mail message. If any message in the mailbox
975 matches this regular expression, it will receive a “<span class="quote">spam tag</span>” or
976 “<span class="quote">spam attribute</span>” (unless it also matches a <code class="literal">nospam</code> pattern -- see
977 below.) The appearance of this attribute is entirely up to you, and is
978 governed by the <span class="emphasis"><em>format</em></span> parameter. <span class="emphasis"><em>format</em></span> can be any static
979 text, but it also can include back-references from the <span class="emphasis"><em>pattern</em></span>
980 expression. (A regular expression “<span class="quote">back-reference</span>” refers to a
981 sub-expression contained within parentheses.) <code class="literal">%1</code> is replaced with
982 the first back-reference in the regex, <code class="literal">%2</code> with the second, etc.
984 If you're using multiple spam filters, a message can have more than
985 one spam-related header. You can define <code class="literal">spam</code> patterns for each
986 filter you use. If a message matches two or more of these patterns, and
987 the $spam_separator variable is set to a string, then the
988 message's spam tag will consist of all the <span class="emphasis"><em>format</em></span> strings joined
989 together, with the value of $spam_separator separating
992 For example, suppose I use DCC, SpamAssassin, and PureMessage. I might
993 define these spam settings:
994 </p><div class="example"><a id="ex-spam"></a><p class="title"><b>Example 3.13. Configuring spam detection</b></p><div class="example-contents"><pre class="screen">
995 spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
996 spam "X-Spam-Status: Yes" "90+/SA"
997 spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
998 set spam_separator=", "
999 </pre></div></div><br class="example-break" /><p>
1000 If I then received a message that DCC registered with “<span class="quote">many</span>” hits
1001 under the “<span class="quote">Fuz2</span>” checksum, and that PureMessage registered with a
1002 97% probability of being spam, that message's spam tag would read
1003 <code class="literal">90+/DCC-Fuz2, 97/PM</code>. (The four characters before “<span class="quote">=many</span>” in a
1004 DCC report indicate the checksum used -- in this case, “<span class="quote">Fuz2</span>”.)
1006 If the $spam_separator variable is unset, then each
1007 spam pattern match supersedes the previous one. Instead of getting
1008 joined <span class="emphasis"><em>format</em></span> strings, you'll get only the last one to match.
1010 The spam tag is what will be displayed in the index when you use
1011 <code class="literal">%H</code> in the <code class="literal">$index_format</code> variable. It's also the
1012 string that the <code class="literal">˜H</code> pattern-matching expression matches against for
1013 <code class="literal"><search></code> and <code class="literal"><limit></code> functions. And it's what sorting by spam
1014 attribute will use as a sort key.
1016 That's a pretty complicated example, and most people's actual
1017 environments will have only one spam filter. The simpler your
1018 configuration, the more effective mutt can be, especially when it comes
1021 Generally, when you sort by spam tag, mutt will sort <span class="emphasis"><em>lexically</em></span> --
1022 that is, by ordering strings alphanumerically. However, if a spam tag
1023 begins with a number, mutt will sort numerically first, and lexically
1024 only when two numbers are equal in value. (This is like UNIX's
1025 <code class="literal">sort -n</code>.) A message with no spam attributes at all -- that is, one
1026 that didn't match <span class="emphasis"><em>any</em></span> of your <code class="literal">spam</code> patterns -- is sorted at
1027 lowest priority. Numbers are sorted next, beginning with 0 and ranging
1028 upward. Finally, non-numeric strings are sorted, with “<span class="quote">a</span>” taking lower
1029 priority than “<span class="quote">z</span>”. Clearly, in general, sorting by spam tags is most
1030 effective when you can coerce your filter to give you a raw number. But
1031 in case you can't, mutt can still do something useful.
1033 The <code class="literal">nospam</code> command can be used to write exceptions to <code class="literal">spam</code>
1034 patterns. If a header pattern matches something in a <code class="literal">spam</code> command,
1035 but you nonetheless do not want it to receive a spam tag, you can list a
1036 more precise pattern under a <code class="literal">nospam</code> command.
1038 If the <span class="emphasis"><em>pattern</em></span> given to <code class="literal">nospam</code> is exactly the same as the
1039 <span class="emphasis"><em>pattern</em></span> on an existing <code class="literal">spam</code> list entry, the effect will be to
1040 remove the entry from the spam list, instead of adding an exception.
1041 Likewise, if the <span class="emphasis"><em>pattern</em></span> for a <code class="literal">spam</code> command matches an entry
1042 on the <code class="literal">nospam</code> list, that <code class="literal">nospam</code> entry will be removed. If the
1043 <span class="emphasis"><em>pattern</em></span> for <code class="literal">nospam</code> is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries on both lists</em></span>
1044 will be removed. This might be the default action if you use <code class="literal">spam</code>
1045 and <code class="literal">nospam</code> in conjunction with a <code class="literal">folder-hook</code>.
1047 You can have as many <code class="literal">spam</code> or <code class="literal">nospam</code> commands as you like.
1048 You can even do your own primitive spam detection within mutt -- for
1049 example, if you consider all mail from <code class="literal">MAILER-DAEMON</code> to be spam,
1050 you can use a <code class="literal">spam</code> command like this:
1051 </p><pre class="screen">
1052 spam "^From: .*MAILER-DAEMON" "999"
1053 </pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>26. Setting and Querying Variables</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>26.1. Commands</h3></div></div></div><p>
1054 The following commands are available to manipulate and query variables:
1055 </p><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">set</code> {
1056 [ <code class="option">no</code> | <code class="option">inv</code> ]
1057 <em class="replaceable"><code>variable</code></em>
1059 <em class="replaceable"><code>variable=value</code></em>
1060 } [...]</p></div><div class="cmdsynopsis"><p><code class="command">toggle</code>
1061 <em class="replaceable"><code>variable</code></em>
1063 <em class="replaceable"><code>variable</code></em>
1064 ...]</p></div><div class="cmdsynopsis"><p><code class="command">unset</code>
1065 <em class="replaceable"><code>variable</code></em>
1067 <em class="replaceable"><code>variable</code></em>
1068 ...]</p></div><div class="cmdsynopsis"><p><code class="command">reset</code>
1069 <em class="replaceable"><code>variable</code></em>
1071 <em class="replaceable"><code>variable</code></em>
1073 This command is used to set (and unset) <a class="link" href="reference.html#variables" title="3. Configuration variables">configuration variables</a>. There are four basic types of variables:
1074 boolean, number, string and quadoption. <span class="emphasis"><em>boolean</em></span> variables can be
1075 <span class="emphasis"><em>set</em></span> (true) or <span class="emphasis"><em>unset</em></span> (false). <span class="emphasis"><em>number</em></span> variables can be
1076 assigned a positive integer value.
1077 <span class="emphasis"><em>string</em></span> variables consist of any number of printable characters and
1078 must be enclosed in quotes if they contain spaces or tabs. You
1079 may also use the escape sequences “<span class="quote">\n</span>” and “<span class="quote">\t</span>” for newline and tab, respectively.
1080 <span class="emphasis"><em>quadoption</em></span> variables are used to control whether or not to be prompted
1081 for certain actions, or to specify a default action. A value of <span class="emphasis"><em>yes</em></span>
1082 will cause the action to be carried out automatically as if you had answered
1083 yes to the question. Similarly, a value of <span class="emphasis"><em>no</em></span> will cause the
1084 action to be carried out as if you had answered “<span class="quote">no.</span>” A value of
1085 <span class="emphasis"><em>ask-yes</em></span> will cause a prompt with a default answer of “<span class="quote">yes</span>” and
1086 <span class="emphasis"><em>ask-no</em></span> will provide a default answer of “<span class="quote">no.</span>”
1088 Prefixing a variable with “<span class="quote">no</span>” will unset it. Example: <code class="literal">set noaskbcc</code>.
1090 For <span class="emphasis"><em>boolean</em></span> variables, you may optionally prefix the variable name with
1091 <code class="literal">inv</code> to toggle the value (on or off). This is useful when writing
1092 macros. Example: <code class="literal">set invsmart_wrap</code>.
1094 The <code class="literal">toggle</code> command automatically prepends the <code class="literal">inv</code> prefix to all
1095 specified variables.
1097 The <code class="literal">unset</code> command automatically prepends the <code class="literal">no</code> prefix to all
1098 specified variables.
1100 Using the <code class="literal"><enter-command></code> function in the <span class="emphasis"><em>index</em></span> menu, you can query the
1101 value of a variable by prefixing the name of the variable with a question
1103 </p><pre class="screen">
1106 The question mark is actually only required for boolean and quadoption
1109 The <code class="literal">reset</code> command resets all given variables to the compile time
1110 defaults (hopefully mentioned in this manual). If you use the command
1111 <code class="literal">set</code> and prefix the variable with “<span class="quote">&</span>” this has the same
1112 behavior as the reset command.
1114 With the <code class="literal">reset</code> command there exists the special variable “<span class="quote">all</span>”,
1115 which allows you to reset all variables to their system defaults.
1116 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-myvar"></a>26.2. User-defined variables</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-intro"></a>26.2.1. Introduction</h4></div></div></div><p>
1117 Along with the variables listed in the
1118 <a class="link" href="reference.html#variables" title="3. Configuration variables">Configuration variables</a> section, mutt
1119 supports user-defined variables with names starting
1120 with <code class="literal">my_</code> as in, for
1121 example, <code class="literal">my_cfgdir</code>.
1123 The <code class="literal">set</code> command either creates a
1124 custom <code class="literal">my_</code> variable or changes its
1125 value if it does exist already. The <code class="literal">unset</code> and <code class="literal">reset</code>
1126 commands remove the variable entirely.
1128 Since user-defined variables are expanded in the same way that
1129 environment variables are (except for
1130 the <a class="link" href="gettingstarted.html#shell-escape">shell-escape</a> command and
1131 backtick expansion), this feature can be used to make configuration
1132 files more readable.
1133 </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-examples"></a>26.2.2. Examples</h4></div></div></div><p>
1134 The following example defines and uses the variable <code class="literal">my_cfgdir</code>
1135 to abbreviate the calls of the <a class="link" href="configuration.html#source" title="27. Reading initialization commands from another file">source</a> command:
1136 </p><div class="example"><a id="ex-myvar1"></a><p class="title"><b>Example 3.14. Using user-defined variables for config file readability</b></p><div class="example-contents"><pre class="screen">
1137 set my_cfgdir = $HOME/mutt/config
1139 source $my_cfgdir/hooks
1140 source $my_cfgdir/macros
1141 # more source commands...
1142 </pre></div></div><br class="example-break" /><p>
1143 A custom variable can also be used in macros to backup the current value
1144 of another variable. In the following example, the value of the
1145 <a class="link" href="reference.html#delete" title="3.42. delete">$delete</a> is changed temporarily
1146 while its original value is saved as <code class="literal">my_delete</code>.
1147 After the macro has executed all commands, the original value of <a class="link" href="reference.html#delete" title="3.42. delete">$delete</a> is restored.
1148 </p><div class="example"><a id="ex-myvar2"></a><p class="title"><b>Example 3.15. Using user-defined variables for backing up other config option values</b></p><div class="example-contents"><pre class="screen">
1150 <enter-command>set my_delete=$delete<enter>\
1151 <enter-command>set delete=yes<enter>\
1153 <enter-command>set delete=$my_delete<enter>'
1154 </pre></div></div><br class="example-break" /><p>
1155 Since mutt expands such values already when parsing the configuration
1156 file(s), the value of <code class="literal">$my_delete</code> in the
1157 last example would be the value of <code class="literal">$delete</code> exactly
1158 as it was at that point during parsing the configuration file. If
1159 another statement would change the value for <code class="literal">$delete</code>
1160 later in the same or another file, it would have no effect on
1161 <code class="literal">$my_delete</code>. However, the expansion can
1162 be deferred to runtime, as shown in the next example, when escaping the
1164 </p><div class="example"><a id="ex-myvar3"></a><p class="title"><b>Example 3.16. Deferring user-defined variable expansion to runtime</b></p><div class="example-contents"><pre class="screen">
1165 macro pager <PageDown> "\
1166 <enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
1168 <enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
1169 <enter-command> unset my_old_pager_stop<Enter>"
1170 </pre></div></div><br class="example-break" /><p>
1171 Note that there is a space
1172 between <code class="literal"><enter-command></code> and
1173 the <code class="literal">set</code> configuration command, preventing mutt from
1174 recording the macro's commands into its history.
1175 </p></div></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="source"></a>27. Reading initialization commands from another file</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">source</code>
1176 <em class="replaceable"><code>filename</code></em>
1178 This command allows the inclusion of initialization commands
1179 from other files. For example, I place all of my aliases in
1180 <code class="literal">˜/.mail_aliases</code> so that I can make my
1181 <code class="literal">˜/.muttrc</code> readable and keep my aliases private.
1183 If the filename begins with a tilde (“<span class="quote">˜</span>”), it will be expanded to the
1184 path of your home directory.
1186 If the filename ends with a vertical bar (|), then <span class="emphasis"><em>filename</em></span> is
1187 considered to be an executable program from which to read input (eg.
1188 <code class="literal">source ˜/bin/myscript|</code>).
1189 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ifdef"></a>28. Configuring features conditionnaly</h2></div></div></div><p>
1190 Usage: <code class="literal">ifdef</code> <span class="emphasis"><em>item</em></span> <span class="emphasis"><em>command</em></span>
1192 This command allows to test if a feature has been compiled in, before
1193 actually executing the command. Item can be either the name of a
1194 function, variable, or command. Example:
1196 </p><pre class="screen">
1197 ifdef imap_keepalive 'source ~/.mutt/imap_setup'
1199 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unhook"></a>29. Removing hooks</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">unhook</code> {
1200 <em class="replaceable"><code>*</code></em>
1202 <em class="replaceable"><code>hook-type</code></em>
1204 This command permits you to flush hooks you have previously defined.
1205 You can either remove all hooks by giving the “<span class="quote">*</span>” character as an
1206 argument, or you can remove all hooks of a specific type by saying
1207 something like <code class="literal">unhook send-hook</code>.
1208 </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="formatstrings"></a>30. Format Strings</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-basics"></a>30.1. Basic usage</h3></div></div></div><p>
1209 Format strings are a general concept you'll find in several locations
1210 through the mutt configuration, especially in the
1211 <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a>,
1212 <a class="link" href="reference.html#pager-format" title="3.140. pager_format">$pager_format</a>,
1213 <a class="link" href="reference.html#status-format" title="3.281. status_format">$status_format</a>,
1214 and other “<span class="quote">*_format</span>” variables. These can be very straightforward,
1215 and it's quite possible you already know how to use them.
1217 The most basic format string element is a percent symbol followed
1218 by another character. For example, <code class="literal">%s</code>
1219 represents a message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> variable. The
1220 “<span class="quote">expandos</span>” available are documented with each format variable, but
1221 there are general modifiers available with all formatting expandos,
1222 too. Those are our concern here.
1224 Some of the modifiers are borrowed right out of C (though you might
1225 know them from Perl, Python, shell, or another language). These are
1226 the [-]m.n modifiers, as in <code class="literal">%-12.12s</code>. As with
1227 such programming languages, these modifiers allow you to specify the
1228 minimum and maximum size of the resulting string, as well as its
1229 justification. If the “<span class="quote">-</span>” sign follows the percent, the string will
1230 be left-justified instead of right-justified. If there's a number
1231 immediately following that, it's the minimum amount of space the
1232 formatted string will occupy -- if it's naturally smaller than that, it
1233 will be padded out with spaces. If a decimal point and another number
1234 follow, that's the maximum space allowable -- the string will not be
1235 permitted to exceed that width, no matter its natural size. Each of
1236 these three elements is optional, so that all these are legal format
1238 <code class="literal">%-12s</code>
1239 <code class="literal">%4c</code>
1240 <code class="literal">%.15F</code>
1241 <code class="literal">%-12.15L</code>
1243 Mutt adds some other modifiers to format strings. If you use an equals
1244 symbol (<code class="literal">=</code>) as a numeric prefix (like the minus
1245 above), it will force the string to be centered within its minimum
1246 space range. For example, <code class="literal">%=14y</code> will reserve 14
1247 characters for the %y expansion -- that's the X-Label: header, in
1248 <code class="literal">$index_format</code>. If the expansion
1249 results in a string less than 14 characters, it will be centered in a
1250 14-character space. If the X-Label for a message were "test", that
1251 expansion would look like “<span class="quote"> test </span>”.
1253 There are two very little-known modifiers that affect the way that an
1254 expando is replaced. If there is an underline (“<span class="quote">_</span>”) character
1255 between any format modifiers (as above) and the expando letter, it will
1256 expands in all lower case. And if you use a colon (“<span class="quote">:</span>”), it will
1257 replace all decimal points with underlines.
1258 </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>30.2. Filters</h3></div></div></div><p>
1259 Any format string ending in a vertical bar (“<span class="quote">|</span>”) will be
1260 expanded and piped through the first word in the string, using spaces
1261 as separator. The string returned will be used for display.
1262 If the returned string ends in %, it will be passed through
1263 the formatter a second time. This allows the filter to generate a
1264 replacement format string including % expandos.
1266 All % expandos in a format string are expanded before the script
1268 </p><div class="example"><a id="ex-fmtpipe"></a><p class="title"><b>Example 3.17. Using external filters in format strings</b></p><div class="example-contents"><pre class="screen">
1269 set status_format="script.sh '%r %f (%L)'|"
1270 </pre></div></div><br class="example-break" /><p>
1271 will make mutt expand <code class="literal">%r</code>,
1272 <code class="literal">%f</code> and <code class="literal">%L</code>
1273 before calling the script. The example also shows that arguments can be
1274 quoted: the script will receive the expanded string between the single quotes
1275 as the only argument.
1277 A practical example is the <code class="literal">mutt_xtitle</code>
1278 script installed in the <code class="literal">samples</code>
1279 subdirectory of the mutt documentation: it can be used as filter for
1280 <code class="literal">$status_format</code> to set the current
1281 terminal's title, if supported.
1282 </p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting Started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Advanced Usage</td></tr></table></div></body></html>