mutt stable branch with some hacks
1<?xml version="1.0" standalone="no"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<book>
5
6<bookinfo>
7<title>The Mutt E-Mail Client</title>
8<author>
9<firstname>Michael</firstname><surname>Elkins</surname>
10<email>me@cs.hmc.edu</email>
11</author>
12<releaseinfo>version @VERSION@</releaseinfo>
13
14<abstract>
15<para>
16<quote>All mail clients suck. This one just sucks less.</quote> —
17me, circa 1995
18</para>
19</abstract>
20</bookinfo>
21
22<chapter id="intro">
23<title>Introduction</title>
24
25<para>
26<emphasis role="bold">Mutt</emphasis> is a small but very powerful
27text-based MIME mail client. Mutt is highly configurable, and is well
28suited to the mail power user with advanced features like key bindings,
29keyboard macros, mail threading, regular expression searches and a
30powerful pattern matching language for selecting groups of messages.
31</para>
32
33<sect1 id="homepage">
34<title>Mutt Home Page</title>
35
36<para>
37The official homepage can be found at
38<ulink url="http://www.mutt.org/">http://www.mutt.org/</ulink>.
39</para>
40
41</sect1>
42
43<sect1 id="muttlists">
44<title>Mailing Lists</title>
45
46<para>
47To subscribe to one of the following mailing lists, send a message with
48the word <emphasis>subscribe</emphasis> in the body to
49<emphasis>list-name</emphasis><literal>-request@mutt.org</literal>.
50</para>
51
52<itemizedlist>
53<listitem>
54
55<para>
56<email>mutt-announce-request@mutt.org</email> — low traffic list for
57announcements
58</para>
59</listitem>
60<listitem>
61
62<para>
63<email>mutt-users-request@mutt.org</email> — help, bug reports and
64feature requests
65</para>
66</listitem>
67<listitem>
68
69<para>
70<email>mutt-dev-request@mutt.org</email> — development mailing list
71</para>
72</listitem>
73
74</itemizedlist>
75
76<para>
77All messages posted to <emphasis>mutt-announce</emphasis> are
78automatically forwarded to <emphasis>mutt-users</emphasis>, so you do
79not need to be subscribed to both lists.
80</para>
81
82</sect1>
83
84<sect1 id="distribution">
85<title>Getting Mutt</title>
86
87<para>
88Mutt releases can be downloaded from <ulink
89url="ftp://ftp.mutt.org/mutt/">ftp://ftp.mutt.org/mutt/</ulink>. For a
90list of mirror sites, please refer to <ulink
91url="http://www.mutt.org/download.html">http://www.mutt.org/download.html</ulink>.
92</para>
93
94<para>
95For nightly tarballs and version control access, please refer to the
96<ulink url="http://dev.mutt.org/">Mutt development site</ulink>.
97</para>
98
99</sect1>
100
101<sect1 id="irc">
102<title>Mutt Online Resources</title>
103
104<variablelist>
105
106<varlistentry>
107<term>Bug Tracking System</term>
108<listitem>
109<para>
110The official Mutt bug tracking system can be found at
111<ulink url="http://bugs.mutt.org/">http://bugs.mutt.org/</ulink>
112</para>
113</listitem>
114</varlistentry>
115
116<varlistentry>
117<term>Wiki</term>
118<listitem>
119<para>
120An (unofficial) wiki can be found
121at <ulink url="http://wiki.mutt.org/">http://wiki.mutt.org/</ulink>.
122</para>
123</listitem>
124</varlistentry>
125
126<varlistentry>
127<term>IRC</term>
128<listitem>
129<para>
130For the IRC user community, visit channel <emphasis>#mutt</emphasis> on
131<ulink url="http://www.freenode.net/">irc.freenode.net</ulink>.
132</para>
133</listitem>
134</varlistentry>
135
136<varlistentry>
137<term>USENET</term>
138<listitem>
139<para>
140For USENET, see the newsgroup <ulink url="news:comp.mail.mutt">comp.mail.mutt</ulink>.
141</para>
142</listitem>
143</varlistentry>
144
145</variablelist>
146
147</sect1>
148
149<sect1 id="contrib">
150<title>Contributing to Mutt</title>
151
152<para>
153There are various ways to contribute to the Mutt project.
154</para>
155
156<para>
157Especially for new users it may be helpful to meet other new and
158experienced users to chat about Mutt, talk about problems and share
159tricks.
160</para>
161
162<para>
163Since translations of Mutt into other languages are highly appreciated,
164the Mutt developers always look for skilled translators that help
165improve and continue to maintain stale translations.
166</para>
167
168<para>
169For contributing code patches for new features and bug fixes, please
170refer to the developer pages at
171<ulink url="http://dev.mutt.org/">http://dev.mutt.org/</ulink> for more details.
172</para>
173
174</sect1>
175
176<sect1 id="typo">
177<title>Typographical Conventions</title>
178
179<para>
180This section lists typographical conventions followed throughout this
181manual. See table <xref linkend="tab-typo"/> for typographical
182conventions for special terms.
183</para>
184
185<table id="tab-typo">
186<title>Typographical conventions for special terms</title>
187<tgroup cols="2">
188<thead>
189<row><entry>Item</entry><entry>Refers to...</entry></row>
190</thead>
191<tbody>
192<row><entry><literal>printf(3)</literal></entry><entry>UNIX manual pages, execute <literal>man 3 printf</literal></entry></row>
193<row><entry><literal><PageUp></literal></entry><entry>named keys</entry></row>
194<row><entry><literal><create-alias></literal></entry><entry>named Mutt function</entry></row>
195<row><entry><literal>^G</literal></entry><entry>Control+G key combination</entry></row>
196<row><entry>$mail_check</entry><entry>Mutt configuration option</entry></row>
197<row><entry><literal>$HOME</literal></entry><entry>environment variable</entry></row>
198</tbody>
199</tgroup>
200</table>
201
202<para>
203Examples are presented as:
204</para>
205
206<screen>
207mutt -v
208</screen>
209
210<para>
211Within command synopsis, curly brackets (<quote>{}</quote>) denote a set
212of options of which one is mandatory, square brackets
213(<quote>[]</quote>) denote optional arguments, three dots
214denote that the argument may be repeated arbitrary times.
215</para>
216
217</sect1>
218
219<sect1 id="copyright">
220<title>Copyright</title>
221
222<para>
223Mutt is Copyright © 1996-2016 Michael R. Elkins
224<email>me@mutt.org</email> and others.
225</para>
226
227<para>
228This program is free software; you can redistribute it and/or modify it
229under the terms of the GNU General Public License as published by the
230Free Software Foundation; either version 2 of the License, or (at your
231option) any later version.
232</para>
233
234<para>
235This program is distributed in the hope that it will be useful, but
236WITHOUT ANY WARRANTY; without even the implied warranty of
237MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
238General Public License for more details.
239</para>
240
241<para>
242You should have received a copy of the GNU General Public License along
243with this program; if not, write to the Free Software Foundation, Inc.,
24451 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
245</para>
246
247</sect1>
248
249</chapter>
250
251<chapter id="gettingstarted">
252<title>Getting Started</title>
253
254<para>
255This section is intended as a brief overview of how to use Mutt. There
256are many other features which are described elsewhere in the manual.
257There is even more information available in the Mutt FAQ and various web
258pages. See the <ulink url="http://www.mutt.org/">Mutt homepage</ulink>
259for more details.
260</para>
261
262<para>
263The keybindings described in this section are the defaults as
264distributed. Your local system administrator may have altered the
265defaults for your site. You can always type <quote>?</quote> in any
266menu to display the current bindings.
267</para>
268
269<para>
270The first thing you need to do is invoke Mutt, simply by typing
271<literal>mutt</literal> at the command line. There are various
272command-line options, see either the Mutt man page or the <link
273linkend="commandline">reference</link>.
274</para>
275
276<sect1 id="core-concepts">
277<title>Core Concepts</title>
278
279<para>
280Mutt is a text-based application which interacts with users through
281different menus which are mostly line-/entry-based or page-based. A
282line-based menu is the so-called <quote>index</quote> menu (listing all
283messages of the currently opened folder) or the <quote>alias</quote>
284menu (allowing you to select recipients from a list). Examples for
285page-based menus are the <quote>pager</quote> (showing one message at a
286time) or the <quote>help</quote> menu listing all available key
287bindings.
288</para>
289
290<para>
291The user interface consists of a context sensitive help line at the top,
292the menu's contents followed by a context sensitive status line and
293finally the command line. The command line is used to display
294informational and error messages as well as for prompts and for entering
295interactive commands.
296</para>
297
298<para>
299Mutt is configured through variables which, if the user wants to
300permanently use a non-default value, are written to configuration
301files. Mutt supports a rich config file syntax to make even complex
302configuration files readable and commentable.
303</para>
304
305<para>
306Because Mutt allows for customizing almost all key bindings, there are
307so-called <quote>functions</quote> which can be executed manually (using
308the command line) or in macros. Macros allow the user to bind a sequence
309of commands to a single key or a short key sequence instead of repeating
310a sequence of actions over and over.
311</para>
312
313<para>
314Many commands (such as saving or copying a message to another folder)
315can be applied to a single message or a set of messages (so-called
316<quote>tagged</quote> messages). To help selecting messages, Mutt
317provides a rich set of message patterns (such as recipients, sender,
318body contents, date sent/received, etc.) which can be combined into
319complex expressions using the boolean <emphasis>and</emphasis> and
320<emphasis>or</emphasis> operations as well as negating. These patterns
321can also be used to (for example) search for messages or to limit the
322index to show only matching messages.
323</para>
324
325<para>
326Mutt supports a <quote>hook</quote> concept which allows the user to
327execute arbitrary configuration commands and functions in certain
328situations such as entering a folder, starting a new message or replying
329to an existing one. These hooks can be used to highly customize Mutt's
330behavior including managing multiple identities, customizing the
331display for a folder or even implementing auto-archiving based on a
332per-folder basis and much more.
333</para>
334
335<para>
336Besides an interactive mode, Mutt can also be used as a command-line
337tool only send messages. It also supports a
338<literal>mailx(1)</literal>-compatible interface, see <xref
339linkend="tab-commandline-options"/> for a complete list of command-line
340options.
341</para>
342
343</sect1>
344
345<sect1 id="concept-screens-and-menus">
346<title>Screens and Menus</title>
347
348<sect2 id="intro-index">
349<title>Index</title>
350
351<para>
352The index is the screen that you usually see first when you start
353Mutt. It gives an overview over your emails in the currently opened
354mailbox. By default, this is your system mailbox. The information you
355see in the index is a list of emails, each with its number on the left,
356its flags (new email, important email, email that has been forwarded or
357replied to, tagged email, ...), the date when email was sent, its
358sender, the email size, and the subject. Additionally, the index also
359shows thread hierarchies: when you reply to an email, and the other
360person replies back, you can see the other person's email in a
361"sub-tree" below. This is especially useful for personal email between
362a group of people or when you've subscribed to mailing lists.
363</para>
364
365</sect2>
366
367<sect2 id="intro-pager">
368<title>Pager</title>
369
370<para>
371The pager is responsible for showing the email content. On the top of
372the pager you have an overview over the most important email headers
373like the sender, the recipient, the subject, and much more
374information. How much information you actually see depends on your
375configuration, which we'll describe below.
376</para>
377
378<para>
379Below the headers, you see the email body which usually contains the
380message. If the email contains any attachments, you will see more
381information about them below the email body, or, if the attachments are
382text files, you can view them directly in the pager.
383</para>
384
385<para>
386To give the user a good overview, it is possible to configure Mutt to
387show different things in the pager with different colors. Virtually
388everything that can be described with a regular expression can be
389colored, e.g. URLs, email addresses or smileys.
390</para>
391
392</sect2>
393
394<sect2 id="intro-browser">
395<title>File Browser</title>
396
397<para>
398The file browser is the interface to the local or remote file
399system. When selecting a mailbox to open, the browser allows custom
400sorting of items, limiting the items shown by a regular expression and a
401freely adjustable format of what to display in which way. It also allows
402for easy navigation through the file system when selecting file(s) to
403attach to a message, select multiple files to attach and many more.
404</para>
405
406</sect2>
407
408<sect2 id="intro-sidebar">
409 <title>Sidebar</title>
410 <para>
411 The Sidebar shows a list of all your mailboxes. The list can be
412 turned on and off, it can be themed and the list style can be
413 configured.
414 </para>
415</sect2>
416
417<sect2 id="intro-help">
418<title>Help</title>
419
420<para>
421The help screen is meant to offer a quick help to the user. It lists the
422current configuration of key bindings and their associated commands
423including a short description, and currently unbound functions that
424still need to be associated with a key binding (or alternatively, they
425can be called via the Mutt command prompt).
426</para>
427
428</sect2>
429
430<sect2 id="intro-compose">
431<title>Compose Menu</title>
432
433<para>
434The compose menu features a split screen containing the information
435which really matter before actually sending a message by mail: who gets
436the message as what (recipients and who gets what kind of
437copy). Additionally, users may set security options like deciding
438whether to sign, encrypt or sign and encrypt a message with/for what
439keys. Also, it's used to attach messages, to re-edit any attachment
440including the message itself.
441</para>
442
443</sect2>
444
445<sect2 id="intro-alias">
446<title>Alias Menu</title>
447
448<para>
449The alias menu is used to help users finding the recipients of
450messages. For users who need to contact many people, there's no need to
451remember addresses or names completely because it allows for searching,
452too. The alias mechanism and thus the alias menu also features grouping
453several addresses by a shorter nickname, the actual alias, so that users
454don't have to select each single recipient manually.
455</para>
456
457</sect2>
458
459<sect2 id="intro-attach">
460<title>Attachment Menu</title>
461
462<para>
463As will be later discussed in detail, Mutt features a good and stable
464MIME implementation, that is, it supports sending and receiving messages
465of arbitrary MIME types. The attachment menu displays a message's
466structure in detail: what content parts are attached to which parent
467part (which gives a true tree structure), which type is of what type and
468what size. Single parts may saved, deleted or modified to offer great
469and easy access to message's internals.
470</para>
471
472</sect2>
473
474</sect1>
475
476<sect1 id="menus">
477<title>Moving Around in Menus</title>
478
479<para>
480The most important navigation keys common to line- or entry-based menus
481are shown in <xref linkend="tab-keys-nav-line"/> and in <xref
482linkend="tab-keys-nav-page"/> for page-based menus.
483</para>
484
485<table id="tab-keys-nav-line">
486<title>Most common navigation keys in entry-based menus</title>
487<tgroup cols="3">
488<thead>
489<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
490</thead>
491<tbody>
492<row><entry>j or <Down></entry><entry><literal><next-entry></literal></entry><entry>move to the next entry</entry></row>
493<row><entry>k or <Up></entry><entry><literal><previous-entry></literal></entry><entry>move to the previous entry</entry></row>
494<row><entry>z or <PageDn></entry><entry><literal><page-down></literal></entry><entry>go to the next page</entry></row>
495<row><entry>Z or <PageUp></entry><entry><literal><page-up></literal></entry><entry>go to the previous page</entry></row>
496<row><entry>= or <Home></entry><entry><literal><first-entry></literal></entry><entry>jump to the first entry</entry></row>
497<row><entry>* or <End></entry><entry><literal><last-entry></literal></entry><entry>jump to the last entry</entry></row>
498<row><entry>q</entry><entry><literal><quit></literal></entry><entry>exit the current menu</entry></row>
499<row><entry>?</entry><entry><literal><help></literal></entry><entry>list all keybindings for the current menu</entry></row>
500</tbody>
501</tgroup>
502</table>
503
504<table id="tab-keys-nav-page">
505<title>Most common navigation keys in page-based menus</title>
506<tgroup cols="3">
507<thead>
508<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
509</thead>
510<tbody>
511<row><entry>J or <Return></entry><entry><literal><next-line></literal></entry><entry>scroll down one line</entry></row>
512<row><entry><Backspace></entry><entry><literal><previous-line></literal></entry><entry>scroll up one line</entry></row>
513<row><entry>K, <Space> or <PageDn></entry><entry><literal><next-page></literal></entry><entry>move to the next page</entry></row>
514<row><entry>- or <PageUp></entry><entry><literal><previous-page></literal></entry><entry>move the previous page</entry></row>
515<row><entry><Home></entry><entry><literal><top></literal></entry><entry>move to the top</entry></row>
516<row><entry><End></entry><entry><literal><bottom></literal></entry><entry>move to the bottom</entry></row>
517</tbody>
518</tgroup>
519</table>
520
521</sect1>
522
523<sect1 id="editing">
524<title>Editing Input Fields</title>
525
526<sect2 id="editing-intro">
527<title>Introduction</title>
528
529<para>
530Mutt has a built-in line editor for inputting text, e.g. email addresses
531or filenames. The keys used to manipulate text input are very similar to
532those of Emacs. See <xref linkend="tab-keys-editor"/> for a full
533reference of available functions, their default key bindings, and short
534descriptions.
535</para>
536
537<table id="tab-keys-editor">
538<title>Most common line editor keys</title>
539<tgroup cols="3">
540<thead>
541<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
542</thead>
543<tbody>
544<row><entry>^A or <Home></entry><entry><literal><bol></literal></entry><entry>move to the start of the line</entry></row>
545<row><entry>^B or <Left></entry><entry><literal><backward-char></literal></entry><entry>move back one char</entry></row>
546<row><entry>Esc B</entry><entry><literal><backward-word></literal></entry><entry>move back one word</entry></row>
547<row><entry>^D or <Delete></entry><entry><literal><delete-char></literal></entry><entry>delete the char under the cursor</entry></row>
548<row><entry>^E or <End></entry><entry><literal><eol></literal></entry><entry>move to the end of the line</entry></row>
549<row><entry>^F or <Right></entry><entry><literal><forward-char></literal></entry><entry>move forward one char</entry></row>
550<row><entry>Esc F</entry><entry><literal><forward-word></literal></entry><entry>move forward one word</entry></row>
551<row><entry><Tab></entry><entry><literal><complete></literal></entry><entry>complete filename or alias</entry></row>
552<row><entry>^T</entry><entry><literal><complete-query></literal></entry><entry>complete address with query</entry></row>
553<row><entry>^K</entry><entry><literal><kill-eol></literal></entry><entry>delete to the end of the line</entry></row>
554<row><entry>Esc d</entry><entry><literal><kill-eow></literal></entry><entry>delete to the end of the word</entry></row>
555<row><entry>^W</entry><entry><literal><kill-word></literal></entry><entry>kill the word in front of the cursor</entry></row>
556<row><entry>^U</entry><entry><literal><kill-line></literal></entry><entry>delete entire line</entry></row>
557<row><entry>^V</entry><entry><literal><quote-char></literal></entry><entry>quote the next typed key</entry></row>
558<row><entry><Up></entry><entry><literal><history-up></literal></entry><entry>recall previous string from history</entry></row>
559<row><entry><Down></entry><entry><literal><history-down></literal></entry><entry>recall next string from history</entry></row>
560<row><entry><BackSpace></entry><entry><literal><backspace></literal></entry><entry>kill the char in front of the cursor</entry></row>
561<row><entry>Esc u</entry><entry><literal><upcase-word></literal></entry><entry>convert word to upper case</entry></row>
562<row><entry>Esc l</entry><entry><literal><downcase-word></literal></entry><entry>convert word to lower case</entry></row>
563<row><entry>Esc c</entry><entry><literal><capitalize-word></literal></entry><entry>capitalize the word</entry></row>
564<row><entry>^G</entry><entry>n/a</entry><entry>abort</entry></row>
565<row><entry><Return></entry><entry>n/a</entry><entry>finish editing</entry></row>
566</tbody>
567</tgroup>
568</table>
569
570<para>
571You can remap the <emphasis>editor</emphasis> functions using the <link
572linkend="bind"><command>bind</command></link> command. For example, to
573make the <Delete> key delete the character in front of the cursor
574rather than under, you could use:
575</para>
576
577<screen>
578bind editor <delete> backspace
579</screen>
580
581</sect2>
582
583<sect2 id="editing-history">
584<title>History</title>
585
586<para>
587Mutt maintains a history for the built-in editor. The number of items
588is controlled by the <link linkend="history">$history</link> variable
589and can be made persistent using an external file specified using <link
590linkend="history-file">$history_file</link>. You may cycle through them
591at an editor prompt by using the <literal><history-up></literal>
592and/or <literal><history-down></literal> commands. Mutt will
593remember the currently entered text as you cycle through history, and
594will wrap around to the initial entry line.
595</para>
596
597<para>
598Mutt maintains several distinct history lists, one for each of the
599following categories:
600</para>
601
602<itemizedlist>
603<listitem><para><literal>.muttrc</literal> commands</para></listitem>
604<listitem><para>addresses and aliases</para></listitem>
605<listitem><para>shell commands</para></listitem>
606<listitem><para>filenames</para></listitem>
607<listitem><para>patterns</para></listitem>
608<listitem><para>everything else</para></listitem>
609</itemizedlist>
610
611<para>
612Mutt automatically filters out consecutively repeated items from the
613history. It also mimics the behavior of some shells by ignoring items
614starting with a space. The latter feature can be useful in macros to not
615clobber the history's valuable entries with unwanted entries.
616</para>
617
618</sect2>
619
620</sect1>
621
622<sect1 id="reading">
623<title>Reading Mail</title>
624
625<para>
626Similar to many other mail clients, there are two modes in which mail is
627read in Mutt. The first is a list of messages in the mailbox, which is
628called the <quote>index</quote> menu in Mutt. The second mode is the
629display of the message contents. This is called the
630<quote>pager.</quote>
631</para>
632
633<para>
634The next few sections describe the functions provided in each of these
635modes.
636</para>
637
638<sect2 id="index-menu">
639<title>The Message Index</title>
640
641<para>
642Common keys used to navigate through and manage messages in the index
643are shown in <xref linkend="tab-key-index"/>. How messages are presented
644in the index menu can be customized using the <link
645linkend="index-format">$index_format</link> variable.
646</para>
647
648<table id="tab-key-index">
649<title>Most common message index keys</title>
650<tgroup cols="2">
651<thead>
652<row><entry>Key</entry><entry>Description</entry></row>
653</thead>
654<tbody>
655<row><entry>c</entry><entry>change to a different mailbox</entry></row>
656<row><entry>Esc c</entry><entry>change to a folder in read-only mode</entry></row>
657<row><entry>C</entry><entry>copy the current message to another mailbox</entry></row>
658<row><entry>Esc C</entry><entry>decode a message and copy it to a folder</entry></row>
659<row><entry>Esc s</entry><entry>decode a message and save it to a folder</entry></row>
660<row><entry>D</entry><entry>delete messages matching a pattern</entry></row>
661<row><entry>d</entry><entry>delete the current message</entry></row>
662<row><entry>F</entry><entry>mark as important</entry></row>
663<row><entry>l</entry><entry>show messages matching a pattern</entry></row>
664<row><entry>N</entry><entry>mark message as new</entry></row>
665<row><entry>o</entry><entry>change the current sort method</entry></row>
666<row><entry>O</entry><entry>reverse sort the mailbox</entry></row>
667<row><entry>q</entry><entry>save changes and exit</entry></row>
668<row><entry>s</entry><entry>save-message</entry></row>
669<row><entry>T</entry><entry>tag messages matching a pattern</entry></row>
670<row><entry>t</entry><entry>toggle the tag on a message</entry></row>
671<row><entry>Esc t</entry><entry>toggle tag on entire message thread</entry></row>
672<row><entry>U</entry><entry>undelete messages matching a pattern</entry></row>
673<row><entry>u</entry><entry>undelete-message</entry></row>
674<row><entry>v</entry><entry>view-attachments</entry></row>
675<row><entry>x</entry><entry>abort changes and exit</entry></row>
676<row><entry><Return></entry><entry>display-message</entry></row>
677<row><entry><Tab></entry><entry>jump to the next new or unread message</entry></row>
678<row><entry>@</entry><entry>show the author's full e-mail address</entry></row>
679<row><entry>$</entry><entry>save changes to mailbox</entry></row>
680<row><entry>/</entry><entry>search</entry></row>
681<row><entry>Esc /</entry><entry>search-reverse</entry></row>
682<row><entry>^L</entry><entry>clear and redraw the screen</entry></row>
683<row><entry>^T</entry><entry>untag messages matching a pattern</entry></row>
684</tbody>
685</tgroup>
686</table>
687
688<para>
689In addition to who sent the message and the subject, a short summary of
690the disposition of each message is printed beside the message number.
691Zero or more of the <quote>flags</quote> in <xref
692linkend="tab-msg-status-flags"/> may appear, some of which can be turned
693on or off using these functions: <literal><set-flag></literal> and
694<literal><clear-flag></literal> bound by default to
695<quote>w</quote> and <quote>W</quote> respectively.
696</para>
697
698<para>
699Furthermore, the flags in <xref linkend="tab-msg-recip-flags"/> reflect
700who the message is addressed to. They can be customized with the <link
701linkend="to-chars">$to_chars</link> variable.
702</para>
703
704<table id="tab-msg-status-flags">
705<title>Message status flags</title>
706<tgroup cols="2">
707<thead>
708<row><entry>Flag</entry><entry>Description</entry></row>
709</thead>
710<tbody>
711<row><entry>D</entry><entry>message is deleted (is marked for deletion)</entry></row>
712<row><entry>d</entry><entry>message has attachments marked for deletion</entry></row>
713<row><entry>K</entry><entry>contains a PGP public key</entry></row>
714<row><entry>N</entry><entry>message is new</entry></row>
715<row><entry>O</entry><entry>message is old</entry></row>
716<row><entry>P</entry><entry>message is PGP encrypted</entry></row>
717<row><entry>r</entry><entry>message has been replied to</entry></row>
718<row><entry>S</entry><entry>message is signed, and the signature is successfully verified</entry></row>
719<row><entry>s</entry><entry>message is signed</entry></row>
720<row><entry>!</entry><entry>message is flagged</entry></row>
721<row><entry>*</entry><entry>message is tagged</entry></row>
722<row><entry>n</entry><entry>thread contains new messages (only if collapsed)</entry></row>
723<row><entry>o</entry><entry>thread contains old messages (only if collapsed)</entry></row>
724</tbody>
725</tgroup>
726</table>
727
728<table id="tab-msg-recip-flags">
729<title>Message recipient flags</title>
730<tgroup cols="2">
731<thead>
732<row><entry>Flag</entry><entry>Description</entry></row>
733</thead>
734<tbody>
735<row><entry>+</entry><entry>message is to you and you only</entry></row>
736<row><entry>T</entry><entry>message is to you, but also to or CC'ed to others</entry></row>
737<row><entry>C</entry><entry>message is CC'ed to you</entry></row>
738<row><entry>F</entry><entry>message is from you</entry></row>
739<row><entry>L</entry><entry>message is sent to a subscribed mailing list</entry></row>
740</tbody>
741</tgroup>
742</table>
743
744</sect2>
745
746<sect2 id="pager-menu">
747<title>The Pager</title>
748
749<para>
750By default, Mutt uses its built-in pager to display the contents of
751messages (an external pager such as <literal>less(1)</literal> can be
752configured, see <link linkend="pager">$pager</link> variable). The
753pager is very similar to the Unix program <literal>less(1)</literal>
754though not nearly as featureful.
755</para>
756
757<table id="tab-key-pager">
758<title>Most common pager keys</title>
759<tgroup cols="2">
760<thead>
761<row><entry>Key</entry><entry>Description</entry></row>
762</thead>
763<tbody>
764<row><entry><Return></entry><entry>go down one line</entry></row>
765<row><entry><Space></entry><entry>display the next page (or next message if at the end of a message)</entry></row>
766<row><entry>-</entry><entry>go back to the previous page</entry></row>
767<row><entry>n</entry><entry>search for next match</entry></row>
768<row><entry>S</entry><entry>skip beyond quoted text</entry></row>
769<row><entry>T</entry><entry>toggle display of quoted text</entry></row>
770<row><entry>?</entry><entry>show keybindings</entry></row>
771<row><entry>/</entry><entry>regular expression search</entry></row>
772<row><entry>Esc /</entry><entry>backward regular expression search</entry></row>
773<row><entry>\</entry><entry>toggle highlighting of search matches</entry></row>
774<row><entry>^</entry><entry>jump to the top of the message</entry></row>
775</tbody>
776</tgroup>
777</table>
778
779<para>
780In addition to key bindings in <xref linkend="tab-key-pager"/>, many of
781the functions from the index menu are also available in the pager, such
782as <literal><delete-message></literal> or
783<literal><copy-message></literal> (this is one advantage over
784using an external pager to view messages).
785</para>
786
787<para>
788Also, the internal pager supports a couple other advanced features. For
789one, it will accept and translate the <quote>standard</quote> nroff
790sequences for bold and underline. These sequences are a series of either
791the letter, backspace (<quote>^H</quote>), the letter again for bold or
792the letter, backspace, <quote>_</quote> for denoting underline. Mutt
793will attempt to display these in bold and underline respectively if your
794terminal supports them. If not, you can use the bold and underline <link
795linkend="color">color</link> objects to specify a
796<command>color</command> or mono attribute for them.
797</para>
798
799<para>
800Additionally, the internal pager supports the ANSI escape sequences for
801character attributes. Mutt translates them into the correct color and
802character settings. The sequences Mutt supports are:
803</para>
804
805<screen>
806\e[<emphasis>Ps</emphasis>;<emphasis>Ps</emphasis>;..<emphasis>Ps</emphasis>;m
807</screen>
808
809<para>
810where <emphasis>Ps</emphasis> can be one of the codes shown in <xref
811linkend="tab-ansi-esc"/>.
812</para>
813
814<table id="tab-ansi-esc">
815<title>ANSI escape sequences</title>
816<tgroup cols="2">
817<thead>
818<row><entry>Escape code</entry><entry>Description</entry></row>
819</thead>
820<tbody>
821<row><entry>0</entry><entry>All attributes off</entry></row>
822<row><entry>1</entry><entry>Bold on</entry></row>
823<row><entry>4</entry><entry>Underline on</entry></row>
824<row><entry>5</entry><entry>Blink on</entry></row>
825<row><entry>7</entry><entry>Reverse video on</entry></row>
826<row><entry>3<emphasis><color></emphasis></entry><entry>Foreground color is <emphasis><color></emphasis> (see <xref linkend="tab-color"/>)</entry></row>
827<row><entry>4<emphasis><color></emphasis></entry><entry>Background color is <emphasis><color></emphasis> (see <xref linkend="tab-color"/>)</entry></row>
828</tbody>
829</tgroup>
830</table>
831
832<table id="tab-color">
833<title>Color sequences</title>
834<tgroup cols="2">
835<thead>
836<row><entry>Color code</entry><entry>Color</entry></row>
837</thead>
838<tbody>
839<row><entry>0</entry><entry>Black</entry></row>
840<row><entry>1</entry><entry>Red</entry></row>
841<row><entry>2</entry><entry>Green</entry></row>
842<row><entry>3</entry><entry>Yellow</entry></row>
843<row><entry>4</entry><entry>Blue</entry></row>
844<row><entry>5</entry><entry>Magenta</entry></row>
845<row><entry>6</entry><entry>Cyan</entry></row>
846<row><entry>7</entry><entry>White</entry></row>
847</tbody>
848</tgroup>
849</table>
850
851<para>
852Mutt uses these attributes for handling <literal>text/enriched</literal>
853messages, and they can also be used by an external <link
854linkend="auto-view">autoview</link> script for highlighting purposes.
855</para>
856
857<note>
858<para>
859If you change the colors for your display, for example by changing the
860color associated with color2 for your xterm, then that color will be
861used instead of green.
862</para>
863</note>
864
865<note>
866<para>
867Note that the search commands in the pager take regular expressions,
868which are not quite the same as the more complex <link
869linkend="patterns">patterns</link> used by the search command in the
870index. This is because patterns are used to select messages by criteria
871whereas the pager already displays a selected message.
872</para>
873</note>
874
875</sect2>
876
877<sect2 id="threads">
878<title>Threaded Mode</title>
879
880<para>
881So-called <quote>threads</quote> provide a hierarchy of messages where
882replies are linked to their parent message(s). This organizational form
883is extremely useful in mailing lists where different parts of the
884discussion diverge. Mutt displays threads as a tree structure.
885</para>
886
887<para>
888In Mutt, when a mailbox is <link linkend="sort">sorted</link>
889by <emphasis>threads</emphasis>, there are a few additional functions
890available in the <emphasis>index</emphasis>
891and <emphasis>pager</emphasis> modes as shown in
892<xref linkend="tab-key-threads"/>.
893</para>
894
895<table id="tab-key-threads">
896<title>Most common thread mode keys</title>
897<tgroup cols="3">
898<thead>
899<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
900</thead>
901<tbody>
902<row><entry>^D</entry><entry><literal><delete-thread></literal></entry><entry>delete all messages in the current thread</entry></row>
903<row><entry>^U</entry><entry><literal><undelete-thread></literal></entry><entry>undelete all messages in the current thread</entry></row>
904<row><entry>^N</entry><entry><literal><next-thread></literal></entry><entry>jump to the start of the next thread</entry></row>
905<row><entry>^P</entry><entry><literal><previous-thread></literal></entry><entry>jump to the start of the previous thread</entry></row>
906<row><entry>^R</entry><entry><literal><read-thread></literal></entry><entry>mark the current thread as read</entry></row>
907<row><entry>Esc d</entry><entry><literal><delete-subthread></literal></entry><entry>delete all messages in the current subthread</entry></row>
908<row><entry>Esc u</entry><entry><literal><undelete-subthread></literal></entry><entry>undelete all messages in the current subthread</entry></row>
909<row><entry>Esc n</entry><entry><literal><next-subthread></literal></entry><entry>jump to the start of the next subthread</entry></row>
910<row><entry>Esc p</entry><entry><literal><previous-subthread></literal></entry><entry>jump to the start of the previous subthread</entry></row>
911<row><entry>Esc r</entry><entry><literal><read-subthread></literal></entry><entry>mark the current subthread as read</entry></row>
912<row><entry>Esc t</entry><entry><literal><tag-thread></literal></entry><entry>toggle the tag on the current thread</entry></row>
913<row><entry>Esc v</entry><entry><literal><collapse-thread></literal></entry><entry>toggle collapse for the current thread</entry></row>
914<row><entry>Esc V</entry><entry><literal><collapse-all></literal></entry><entry>toggle collapse for all threads</entry></row>
915<row><entry>P</entry><entry><literal><parent-message></literal></entry><entry>jump to parent message in thread</entry></row>
916</tbody>
917</tgroup>
918</table>
919
920<para>
921Collapsing a thread displays only the first message in the thread and
922hides the others. This is useful when threads contain so many messages
923that you can only see a handful of threads on the screen. See %M in
924<link linkend="index-format">$index_format</link>. For example, you
925could use <quote>%?M?(#%03M)&(%4l)?</quote> in <link
926linkend="index-format">$index_format</link> to optionally display the
927number of hidden messages if the thread is collapsed. The
928<literal>%?<char>?<if-part>&<else-part>?</literal>
929syntax is explained in detail in <link
930linkend="formatstrings-conditionals">format string conditionals</link>.
931</para>
932
933<para>
934Technically, every reply should contain a list of its parent messages in
935the thread tree, but not all do. In these cases, Mutt groups them by
936subject which can be controlled using the <link
937linkend="strict-threads">$strict_threads</link> variable.
938</para>
939
940</sect2>
941
942<sect2 id="reading-misc">
943<title>Miscellaneous Functions</title>
944
945<para>
946In addition, the <emphasis>index</emphasis> and
947<emphasis>pager</emphasis> menus have these interesting functions:
948</para>
949
950<variablelist>
951
952<varlistentry>
953<term>
954<literal><create-alias></literal><anchor id="create-alias"/>
955(default: a)
956</term>
957<listitem>
958<para>
959Creates a new alias based upon the current message (or prompts for a new
960one). Once editing is complete, an <link
961linkend="alias"><command>alias</command></link> command is added to the
962file specified by the <link linkend="alias-file">$alias_file</link>
963variable for future use
964</para>
965
966<note>
967<para>
968Mutt does not read the <link linkend="alias-file">$alias_file</link>
969upon startup so you must explicitly <link
970linkend="source"><command>source</command></link> the file.
971</para>
972</note>
973</listitem>
974</varlistentry>
975
976<varlistentry>
977<term>
978<literal><check-traditional-pgp></literal><anchor
979id="check-traditional-pgp"/> (default: Esc P)
980</term>
981<listitem>
982<para>
983This function will search the current message for content signed or
984encrypted with PGP the <quote>traditional</quote> way, that is, without
985proper MIME tagging. Technically, this function will temporarily change
986the MIME content types of the body parts containing PGP data; this is
987similar to the <link
988linkend="edit-type"><literal><edit-type></literal></link>
989function's effect.
990</para>
991</listitem>
992</varlistentry>
993
994<varlistentry>
995<term>
996<literal><edit></literal><anchor id="edit"/> (default: e)
997</term>
998<listitem>
999<para>
1000This command (available in the index and pager) allows you to edit the
1001raw current message as it's present in the mail folder. After you have
1002finished editing, the changed message will be appended to the current
1003folder, and the original message will be marked for deletion; if the
1004message is unchanged it won't be replaced.
1005</para>
1006</listitem>
1007</varlistentry>
1008
1009<varlistentry>
1010<term>
1011<literal><edit-type></literal><anchor id="edit-type"/> (default:
1012^E on the attachment menu, and in the pager and index menus; ^T on the
1013compose menu)
1014</term>
1015<listitem>
1016<para>
1017This command is used to temporarily edit an attachment's content type to
1018fix, for instance, bogus character set parameters. When invoked from
1019the index or from the pager, you'll have the opportunity to edit the
1020top-level attachment's content type. On the <link
1021linkend="attach-menu">attachment menu</link>, you can change any
1022attachment's content type. These changes are not persistent, and get
1023lost upon changing folders.
1024</para>
1025
1026<para>
1027Note that this command is also available on the <link
1028linkend="compose-menu">compose menu</link>. There, it's used to
1029fine-tune the properties of attachments you are going to send.
1030</para>
1031</listitem>
1032</varlistentry>
1033
1034<varlistentry>
1035<term>
1036<literal><enter-command></literal><anchor id="enter-command"/>
1037(default: <quote>:</quote>)
1038</term>
1039<listitem>
1040<para>
1041This command is used to execute any command you would normally put in a
1042configuration file. A common use is to check the settings of variables,
1043or in conjunction with <link linkend="macro">macros</link> to change
1044settings on the fly.
1045</para>
1046</listitem>
1047</varlistentry>
1048
1049<varlistentry>
1050<term>
1051<literal><extract-keys></literal><anchor id="extract-keys"/>
1052(default: ^K)
1053</term>
1054<listitem>
1055<para>
1056This command extracts PGP public keys from the current or tagged
1057message(s) and adds them to your PGP public key ring.
1058</para>
1059</listitem>
1060</varlistentry>
1061
1062<varlistentry>
1063<term>
1064<literal><forget-passphrase></literal><anchor
1065id="forget-passphrase"/> (default: ^F)
1066</term>
1067<listitem>
1068<para>
1069This command wipes the passphrase(s) from memory. It is useful, if you
1070misspelled the passphrase.
1071</para>
1072</listitem>
1073</varlistentry>
1074
1075<varlistentry>
1076<term>
1077<literal><list-reply></literal><anchor id="list-reply"/> (default:
1078L)
1079</term>
1080<listitem>
1081<para>
1082Reply to the current or tagged message(s) by extracting any addresses
1083which match the regular expressions given by the <link
1084linkend="lists"><command>lists</command> or
1085<command>subscribe</command></link> commands, but also honor any
1086<literal>Mail-Followup-To</literal> header(s) if the <link
1087linkend="honor-followup-to">$honor_followup_to</link> configuration
1088variable is set. In addition, the <literal>List-Post</literal> header field is
1089examined for <literal>mailto:</literal> URLs specifying a mailing list address.
1090Using this when replying to messages posted to mailing lists helps avoid
1091duplicate copies being sent to the author of the message you are replying to.
1092</para>
1093</listitem>
1094</varlistentry>
1095
1096<varlistentry>
1097<term>
1098<literal><pipe-message></literal><anchor id="pipe-message"/>
1099(default: |)
1100</term>
1101<listitem>
1102<para>
1103Asks for an external Unix command and pipes the current or tagged
1104message(s) to it. The variables <link
1105linkend="pipe-decode">$pipe_decode</link>, <link
1106linkend="pipe-split">$pipe_split</link>, <link
1107linkend="pipe-sep">$pipe_sep</link> and <link
1108linkend="wait-key">$wait_key</link> control the exact behavior of this
1109function.
1110</para>
1111</listitem>
1112</varlistentry>
1113
1114<varlistentry>
1115<term>
1116<literal><resend-message></literal><anchor id="resend-message"/>
1117(default: Esc e)
1118</term>
1119<listitem>
1120<para>
1121Mutt takes the current message as a template for a new message. This
1122function is best described as "recall from arbitrary folders". It can
1123conveniently be used to forward MIME messages while preserving the
1124original mail structure. Note that the amount of headers included here
1125depends on the value of the <link linkend="weed">$weed</link> variable.
1126</para>
1127
1128<para>
1129This function is also available from the attachment menu. You can use
1130this to easily resend a message which was included with a bounce message
1131as a <literal>message/rfc822</literal> body part.
1132</para>
1133</listitem>
1134</varlistentry>
1135
1136<varlistentry>
1137<term>
1138<literal><shell-escape></literal><anchor id="shell-escape"/>
1139(default: !)
1140</term>
1141<listitem>
1142<para>
1143Asks for an external Unix command and executes it. The <link
1144linkend="wait-key">$wait_key</link> can be used to control whether Mutt
1145will wait for a key to be pressed when the command returns (presumably
1146to let the user read the output of the command), based on the return
1147status of the named command. If no command is given, an interactive
1148shell is executed.
1149</para>
1150</listitem>
1151</varlistentry>
1152
1153<varlistentry>
1154<term>
1155<literal><toggle-quoted></literal><anchor id="toggle-quoted"/>
1156(default: T)
1157</term>
1158<listitem>
1159<para>
1160The pager uses the <link linkend="quote-regexp">$quote_regexp</link>
1161variable to detect quoted text when displaying the body of the message.
1162This function toggles the display of the quoted material in the message.
1163It is particularly useful when being interested in just the response and
1164there is a large amount of quoted text in the way.
1165</para>
1166</listitem>
1167</varlistentry>
1168
1169<varlistentry>
1170<term>
1171<literal><skip-quoted></literal><anchor id="skip-quoted"/>
1172(default: S)
1173</term>
1174<listitem>
1175<para>
1176This function will go to the next line of non-quoted text which comes
1177after a line of quoted text in the internal pager.
1178</para>
1179</listitem>
1180</varlistentry>
1181
1182</variablelist>
1183
1184</sect2>
1185
1186</sect1>
1187
1188<sect1 id="sending">
1189<title>Sending Mail</title>
1190
1191<sect2 id="sending-intro">
1192<title>Introduction</title>
1193
1194<para>
1195The bindings shown in <xref linkend="tab-key-send"/> are available in
1196the <emphasis>index</emphasis> and <emphasis>pager</emphasis> to start a
1197new message.
1198</para>
1199
1200<table id="tab-key-send">
1201<title>Most common mail sending keys</title>
1202<tgroup cols="3">
1203<thead>
1204<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
1205</thead>
1206<tbody>
1207<row><entry>m</entry><entry><literal><compose></literal></entry><entry>compose a new message</entry></row>
1208<row><entry>r</entry><entry><literal><reply></literal></entry><entry>reply to sender</entry></row>
1209<row><entry>g</entry><entry><literal><group-reply></literal></entry><entry>reply to all recipients</entry></row>
1210<row><entry>L</entry><entry><literal><list-reply></literal></entry><entry>reply to mailing list address</entry></row>
1211<row><entry>f</entry><entry><literal><forward></literal></entry><entry>forward message</entry></row>
1212<row><entry>b</entry><entry><literal><bounce></literal></entry><entry>bounce (remail) message</entry></row>
1213<row><entry>Esc k</entry><entry><literal><mail-key></literal></entry><entry>mail a PGP public key to someone</entry></row>
1214</tbody>
1215</tgroup>
1216</table>
1217
1218<para>
1219<emphasis>Bouncing</emphasis> a message sends the message as-is to the
1220recipient you specify. <emphasis>Forwarding</emphasis> a message allows
1221you to add comments or modify the message you are forwarding. These
1222items are discussed in greater detail in the next section <quote><link
1223linkend="forwarding-mail">Forwarding and Bouncing Mail</link>.</quote>
1224</para>
1225
1226<para>
1227Mutt will then enter the <emphasis>compose</emphasis> menu and prompt
1228you for the recipients to place on the <quote>To:</quote> header field
1229when you hit <literal>m</literal> to start a new message. Next, it will
1230ask you for the <quote>Subject:</quote> field for the message, providing
1231a default if you are replying to or forwarding a message. You again have
1232the chance to adjust recipients, subject, and security settings right
1233before actually sending the message. See also <link
1234linkend="askcc">$askcc</link>, <link linkend="askbcc">$askbcc</link>,
1235<link linkend="autoedit">$autoedit</link>, <link
1236linkend="bounce">$bounce</link>, <link
1237linkend="fast-reply">$fast_reply</link>, and <link
1238linkend="include">$include</link> for changing how and if Mutt asks
1239these questions.
1240</para>
1241
1242<para>
1243When replying, Mutt fills these fields with proper values depending on
1244the reply type. The types of replying supported are:
1245</para>
1246
1247<variablelist>
1248<varlistentry>
1249<term>Simple reply</term>
1250<listitem>
1251<para>
1252Reply to the author directly.
1253</para>
1254</listitem>
1255</varlistentry>
1256<varlistentry>
1257<term>Group reply</term>
1258<listitem>
1259<para>
1260Reply to the author as well to all recipients except you; this consults
1261<link linkend="alternates"><command>alternates</command></link>.
1262</para>
1263</listitem>
1264</varlistentry>
1265<varlistentry>
1266<term>List reply</term>
1267<listitem>
1268<para>
1269Reply to all mailing list addresses found, either specified via
1270configuration or auto-detected. See <xref linkend="lists"/> for
1271details.
1272</para>
1273</listitem>
1274</varlistentry>
1275</variablelist>
1276
1277<para>
1278After getting recipients for new messages, forwards or replies, Mutt
1279will then automatically start your <link linkend="editor">$editor</link>
1280on the message body. If the <link
1281linkend="edit-headers">$edit_headers</link> variable is set, the headers
1282will be at the top of the message in your editor; the message body
1283should start on a new line after the existing blank line at the end of
1284headers. Any messages you are replying to will be added in sort order
1285to the message, with appropriate
1286<link linkend="attribution">$attribution</link>, <link
1287linkend="indent-string">$indent_string</link> and <link
1288linkend="post-indent-string">$post_indent_string</link>. When
1289forwarding a message, if the <link
1290linkend="mime-forward">$mime_forward</link> variable is unset, a copy of
1291the forwarded message will be included. If you have specified a <link
1292linkend="signature">$signature</link>, it will be appended to the
1293message.
1294</para>
1295
1296<para>
1297Once you have finished editing the body of your mail message, you are
1298returned to the <emphasis>compose</emphasis> menu providing the
1299functions shown in <xref linkend="tab-func-compose"/> to modify, send or
1300postpone the message.
1301</para>
1302
1303<table id="tab-func-compose">
1304<title>Most common compose menu keys</title>
1305<tgroup cols="3">
1306<thead>
1307<row><entry>Key</entry><entry>Function</entry><entry>Description</entry></row>
1308</thead>
1309<tbody>
1310<row><entry>a</entry><entry><literal><attach-file></literal></entry><entry>attach a file</entry></row>
1311<row><entry>A</entry><entry><literal><attach-message></literal></entry><entry>attach message(s) to the message</entry></row>
1312<row><entry>Esc k</entry><entry><literal><attach-key></literal></entry><entry>attach a PGP public key</entry></row>
1313<row><entry>d</entry><entry><literal><edit-description></literal></entry><entry>edit description on attachment</entry></row>
1314<row><entry>D</entry><entry><literal><detach-file></literal></entry><entry>detach a file</entry></row>
1315<row><entry>t</entry><entry><literal><edit-to></literal></entry><entry>edit the To field</entry></row>
1316<row><entry>Esc f</entry><entry><literal><edit-from></literal></entry><entry>edit the From field</entry></row>
1317<row><entry>r</entry><entry><literal><edit-reply-to></literal></entry><entry>edit the Reply-To field</entry></row>
1318<row><entry>c</entry><entry><literal><edit-cc></literal></entry><entry>edit the Cc field</entry></row>
1319<row><entry>b</entry><entry><literal><edit-bcc></literal></entry><entry>edit the Bcc field</entry></row>
1320<row><entry>y</entry><entry><literal><send-message></literal></entry><entry>send the message</entry></row>
1321<row><entry>s</entry><entry><literal><edit-subject></literal></entry><entry>edit the Subject</entry></row>
1322<row><entry>S</entry><entry><literal><smime-menu></literal></entry><entry>select S/MIME options</entry></row>
1323<row><entry>f</entry><entry><literal><edit-fcc></literal></entry><entry>specify an <quote>Fcc</quote> mailbox</entry></row>
1324<row><entry>p</entry><entry><literal><pgp-menu></literal></entry><entry>select PGP options</entry></row>
1325<row><entry>P</entry><entry><literal><postpone-message></literal></entry><entry>postpone this message until later</entry></row>
1326<row><entry>q</entry><entry><literal><quit></literal></entry><entry>quit (abort) sending the message</entry></row>
1327<row><entry>w</entry><entry><literal><write-fcc></literal></entry><entry>write the message to a folder</entry></row>
1328<row><entry>i</entry><entry><literal><ispell></literal></entry><entry>check spelling (if available on your system)</entry></row>
1329<row><entry>^F</entry><entry><literal><forget-passphrase></literal></entry><entry>wipe passphrase(s) from memory</entry></row>
1330</tbody>
1331</tgroup>
1332</table>
1333
1334<para>
1335The compose menu is also used to edit the attachments for a message
1336which can be either files or other messages. The
1337<literal><attach-message></literal> function to will prompt you
1338for a folder to attach messages from. You can now tag messages in that
1339folder and they will be attached to the message you are sending.
1340</para>
1341
1342<note>
1343<para>
1344Note that certain operations like composing a new mail, replying,
1345forwarding, etc. are not permitted when you are in that folder. The %r
1346in <link linkend="status-format">$status_format</link> will change to a
1347<quote>A</quote> to indicate that you are in attach-message mode.
1348</para>
1349</note>
1350
1351</sect2>
1352
1353<sect2 id="edit-header">
1354<title>Editing the Message Header</title>
1355
1356<para>
1357When editing the header because of <link
1358linkend="edit-headers">$edit_headers</link> being set, there are a
1359several pseudo headers available which will not be included in sent
1360messages but trigger special Mutt behavior.
1361</para>
1362
1363<sect3 id="fcc-header">
1364<title>Fcc: Pseudo Header</title>
1365
1366<para>
1367If you specify
1368</para>
1369
1370<para>
1371<literal>Fcc:</literal> <emphasis>filename</emphasis>
1372</para>
1373
1374<para>
1375as a header, Mutt will pick up <emphasis>filename</emphasis> just as if
1376you had used the <literal><edit-fcc></literal> function in the
1377<emphasis>compose</emphasis> menu. It can later be changed from the
1378compose menu.
1379</para>
1380
1381</sect3>
1382
1383<sect3 id="attach-header">
1384<title>Attach: Pseudo Header</title>
1385
1386<para>
1387You can also attach files to your message by specifying
1388</para>
1389
1390<para>
1391<literal>Attach:</literal> <emphasis>filename</emphasis>
1392[ <emphasis>description</emphasis> ]
1393</para>
1394
1395<para>
1396where <emphasis>filename</emphasis> is the file to attach and
1397<emphasis>description</emphasis> is an optional string to use as the
1398description of the attached file. Spaces in filenames have to be escaped
1399using backslash (<quote>\</quote>). The file can be removed as well as
1400more added from the compose menu.
1401</para>
1402
1403</sect3>
1404
1405<sect3 id="pgp-header">
1406<title>Pgp: Pseudo Header</title>
1407
1408<para>
1409If you want to use PGP, you can specify
1410</para>
1411
1412<para>
1413<literal>Pgp:</literal> [ <literal>E</literal> | <literal>S</literal> | <literal>S</literal><emphasis><id></emphasis> ]
1414
1415</para>
1416
1417<para>
1418<quote>E</quote> selects encryption, <quote>S</quote> selects signing
1419and <quote>S<id></quote> selects signing with the given key,
1420setting <link linkend="pgp-sign-as">$pgp_sign_as</link> permanently. The
1421selection can later be changed in the compose menu.
1422</para>
1423
1424</sect3>
1425
1426<sect3 id="in-reply-to-header">
1427<title>In-Reply-To: Header</title>
1428
1429<para>
1430When replying to messages, the <emphasis>In-Reply-To:</emphasis> header
1431contains the Message-Id of the message(s) you reply to. If you remove or
1432modify its value, Mutt will not generate a
1433<emphasis>References:</emphasis> field, which allows you to create a new
1434message thread, for example to create a new message to a mailing list
1435without having to enter the mailing list's address.
1436</para>
1437
1438<para>
1439If you intend to start a new thread by replying, please make really sure
1440you remove the <emphasis>In-Reply-To:</emphasis> header in your
1441editor. Otherwise, though you'll produce a technically valid reply, some
1442netiquette guardians will be annoyed by this so-called <quote>thread
1443hijacking</quote>.
1444</para>
1445
1446</sect3>
1447
1448</sect2>
1449
1450<sect2 id="sending-crypto">
1451<title>Sending Cryptographically Signed/Encrypted Messages</title>
1452
1453<para>
1454If you have told Mutt to PGP or S/MIME encrypt a message, it will guide
1455you through a key selection process when you try to send the message.
1456Mutt will not ask you any questions about keys which have a certified
1457user ID matching one of the message recipients' mail addresses.
1458However, there may be situations in which there are several keys, weakly
1459certified user ID fields, or where no matching keys can be found.
1460</para>
1461
1462<para>
1463In these cases, you are dropped into a menu with a list of keys from
1464which you can select one. When you quit this menu, or Mutt can't find
1465any matching keys, you are prompted for a user ID. You can, as usually,
1466abort this prompt using <literal>^G</literal>. When you do so, Mutt
1467will return to the compose screen.
1468</para>
1469
1470<para>
1471Once you have successfully finished the key selection, the message will
1472be encrypted using the selected public keys when sent out.
1473</para>
1474
1475<para>
1476Most fields of the entries in the key selection menu (see also <link
1477linkend="pgp-entry-format">$pgp_entry_format</link>) have obvious
1478meanings. But some explanations on the capabilities, flags, and
1479validity fields are in order.
1480</para>
1481
1482<para>
1483The flags sequence (<quote>%f</quote>) will expand to one of the flags
1484in <xref linkend="tab-pgp-menuflags"/>.
1485</para>
1486
1487<table id="tab-pgp-menuflags">
1488<title>PGP key menu flags</title>
1489<tgroup cols="2">
1490<thead>
1491<row><entry>Flag</entry><entry>Description</entry></row>
1492</thead>
1493<tbody>
1494<row><entry>R</entry><entry>The key has been revoked and can't be used.</entry></row>
1495<row><entry>X</entry><entry>The key is expired and can't be used.</entry></row>
1496<row><entry>d</entry><entry>You have marked the key as disabled.</entry></row>
1497<row><entry>c</entry><entry>There are unknown critical self-signature packets.</entry></row>
1498</tbody>
1499</tgroup>
1500</table>
1501
1502<para>
1503The capabilities field (<quote>%c</quote>) expands to a two-character
1504sequence representing a key's capabilities. The first character gives
1505the key's encryption capabilities: A minus sign (<quote>-</quote>) means
1506that the key cannot be used for encryption. A dot (<quote>.</quote>)
1507means that it's marked as a signature key in one of the user IDs, but
1508may also be used for encryption. The letter <quote>e</quote> indicates
1509that this key can be used for encryption.
1510</para>
1511
1512<para>
1513The second character indicates the key's signing capabilities. Once
1514again, a <quote>-</quote> implies <quote>not for signing</quote>,
1515<quote>.</quote> implies that the key is marked as an encryption key in
1516one of the user-ids, and <quote>s</quote> denotes a key which can be
1517used for signing.
1518</para>
1519
1520<para>
1521Finally, the validity field (<quote>%t</quote>) indicates how
1522well-certified a user-id is. A question mark (<quote>?</quote>)
1523indicates undefined validity, a minus character (<quote>-</quote>) marks
1524an untrusted association, a space character means a partially trusted
1525association, and a plus character (<quote>+</quote>) indicates complete
1526validity.
1527</para>
1528
1529</sect2>
1530
1531<sect2 id="ff">
1532<title>Sending Format=Flowed Messages</title>
1533
1534<sect3 id="ff-concept">
1535<title>Concept</title>
1536
1537<para>
1538<literal>format=flowed</literal>-style messages (or
1539<literal>f=f</literal> for short) are <literal>text/plain</literal>
1540messages that consist of paragraphs which a receiver's mail client may
1541reformat to its own needs which mostly means to customize line lengths
1542regardless of what the sender sent. Technically this is achieved by
1543letting lines of a <quote>flowable</quote> paragraph end in spaces
1544except for the last line.
1545</para>
1546
1547<para>
1548While for text-mode clients like Mutt it's the best way to assume only a
1549standard 80x25 character cell terminal, it may be desired to let the
1550receiver decide completely how to view a message.
1551</para>
1552
1553</sect3>
1554
1555<sect3 id="ff-support">
1556<title>Mutt Support</title>
1557
1558<para>
1559Mutt only supports setting the required <literal>format=flowed</literal>
1560MIME parameter on outgoing messages if the <link
1561linkend="text-flowed">$text_flowed</link> variable is set, specifically
1562it does not add the trailing spaces.
1563</para>
1564
1565<para>
1566After editing the initial message text and before entering the compose
1567menu, Mutt properly space-stuffs the message.
1568<emphasis>Space-stuffing</emphasis> is required by RfC3676 defining
1569<literal>format=flowed</literal> and means to prepend a space to:
1570</para>
1571
1572<itemizedlist>
1573<listitem><para>all lines starting with a space</para></listitem>
1574<listitem><para>lines starting with the word
1575<quote><literal>From</literal></quote> followed by
1576space</para></listitem>
1577<listitem><para>all lines starting with
1578<quote><literal>></literal></quote> which is not intended to be a
1579quote character</para></listitem>
1580</itemizedlist>
1581
1582<note>
1583<para>
1584Mutt only supports space-stuffing for the first two types of lines but
1585not for the third: It is impossible to safely detect whether a leading
1586<literal>></literal> character starts a quote or not. Furthermore,
1587Mutt only applies space-stuffing <emphasis>once</emphasis> after the
1588initial edit is finished.
1589</para>
1590</note>
1591
1592<para>
1593All leading spaces are to be removed by receiving clients to restore the
1594original message prior to further processing.
1595</para>
1596
1597</sect3>
1598
1599<sect3 id="ff-editor">
1600<title>Editor Considerations</title>
1601
1602<para>
1603As Mutt provides no additional features to compose
1604<literal>f=f</literal> messages, it's completely up to the user and his
1605editor to produce proper messages. Please consider your editor's
1606documentation if you intend to send <literal>f=f</literal> messages.
1607</para>
1608
1609<para>
1610Please note that when editing messages from the compose menu several
1611times before really sending a mail, it's up to the user to ensure that
1612the message is properly space-stuffed.
1613</para>
1614
1615<para>
1616For example, <emphasis>vim</emphasis> provides the <literal>w</literal>
1617flag for its <literal>formatoptions</literal> setting to assist in
1618creating <literal>f=f</literal> messages, see <literal>:help
1619fo-table</literal> for details.
1620</para>
1621
1622</sect3>
1623
1624<sect3 id="ff-pager">
1625<title>Reformatting</title>
1626
1627<para>
1628 Mutt has some support for reformatting when viewing and replying to
1629 <literal>format=flowed</literal> messages. In order to take advantage of these,
1630 <link linkend="reflow-text">$reflow_text</link> must be set.
1631</para>
1632
1633<itemizedlist>
1634 <listitem>
1635 <para>
1636 Paragraphs are automatically reflowed and wrapped at a width specified
1637 by <link linkend="reflow-wrap">$reflow_wrap</link>.
1638 </para>
1639 </listitem>
1640 <listitem>
1641 <para>
1642 In its original format, the quoting style of <literal>format=flowed</literal>
1643 messages can be difficult to read, and doesn't intermix well with
1644 non-flowed replies.
1645 Setting <link linkend="reflow-space-quotes">$reflow_space_quotes</link>
1646 adds spaces after each level of quoting when in the pager and
1647 replying in a non-flowed format
1648 (i.e. with <link linkend="text-flowed">$text_flowed</link> unset).
1649 </para>
1650 </listitem>
1651 <listitem>
1652 <para>
1653 If <link linkend="reflow-space-quotes">$reflow_space_quotes</link>
1654 is unset, mutt will still add one trailing space after all the
1655 quotes in the pager (but not when replying).
1656 </para>
1657 </listitem>
1658</itemizedlist>
1659
1660</sect3>
1661
1662</sect2>
1663
1664</sect1>
1665
1666<sect1 id="forwarding-mail">
1667<title>Forwarding and Bouncing Mail</title>
1668
1669<para>
1670Bouncing and forwarding let you send an existing message to recipients
1671that you specify. Bouncing a message sends a verbatim copy of a message
1672to alternative addresses as if they were the message's original
1673recipients specified in the Bcc header. Forwarding a message, on the
1674other hand, allows you to modify the message before it is resent (for
1675example, by adding your own comments). Bouncing is done using the
1676<literal><bounce></literal> function and forwarding using the
1677<literal><forward></literal> function bound to <quote>b</quote>
1678and <quote>f</quote> respectively.
1679</para>
1680
1681<para>
1682Forwarding can be done by including the original message in the new
1683message's body (surrounded by indicating lines) or including it as a
1684MIME attachment, depending on the value of the <link
1685linkend="mime-forward">$mime_forward</link> variable. Decoding of
1686attachments, like in the pager, can be controlled by the <link
1687linkend="forward-decode">$forward_decode</link> and <link
1688linkend="mime-forward-decode">$mime_forward_decode</link> variables,
1689respectively. The desired forwarding format may depend on the content,
1690therefore <link linkend="mime-forward">$mime_forward</link> is a
1691quadoption which, for example, can be set to <quote>ask-no</quote>.
1692</para>
1693
1694<para>
1695The inclusion of headers is controlled by the current setting of the
1696<link linkend="weed">$weed</link> variable, unless <link
1697linkend="mime-forward">$mime_forward</link> is set.
1698</para>
1699
1700<para>
1701Editing the message to forward follows the same procedure as sending or
1702replying to a message does.
1703</para>
1704
1705</sect1>
1706
1707<sect1 id="postponing-mail">
1708<title>Postponing Mail</title>
1709
1710<para>
1711At times it is desirable to delay sending a message that you have
1712already begun to compose. When the
1713<literal><postpone-message></literal> function is used in the
1714<emphasis>compose</emphasis> menu, the body of your message and
1715attachments are stored in the mailbox specified by the <link
1716linkend="postponed">$postponed</link> variable. This means that you can
1717recall the message even if you exit Mutt and then restart it at a later
1718time.
1719</para>
1720
1721<para>
1722Once a message is postponed, there are several ways to resume it. From
1723the command line you can use the <quote>-p</quote> option, or if you
1724compose a new message from the <emphasis>index</emphasis> or
1725<emphasis>pager</emphasis> you will be prompted if postponed messages
1726exist. If multiple messages are currently postponed, the
1727<emphasis>postponed</emphasis> menu will pop up and you can select which
1728message you would like to resume.
1729</para>
1730
1731<note>
1732<para>
1733If you postpone a reply to a message, the reply setting of the message
1734is only updated when you actually finish the message and send it. Also,
1735you must be in the same folder with the message you replied to for the
1736status of the message to be updated.
1737</para>
1738</note>
1739
1740<para>
1741See also the <link linkend="postpone">$postpone</link> quad-option.
1742</para>
1743
1744</sect1>
1745
1746</chapter>
1747
1748<chapter id="configuration">
1749<title>Configuration</title>
1750
1751<sect1 id="configuration-files">
1752<title>Location of Initialization Files</title>
1753
1754<para>
1755While the default configuration (or <quote>preferences</quote>) make
1756Mutt usable right out of the box, it is often desirable to tailor Mutt
1757to suit your own tastes. When Mutt is first invoked, it will attempt to
1758read the <quote>system</quote> configuration file (defaults set by your
1759local system administrator), unless the <quote>-n</quote> <link
1760linkend="commandline">command line</link> option is specified. This
1761file is typically <literal>/usr/local/share/mutt/Muttrc</literal> or
1762<literal>/etc/Muttrc</literal>. Mutt will next look for a file named
1763<literal>.muttrc</literal> in your home directory. If this file does
1764not exist and your home directory has a subdirectory named
1765<literal>.mutt</literal>, Mutt tries to load a file named
1766<literal>.mutt/muttrc</literal>.
1767</para>
1768
1769<para>
1770<literal>.muttrc</literal> is the file where you will usually place your
1771<link linkend="commands">commands</link> to configure Mutt.
1772</para>
1773
1774<para>
1775In addition, Mutt supports version specific configuration files that are
1776parsed instead of the default files as explained above. For instance,
1777if your system has a <literal>Muttrc-0.88</literal> file in the system
1778configuration directory, and you are running version 0.88 of Mutt, this
1779file will be sourced instead of the <literal>Muttrc</literal> file. The
1780same is true of the user configuration file, if you have a file
1781<literal>.muttrc-0.88.6</literal> in your home directory, when you run
1782Mutt version 0.88.6, it will source this file instead of the default
1783<literal>.muttrc</literal> file. The version number is the same which
1784is visible using the <quote>-v</quote> <link
1785linkend="commandline">command line</link> switch or using the
1786<literal>show-version</literal> key (default: V) from the index menu.
1787</para>
1788
1789</sect1>
1790
1791<sect1 id="muttrc-syntax" xreflabel="Syntax of Initialization Files">
1792<title>Syntax of Initialization Files</title>
1793
1794<para>
1795An initialization file consists of a series of <link
1796linkend="commands">commands</link>. Each line of the file may contain
1797one or more commands. When multiple commands are used, they must be
1798separated by a semicolon (<quote>;</quote>).
1799</para>
1800
1801<example id="ex-rc-multiple-cmds">
1802<title>Multiple configuration commands per line</title>
1803<screen>
1804set realname='Mutt user' ; ignore x-
1805</screen>
1806</example>
1807
1808<para>
1809The hash mark, or pound sign (<quote>#</quote>), is used as a
1810<quote>comment</quote> character. You can use it to annotate your
1811initialization file. All text after the comment character to the end of
1812the line is ignored.
1813</para>
1814
1815<example id="ex-ec-comment">
1816<title>Commenting configuration files</title>
1817<screen>
1818my_hdr X-Disclaimer: Why are you listening to me? <emphasis role="comment"># This is a comment</emphasis>
1819</screen>
1820</example>
1821
1822<para>
1823Single quotes (<quote>'</quote>) and double quotes (<quote>"</quote>)
1824can be used to quote strings which contain spaces or other special
1825characters. The difference between the two types of quotes is similar
1826to that of many popular shell programs, namely that a single quote is
1827used to specify a literal string (one that is not interpreted for shell
1828variables or quoting with a backslash [see next paragraph]), while
1829double quotes indicate a string for which should be evaluated. For
1830example, backticks are evaluated inside of double quotes, but
1831<emphasis>not</emphasis> for single quotes.
1832</para>
1833
1834<para>
1835<quote>\</quote> quotes the next character, just as in shells such as
1836bash and zsh. For example, if want to put quotes <quote>"</quote>
1837inside of a string, you can use <quote>\</quote> to force the next
1838character to be a literal instead of interpreted character.
1839</para>
1840
1841<example id="ex-rc-quote">
1842<title>Escaping quotes in configuration files</title>
1843<screen>
1844set realname="Michael \"MuttDude\" Elkins"
1845</screen>
1846</example>
1847
1848<para>
1849<quote>\\</quote> means to insert a literal <quote>\</quote> into the line.
1850<quote>\n</quote> and <quote>\r</quote> have their usual C meanings of linefeed and
1851carriage-return, respectively.
1852</para>
1853
1854<para>
1855A <quote>\</quote> at the end of a line can be used to split commands
1856over multiple lines as it <quote>escapes</quote> the line end, provided
1857that the split points don't appear in the middle of command names. Lines
1858are first concatenated before interpretation so that a multi-line can be
1859commented by commenting out the first line only.
1860</para>
1861
1862<example id="ex-rc-split">
1863<title>Splitting long configuration commands over several lines</title>
1864<screen>
1865set status_format="some very \
1866long value split \
1867over several lines"
1868</screen>
1869</example>
1870
1871<para>
1872It is also possible to substitute the output of a Unix command in an
1873initialization file. This is accomplished by enclosing the command in
1874backticks (``). In <xref linkend="ex-rc-backtick"/>, the output of the
1875Unix command <quote>uname -a</quote> will be substituted before the line
1876is parsed. Since initialization files are line oriented, only the first
1877line of output from the Unix command will be substituted.
1878</para>
1879
1880<example id="ex-rc-backtick">
1881<title>Using external command's output in configuration files</title>
1882<screen>
1883my_hdr X-Operating-System: `uname -a`
1884</screen>
1885</example>
1886
1887<para>
1888Both environment variables and Mutt variables can be accessed by
1889prepending <quote>$</quote> to the name of the variable. For example,
1890</para>
1891
1892<example id="ex-rc-env">
1893<title>Using environment variables in configuration files</title>
1894<screen>
1895set record=+sent_on_$HOSTNAME
1896</screen>
1897</example>
1898
1899<para>
1900will cause Mutt to save outgoing messages to a folder named
1901<quote>sent_on_kremvax</quote> if the environment variable
1902<literal>$HOSTNAME</literal> is set to <quote>kremvax.</quote> (See
1903<link linkend="record">$record</link> for details.)
1904</para>
1905
1906<para>
1907Mutt expands the variable when it is assigned, not when it is used. If
1908the value of a variable on the right-hand side of an assignment changes
1909after the assignment, the variable on the left-hand side will not be
1910affected.
1911</para>
1912
1913<para>
1914The commands understood by Mutt are explained in the next paragraphs.
1915For a complete list, see the <link linkend="commands">command
1916reference</link>.
1917</para>
1918
1919<para>
1920All configuration files are expected to be in the current locale as
1921specified by the <link linkend="charset">$charset</link> variable which
1922doesn't have a default value since it's determined by Mutt at startup.
1923If a configuration file is not encoded in the same character set the
1924<link linkend="config-charset">$config_charset</link> variable should be
1925used: all lines starting with the next are recoded from <link
1926linkend="config-charset">$config_charset</link> to <link
1927linkend="charset">$charset</link>.
1928</para>
1929
1930<para>
1931This mechanism should be avoided if possible as it has the following
1932implications:
1933</para>
1934
1935<itemizedlist>
1936
1937<listitem><para>These variables should be set early in a configuration
1938file with <link linkend="charset">$charset</link> preceding <link
1939linkend="config-charset">$config_charset</link> so Mutt knows what
1940character set to convert to.</para></listitem>
1941
1942<listitem><para>If <link linkend="config-charset">$config_charset</link>
1943is set, it should be set in each configuration file because the value is
1944global and <emphasis>not</emphasis> per configuration
1945file.</para></listitem>
1946
1947<listitem><para>Because Mutt first recodes a line before it attempts to
1948parse it, a conversion introducing question marks or other characters as
1949part of errors (unconvertable characters, transliteration) may introduce
1950syntax errors or silently change the meaning of certain tokens
1951(e.g. inserting question marks into regular
1952expressions).</para></listitem>
1953
1954</itemizedlist>
1955
1956</sect1>
1957
1958<sect1 id="addrgroup">
1959<title>Address Groups</title>
1960
1961<para>Usage:</para>
1962
1963<cmdsynopsis>
1964<command>group</command>
1965<arg choice="opt" rep="repeat">
1966<option>-group</option>
1967<replaceable class="parameter">name</replaceable>
1968</arg>
1969<group choice="req">
1970<arg choice="plain" rep="repeat">
1971<option>-rx</option>
1972<replaceable class="parameter">expr</replaceable>
1973</arg>
1974<arg choice="plain" rep="repeat">
1975<option>-addr</option>
1976<replaceable class="parameter">expr</replaceable>
1977</arg>
1978</group>
1979
1980<command>ungroup</command>
1981<arg choice="opt" rep="repeat">
1982<option>-group</option>
1983<replaceable class="parameter">name</replaceable>
1984</arg>
1985<group choice="req">
1986<arg choice="plain">
1987<replaceable class="parameter">*</replaceable>
1988</arg>
1989<arg choice="plain" rep="repeat">
1990<option>-rx</option>
1991<replaceable class="parameter">expr</replaceable>
1992</arg>
1993<arg choice="plain" rep="repeat">
1994<option>-addr</option>
1995<replaceable class="parameter">expr</replaceable>
1996</arg>
1997</group>
1998</cmdsynopsis>
1999
2000<para>
2001Mutt supports grouping addresses logically into named groups. An address
2002or address pattern can appear in several groups at the same time. These
2003groups can be used in <link linkend="patterns">patterns</link> (for searching, limiting and tagging) and
2004in hooks by using group patterns. This can be useful to classify mail
2005and take certain actions depending on in what groups the message is.
2006For example, the mutt user's mailing list would fit into the categories
2007<quote>mailing list</quote> and <quote>mutt-related</quote>. Using <link
2008linkend="send-hook"><literal>send-hook</literal></link>, the sender can
2009be set to a dedicated one for writing mailing list messages, and the
2010signature could be set to a mutt-related one for writing to a mutt list
2011— for other lists, the list sender setting still applies but a
2012different signature can be selected. Or, given a group only containing
2013recipients known to accept encrypted mail,
2014<quote>auto-encryption</quote> can be achieved easily.
2015</para>
2016
2017<para>
2018The <command>group</command> command is used to directly add either
2019addresses or regular expressions to the specified group or groups. The
2020different categories of arguments to the <command>group</command>
2021command can be in any order. The flags <literal>-rx</literal> and
2022<literal>-addr</literal> specify what the following strings (that cannot
2023begin with a hyphen) should be interpreted as: either a regular
2024expression or an email address, respectively.
2025</para>
2026
2027<para>
2028These address groups can also be created implicitly by the <link
2029linkend="alias"><command>alias</command></link>, <link
2030linkend="lists"><command>lists</command></link>, <link
2031linkend="lists"><command>subscribe</command></link> and <link
2032linkend="alternates"><command>alternates</command></link> commands by
2033specifying the optional <literal>-group</literal> option. For example,
2034</para>
2035
2036<screen>
2037alternates -group me address1 address2
2038alternates -group me -group work address3
2039</screen>
2040
2041<para>
2042would create a group named <quote>me</quote> which contains all your
2043addresses and a group named <quote>work</quote> which contains only your
2044work address <emphasis>address3</emphasis>. Besides many other
2045possibilities, this could be used to automatically mark your own
2046messages in a mailing list folder as read or use a special signature for
2047work-related messages.
2048</para>
2049
2050<para>
2051The <command>ungroup</command> command is used to remove addresses or
2052regular expressions from the specified group or groups. The syntax is
2053similar to the <command>group</command> command, however the special
2054character <literal>*</literal> can be used to empty a group of all of
2055its contents. As soon as a group gets empty because all addresses and
2056regular expressions have been removed, it'll internally be removed, too
2057(i.e. there cannot be an empty group). When removing regular expressions
2058from a group, the pattern must be specified exactly as given to the
2059<command>group</command> command or <literal>-group</literal> argument.
2060</para>
2061
2062</sect1>
2063
2064<sect1 id="alias">
2065<title>Defining/Using Aliases</title>
2066
2067<para>Usage:</para>
2068
2069<cmdsynopsis>
2070<command>alias</command>
2071<arg choice="opt" rep="repeat">
2072<option>-group</option>
2073<replaceable class="parameter">name</replaceable>
2074</arg>
2075<arg choice="plain">
2076<replaceable class="parameter">key</replaceable>
2077</arg>
2078<arg choice="plain">
2079<replaceable class="parameter">address</replaceable>
2080</arg>
2081<arg choice="opt" rep="repeat">
2082<replaceable class="parameter">address</replaceable>
2083</arg>
2084
2085<command>unalias</command>
2086<arg choice="opt" rep="repeat">
2087<option>-group</option>
2088<replaceable>name</replaceable>
2089</arg>
2090<group choice="req">
2091<arg choice="plain">
2092<replaceable class="parameter">*</replaceable>
2093</arg>
2094<arg choice="plain" rep="repeat">
2095<replaceable class="parameter">key</replaceable>
2096</arg>
2097</group>
2098</cmdsynopsis>
2099
2100<para>
2101It's usually very cumbersome to remember or type out the address of
2102someone you are communicating with. Mutt allows you to create
2103<quote>aliases</quote> which map a short string to a full address.
2104</para>
2105
2106<note>
2107<para>
2108If you want to create an alias for more than one address, you
2109<emphasis>must</emphasis> separate the addresses with a comma
2110(<quote>,</quote>).
2111</para>
2112</note>
2113
2114<para>
2115The optional <literal>-group</literal> argument to
2116<command>alias</command> causes the aliased address(es) to be added to
2117the named <emphasis>group</emphasis>.
2118</para>
2119
2120<para>
2121To remove an alias or aliases (<quote>*</quote> means all aliases):
2122</para>
2123
2124<screen>
2125alias muttdude me@cs.hmc.edu (Michael Elkins)
2126alias theguys manny, moe, jack
2127</screen>
2128
2129<para>
2130Unlike other mailers, Mutt doesn't require aliases to be defined in a
2131special file. The <command>alias</command> command can appear anywhere
2132in a configuration file, as long as this file is <link
2133linkend="source"><command>source</command>d</link>. Consequently, you
2134can have multiple alias files, or you can have all aliases defined in
2135your <literal>.muttrc</literal>.
2136</para>
2137
2138<para>
2139On the other hand, the <link
2140linkend="create-alias"><literal><create-alias></literal></link>
2141function can use only one file, the one pointed to by the <link
2142linkend="alias-file">$alias_file</link> variable (which is
2143<literal>~/.muttrc</literal> by default). This file is not special
2144either, in the sense that Mutt will happily append aliases to any file,
2145but in order for the new aliases to take effect you need to explicitly
2146<link linkend="source"><command>source</command></link> this file too.
2147</para>
2148
2149<example id="ex-alias-external">
2150<title>Configuring external alias files</title>
2151<screen>
2152source /usr/local/share/Mutt.aliases
2153source ~/.mail_aliases
2154set alias_file=~/.mail_aliases
2155</screen>
2156</example>
2157
2158<para>
2159To use aliases, you merely use the alias at any place in Mutt where Mutt
2160prompts for addresses, such as the <emphasis>To:</emphasis> or
2161<emphasis>Cc:</emphasis> prompt. You can also enter aliases in your
2162editor at the appropriate headers if you have the <link
2163linkend="edit-headers">$edit_headers</link> variable set.
2164</para>
2165
2166<para>
2167In addition, at the various address prompts, you can use the tab
2168character to expand a partial alias to the full alias. If there are
2169multiple matches, Mutt will bring up a menu with the matching aliases.
2170In order to be presented with the full list of aliases, you must hit tab
2171without a partial alias, such as at the beginning of the prompt or after
2172a comma denoting multiple addresses.
2173</para>
2174
2175<para>
2176In the alias menu, you can select as many aliases as you want with the
2177<literal>select-entry</literal> key (default: <Return>), and use
2178the <emphasis>exit</emphasis> key (default: q) to return to the address
2179prompt.
2180</para>
2181
2182</sect1>
2183
2184<sect1 id="bind">
2185<title>Changing the Default Key Bindings</title>
2186
2187<para>Usage:</para>
2188
2189<cmdsynopsis>
2190<command>bind</command>
2191<arg choice="plain">
2192<replaceable class="parameter">map</replaceable>
2193</arg>
2194<arg choice="plain">
2195<replaceable class="parameter">key</replaceable>
2196</arg>
2197<arg choice="plain">
2198<replaceable class="parameter">function</replaceable>
2199</arg>
2200</cmdsynopsis>
2201
2202<para>
2203This command allows you to change the default key bindings (operation
2204invoked when pressing a key).
2205</para>
2206
2207<para>
2208<emphasis>map</emphasis> specifies in which menu the binding belongs.
2209Multiple maps may be specified by separating them with commas (no
2210additional whitespace is allowed). The currently defined maps are:
2211</para>
2212
2213<anchor id="maps"/>
2214<variablelist>
2215
2216<varlistentry>
2217<term>generic</term>
2218<listitem>
2219<para>
2220This is not a real menu, but is used as a fallback for all of the other
2221menus except for the pager and editor modes. If a key is not defined in
2222another menu, Mutt will look for a binding to use in this menu. This
2223allows you to bind a key to a certain function in multiple menus instead
2224of having multiple <command>bind</command> statements to accomplish the
2225same task.
2226</para>
2227</listitem>
2228</varlistentry>
2229<varlistentry>
2230<term>alias</term>
2231<listitem>
2232<para>
2233The alias menu is the list of your personal aliases as defined in your
2234<literal>.muttrc</literal>. It is the mapping from a short alias name
2235to the full email address(es) of the recipient(s).
2236</para>
2237</listitem>
2238</varlistentry>
2239<varlistentry>
2240<term>attach</term>
2241<listitem>
2242<para>
2243The attachment menu is used to access the attachments on received
2244messages.
2245</para>
2246</listitem>
2247</varlistentry>
2248<varlistentry>
2249<term>browser</term>
2250<listitem>
2251<para>
2252The browser is used for both browsing the local directory structure, and
2253for listing all of your incoming mailboxes.
2254</para>
2255</listitem>
2256</varlistentry>
2257<varlistentry>
2258<term>editor</term>
2259<listitem>
2260<para>
2261The editor is used to allow the user to enter a single line of text, such as
2262the <emphasis>To</emphasis> or <emphasis>Subject</emphasis> prompts in the
2263<literal>compose</literal> menu.
2264</para>
2265</listitem>
2266</varlistentry>
2267<varlistentry>
2268<term>index</term>
2269<listitem>
2270<para>
2271The index is the list of messages contained in a mailbox.
2272</para>
2273</listitem>
2274</varlistentry>
2275<varlistentry>
2276<term>compose</term>
2277<listitem>
2278<para>
2279The compose menu is the screen used when sending a new message.
2280</para>
2281</listitem>
2282</varlistentry>
2283<varlistentry>
2284<term>pager</term>
2285<listitem>
2286<para>
2287The pager is the mode used to display message/attachment data, and help
2288listings.
2289</para>
2290</listitem>
2291</varlistentry>
2292<varlistentry>
2293<term>pgp</term>
2294<listitem>
2295<para>
2296The pgp menu is used to select the OpenPGP keys used to encrypt outgoing
2297messages.
2298</para>
2299</listitem>
2300</varlistentry>
2301<varlistentry>
2302<term>smime</term>
2303<listitem>
2304<para>
2305The smime menu is used to select the OpenSSL certificates used to
2306encrypt outgoing messages.
2307</para>
2308</listitem>
2309</varlistentry>
2310<varlistentry>
2311<term>postpone</term>
2312<listitem>
2313<para>
2314The postpone menu is similar to the index menu, except is used when
2315recalling a message the user was composing, but saved until later.
2316</para>
2317</listitem>
2318</varlistentry>
2319<varlistentry>
2320<term>query</term>
2321<listitem>
2322<para>
2323The query menu is the browser for results returned by <link
2324linkend="query-command">$query_command</link>.
2325</para>
2326</listitem>
2327</varlistentry>
2328<varlistentry>
2329<term>mix</term>
2330<listitem>
2331<para>
2332The mixmaster screen is used to select remailer options for outgoing
2333messages (if Mutt is compiled with Mixmaster support).
2334</para>
2335</listitem>
2336</varlistentry>
2337</variablelist>
2338
2339<para>
2340<emphasis>key</emphasis> is the key (or key sequence) you wish to bind.
2341To specify a control character, use the sequence
2342<emphasis>\Cx</emphasis>, where <emphasis>x</emphasis> is the letter of
2343the control character (for example, to specify control-A use
2344<quote>\Ca</quote>). Note that the case of <emphasis>x</emphasis> as
2345well as <emphasis>\C</emphasis> is ignored, so that
2346<emphasis>\CA</emphasis>, <emphasis>\Ca</emphasis>,
2347<emphasis>\cA</emphasis> and <emphasis>\ca</emphasis> are all
2348equivalent. An alternative form is to specify the key as a three digit
2349octal number prefixed with a <quote>\</quote> (for example
2350<emphasis>\177</emphasis> is equivalent to <emphasis>\c?</emphasis>). In
2351addition, <emphasis>key</emphasis> may be a symbolic name as shown in
2352<xref linkend="tab-key-names"/>.
2353</para>
2354
2355<table id="tab-key-names">
2356<title>Symbolic key names</title>
2357<tgroup cols="2">
2358<thead>
2359<row><entry>Symbolic name</entry><entry>Meaning</entry></row>
2360</thead>
2361<tbody>
2362<row><entry>\t</entry><entry>tab</entry></row>
2363<row><entry><tab></entry><entry>tab</entry></row>
2364<row><entry><backtab></entry><entry>backtab / shift-tab</entry></row>
2365<row><entry>\r</entry><entry>carriage return</entry></row>
2366<row><entry>\n</entry><entry>newline</entry></row>
2367<row><entry>\e</entry><entry>escape</entry></row>
2368<row><entry><esc></entry><entry>escape</entry></row>
2369<row><entry><up></entry><entry>up arrow</entry></row>
2370<row><entry><down></entry><entry>down arrow</entry></row>
2371<row><entry><left></entry><entry>left arrow</entry></row>
2372<row><entry><right></entry><entry>right arrow</entry></row>
2373<row><entry><pageup></entry><entry>Page Up</entry></row>
2374<row><entry><pagedown></entry><entry>Page Down</entry></row>
2375<row><entry><backspace></entry><entry>Backspace</entry></row>
2376<row><entry><delete></entry><entry>Delete</entry></row>
2377<row><entry><insert></entry><entry>Insert</entry></row>
2378<row><entry><enter></entry><entry>Enter</entry></row>
2379<row><entry><return></entry><entry>Return</entry></row>
2380<row><entry><home></entry><entry>Home</entry></row>
2381<row><entry><end></entry><entry>End</entry></row>
2382<row><entry><space></entry><entry>Space bar</entry></row>
2383<row><entry><f1></entry><entry>function key 1</entry></row>
2384<row><entry><f10></entry><entry>function key 10</entry></row>
2385</tbody>
2386</tgroup>
2387</table>
2388
2389<para>
2390The <literal><what-key></literal> function can be used to
2391explore keycode and symbolic names for other keys on your keyboard.
2392Executing this function will display information about each key
2393pressed, until terminated by <literal>^G</literal>.
2394</para>
2395
2396<para>
2397<emphasis>key</emphasis> does not need to be enclosed in quotes unless
2398it contains a space (<quote> </quote>) or semi-colon
2399(<quote>;</quote>).
2400</para>
2401
2402<para>
2403<emphasis>function</emphasis> specifies which action to take when
2404<emphasis>key</emphasis> is pressed. For a complete list of functions,
2405see the <link linkend="functions">reference</link>. Note that the
2406<command>bind</command> expects <emphasis>function</emphasis> to be
2407specified without angle brackets.
2408</para>
2409
2410<para>
2411The special function <literal><noop></literal> unbinds the
2412specified key sequence.
2413</para>
2414
2415</sect1>
2416
2417<sect1 id="charset-hook">
2418<title>Defining Aliases for Character Sets</title>
2419
2420<para>Usage:</para>
2421
2422<cmdsynopsis>
2423<command>charset-hook</command>
2424<arg choice="plain">
2425<replaceable class="parameter">alias</replaceable>
2426</arg>
2427<arg choice="plain">
2428<replaceable class="parameter">charset</replaceable>
2429</arg>
2430
2431<command>iconv-hook<anchor id="iconv-hook"/></command>
2432<arg choice="plain">
2433<replaceable class="parameter">charset</replaceable>
2434</arg>
2435<arg choice="plain">
2436<replaceable class="parameter">local-charset</replaceable>
2437</arg>
2438</cmdsynopsis>
2439
2440<para>
2441The <command>charset-hook</command> command defines an alias for a
2442character set. This is useful to properly display messages which are
2443tagged with a character set name not known to Mutt.
2444</para>
2445
2446<para>
2447The <command>iconv-hook</command> command defines a system-specific name
2448for a character set. This is helpful when your systems character
2449conversion library insists on using strange, system-specific names for
2450character sets.
2451</para>
2452
2453</sect1>
2454
2455<sect1 id="folder-hook">
2456<title>Setting Variables Based Upon Mailbox</title>
2457
2458<para>Usage:</para>
2459
2460<cmdsynopsis>
2461<command>folder-hook</command>
2462<arg choice="plain">
2463<replaceable class="parameter">[!]regexp</replaceable>
2464</arg>
2465<arg choice="plain">
2466<replaceable class="parameter">command</replaceable>
2467</arg>
2468</cmdsynopsis>
2469
2470<para>
2471It is often desirable to change settings based on which mailbox you are
2472reading. The <command>folder-hook</command> command provides a method
2473by which you can execute any configuration command.
2474<emphasis>regexp</emphasis> is a regular expression specifying in which
2475mailboxes to execute <emphasis>command</emphasis> before loading. If a
2476mailbox matches multiple <command>folder-hook</command>s, they are
2477executed in the order given in the <literal>.muttrc</literal>.
2478</para>
2479
2480<para>
2481The regexp parameter has <link linkend="shortcuts">mailbox
2482shortcut</link> expansion performed on the first character.
2483See <xref linkend="mailbox-hook"/> for more details.
2484</para>
2485
2486<note>
2487<para>
2488If you use the <quote>!</quote> shortcut for <link
2489linkend="spoolfile">$spoolfile</link> at the beginning of the pattern,
2490you must place it inside of double or single quotes in order to
2491distinguish it from the logical <emphasis>not</emphasis> operator for
2492the expression.
2493</para>
2494</note>
2495
2496<note>
2497<para>
2498Settings are <emphasis>not</emphasis> restored when you leave the
2499mailbox. For example, a command action to perform is to change the
2500sorting method based upon the mailbox being read:
2501</para>
2502
2503<screen>
2504folder-hook mutt "set sort=threads"</screen>
2505
2506<para>
2507However, the sorting method is not restored to its previous value when
2508reading a different mailbox. To specify a <emphasis>default</emphasis>
2509command, use the pattern <quote>.</quote> before other
2510<command>folder-hook</command>s adjusting a value on a per-folder basis
2511because <command>folder-hook</command>s are evaluated in the order given
2512in the configuration file.
2513</para>
2514</note>
2515
2516<note>
2517<para>
2518The keyboard buffer will not be processed until after all hooks
2519are run; multiple <link linkend="push">push</link> or <link
2520linkend="exec">exec</link> commands will end up being processed in
2521reverse order.
2522</para>
2523</note>
2524
2525<para>
2526The following example will set the <link linkend="sort">sort</link>
2527variable to <literal>date-sent</literal> for all folders but to
2528<literal>threads</literal> for all folders containing
2529<quote>mutt</quote> in their name.
2530</para>
2531
2532<example id="ex-folder-sorting">
2533<title>Setting sort method based on mailbox name</title>
2534<screen>
2535folder-hook . "set sort=date-sent"
2536folder-hook mutt "set sort=threads"
2537</screen>
2538</example>
2539
2540</sect1>
2541
2542<sect1 id="macro">
2543<title>Keyboard Macros</title>
2544
2545<para>Usage:</para>
2546
2547<cmdsynopsis>
2548<command>macro</command>
2549<arg choice="plain">
2550<replaceable class="parameter">menu</replaceable>
2551</arg>
2552<arg choice="plain">
2553<replaceable class="parameter">key</replaceable>
2554</arg>
2555<arg choice="plain">
2556<replaceable class="parameter">sequence</replaceable>
2557</arg>
2558<arg choice="opt">
2559<replaceable class="parameter">description</replaceable>
2560</arg>
2561</cmdsynopsis>
2562
2563<para>
2564Macros are useful when you would like a single key to perform a series
2565of actions. When you press <emphasis>key</emphasis> in menu
2566<emphasis>menu</emphasis>, Mutt will behave as if you had typed
2567<emphasis>sequence</emphasis>. So if you have a common sequence of
2568commands you type, you can create a macro to execute those commands with
2569a single key or fewer keys.
2570</para>
2571
2572<para>
2573<emphasis>menu</emphasis> is the <link linkend="maps">map</link> which
2574the macro will be bound in. Multiple maps may be specified by
2575separating multiple menu arguments by commas. Whitespace may not be used
2576in between the menu arguments and the commas separating them.
2577</para>
2578
2579<para>
2580<emphasis>key</emphasis> and <emphasis>sequence</emphasis> are expanded
2581by the same rules as the <link linkend="bind">key bindings</link> with
2582some additions. The first is that control characters in
2583<emphasis>sequence</emphasis> can also be specified as
2584<emphasis>^x</emphasis>. In order to get a caret (<quote>^</quote>) you
2585need to use <emphasis>^^</emphasis>. Secondly, to specify a certain key
2586such as <emphasis>up</emphasis> or to invoke a function directly, you
2587can use the format <emphasis><key name></emphasis> and
2588<emphasis><function name></emphasis>. For a listing of key names
2589see the section on <link linkend="bind">key bindings</link>. Functions
2590are listed in the <link linkend="functions">reference</link>.
2591</para>
2592
2593<para>
2594The advantage with using function names directly is that the macros will
2595work regardless of the current key bindings, so they are not dependent
2596on the user having particular key definitions. This makes them more
2597robust and portable, and also facilitates defining of macros in files
2598used by more than one user (e.g., the system Muttrc).
2599</para>
2600
2601<para>
2602Optionally you can specify a descriptive text after
2603<emphasis>sequence</emphasis>, which is shown in the help screens if
2604they contain a description.
2605</para>
2606
2607<note>
2608<para>
2609Macro definitions (if any) listed in the help screen(s), are
2610silently truncated at the screen width, and are not wrapped.
2611</para>
2612</note>
2613
2614</sect1>
2615
2616<sect1 id="color">
2617<title>Using Color and Mono Video Attributes</title>
2618
2619<para>Usage:</para>
2620
2621<cmdsynopsis>
2622<command>color</command>
2623<arg choice="plain">
2624<replaceable class="parameter">object</replaceable>
2625</arg>
2626<arg choice="plain">
2627<replaceable class="parameter">foreground</replaceable>
2628</arg>
2629<arg choice="plain">
2630<replaceable class="parameter">background</replaceable>
2631</arg>
2632
2633<command>color</command>
2634<group choice="req">
2635<arg choice="plain">
2636<option>header</option>
2637</arg>
2638<arg choice="plain">
2639<option>body</option>
2640</arg>
2641</group>
2642<arg choice="plain">
2643<replaceable class="parameter">foreground</replaceable>
2644</arg>
2645<arg choice="plain">
2646<replaceable class="parameter">background</replaceable>
2647</arg>
2648<arg choice="plain">
2649<replaceable class="parameter">regexp</replaceable>
2650</arg>
2651
2652<command>color</command>
2653<arg choice="plain">
2654<option>index</option>
2655</arg>
2656<arg choice="plain">
2657<replaceable class="parameter">foreground</replaceable>
2658</arg>
2659<arg choice="plain">
2660<replaceable class="parameter">background</replaceable>
2661</arg>
2662<arg choice="plain">
2663<replaceable class="parameter">pattern</replaceable>
2664</arg>
2665
2666<command>uncolor</command>
2667<group choice="req">
2668<arg choice="plain">
2669<option>index</option>
2670</arg>
2671<arg choice="plain">
2672<option>header</option>
2673</arg>
2674<arg choice="plain">
2675<option>body</option>
2676</arg>
2677</group>
2678<group choice="req">
2679<arg choice="plain">
2680<replaceable>*</replaceable>
2681</arg>
2682<arg choice="plain" rep="repeat">
2683<replaceable>pattern</replaceable>
2684</arg>
2685</group>
2686</cmdsynopsis>
2687
2688<para>
2689If your terminal supports color, you can spice up Mutt by creating your
2690own color scheme. To define the color of an object (type of
2691information), you must specify both a foreground color
2692<emphasis>and</emphasis> a background color (it is not possible to only
2693specify one or the other).
2694</para>
2695
2696<para>
2697<emphasis>header</emphasis> and <emphasis>body</emphasis> match
2698<emphasis>regexp</emphasis> in the header/body of a message,
2699<emphasis>index</emphasis> matches <emphasis>pattern</emphasis> (see
2700<xref linkend="patterns"/>) in the message index. Note that IMAP
2701server-side searches (=b, =B, =h) are not supported for color index
2702patterns.
2703</para>
2704
2705<para>
2706<emphasis>object</emphasis> can be one of:
2707</para>
2708
2709<itemizedlist>
2710<listitem><para>attachment</para></listitem>
2711<listitem><para>bold (highlighting bold patterns in the body of messages)</para></listitem>
2712<listitem><para>error (error messages printed by Mutt)</para></listitem>
2713<listitem><para>hdrdefault (default color of the message header in the pager)</para></listitem>
2714<listitem><para>indicator (arrow or bar used to indicate the current item in a menu)</para></listitem>
2715<listitem><para>markers (the <quote>+</quote> markers at the beginning of wrapped lines in the pager)</para></listitem>
2716<listitem><para>message (informational messages)</para></listitem>
2717<listitem><para>normal</para></listitem>
2718<listitem><para>prompt</para></listitem>
2719<listitem><para>quoted (text matching <link linkend="quote-regexp">$quote_regexp</link> in the body of a message)</para></listitem>
2720<listitem><para>quoted1, quoted2, ..., quoted<emphasis>N</emphasis> (higher levels of quoting)</para></listitem>
2721<listitem><para>search (highlighting of words in the pager)</para></listitem>
2722<listitem><para>signature</para></listitem>
2723<listitem><para>status (mode lines used to display info about the mailbox or message)</para></listitem>
2724<listitem><para>tilde (the <quote>~</quote> used to pad blank lines in the pager)</para></listitem>
2725<listitem><para>tree (thread tree drawn in the message index and attachment menu)</para></listitem>
2726<listitem><para>underline (highlighting underlined patterns in the body of messages)</para></listitem>
2727</itemizedlist>
2728
2729<para>
2730<emphasis>foreground</emphasis> and <emphasis>background</emphasis> can
2731be one of the following:
2732</para>
2733
2734<itemizedlist>
2735<listitem><para>white</para></listitem>
2736<listitem><para>black</para></listitem>
2737<listitem><para>green</para></listitem>
2738<listitem><para>magenta</para></listitem>
2739<listitem><para>blue</para></listitem>
2740<listitem><para>cyan</para></listitem>
2741<listitem><para>yellow</para></listitem>
2742<listitem><para>red</para></listitem>
2743<listitem><para>default</para></listitem>
2744<listitem><para>color<emphasis>x</emphasis></para>
2745</listitem>
2746</itemizedlist>
2747
2748<para>
2749<emphasis>foreground</emphasis> can optionally be prefixed with the
2750keyword <literal>bright</literal> to make the foreground color boldfaced
2751(e.g., <literal>brightred</literal>).
2752</para>
2753
2754<para>
2755If your terminal supports it, the special keyword
2756<emphasis>default</emphasis> can be used as a transparent color. The
2757value <emphasis>brightdefault</emphasis> is also valid. If Mutt is
2758linked against the <emphasis>S-Lang</emphasis> library, you also need to
2759set the <literal>$COLORFGBG</literal> environment variable to the
2760default colors of your terminal for this to work; for example (for
2761Bourne-like shells):
2762</para>
2763
2764<screen>
2765set COLORFGBG="green;black"
2766export COLORFGBG
2767</screen>
2768
2769<note>
2770<para>
2771The <emphasis>S-Lang</emphasis> library requires you to use the
2772<emphasis>lightgray</emphasis> and <emphasis>brown</emphasis> keywords
2773instead of <emphasis>white</emphasis> and <emphasis>yellow</emphasis>
2774when setting this variable.
2775</para>
2776</note>
2777
2778<note>
2779<para>
2780The <command>uncolor</command> command can be applied to the index,
2781header and body objects only. It removes entries from the list. You
2782<emphasis>must</emphasis> specify the same pattern specified in the
2783<command>color</command> command for it to be removed. The pattern
2784<quote>*</quote> is a special token which means to clear the color list
2785of all entries.
2786</para>
2787</note>
2788
2789<para>
2790Mutt also recognizes the keywords <emphasis>color0</emphasis>,
2791<emphasis>color1</emphasis>, ...,
2792<emphasis>color</emphasis><emphasis>N-1</emphasis>
2793(<emphasis>N</emphasis> being the number of colors supported by your
2794terminal). This is useful when you remap the colors for your display
2795(for example by changing the color associated with
2796<emphasis>color2</emphasis> for your xterm), since color names may then
2797lose their normal meaning.
2798</para>
2799
2800<anchor id="mono"/>
2801<para>
2802If your terminal does not support color, it is still possible change the
2803video attributes through the use of the <quote>mono</quote>
2804command. Usage:
2805</para>
2806
2807<cmdsynopsis>
2808<command>mono</command>
2809<arg choice="plain">
2810<replaceable class="parameter">object</replaceable>
2811</arg>
2812<arg choice="plain">
2813<replaceable class="parameter">attribute</replaceable>
2814</arg>
2815
2816<command>mono</command>
2817<group choice="req">
2818<arg choice="plain">
2819<option>header</option>
2820</arg>
2821<arg choice="plain">
2822<option>body</option>
2823</arg>
2824</group>
2825<arg choice="plain">
2826<replaceable class="parameter">attribute</replaceable>
2827</arg>
2828<arg choice="plain">
2829<replaceable class="parameter">regexp</replaceable>
2830</arg>
2831
2832<command>mono</command>
2833<arg choice="plain">
2834<option>index</option>
2835</arg>
2836<arg choice="plain">
2837<replaceable class="parameter">attribute</replaceable>
2838</arg>
2839<arg choice="plain">
2840<replaceable class="parameter">pattern</replaceable>
2841</arg>
2842
2843<command>unmono</command>
2844<group choice="req">
2845<arg choice="plain">
2846<option>index</option>
2847</arg>
2848<arg choice="plain">
2849<option>header</option>
2850</arg>
2851<arg choice="plain">
2852<option>body</option>
2853</arg>
2854</group>
2855<group choice="req">
2856<arg choice="plain">
2857<replaceable>*</replaceable>
2858</arg>
2859<arg choice="plain" rep="repeat">
2860<replaceable>pattern</replaceable>
2861</arg>
2862</group>
2863</cmdsynopsis>
2864
2865<para>
2866For <emphasis>object</emphasis>, see the <command>color</command>
2867command. <emphasis>attribute</emphasis> can be one of the following:
2868</para>
2869
2870<itemizedlist>
2871<listitem><para>none</para></listitem>
2872<listitem><para>bold</para></listitem>
2873<listitem><para>underline</para></listitem>
2874<listitem><para>reverse</para></listitem>
2875<listitem><para>standout</para></listitem>
2876</itemizedlist>
2877
2878</sect1>
2879
2880<sect1 id="msg-hdr-display">
2881<title>Message Header Display</title>
2882
2883<sect2 id="hdr-folding">
2884<title>Header Display</title>
2885
2886<para>
2887When displaying a message in the pager, Mutt folds long header lines at
2888<link linkend="wrap">$wrap</link> columns. Though there're precise rules
2889about where to break and how, Mutt always folds headers using a tab for
2890readability. (Note that the sending side is not affected by this, Mutt
2891tries to implement standards compliant folding.)
2892</para>
2893
2894</sect2>
2895
2896<sect2 id="ignore">
2897<title>Selecting Headers</title>
2898
2899<para>Usage:</para>
2900
2901<cmdsynopsis>
2902<command>ignore</command>
2903<arg choice="plain">
2904<replaceable class="parameter">pattern</replaceable>
2905</arg>
2906<arg choice="opt" rep="repeat">
2907<replaceable class="parameter">pattern</replaceable>
2908</arg>
2909
2910<command>unignore</command>
2911<group choice="req">
2912<arg choice="plain">
2913<replaceable>*</replaceable>
2914</arg>
2915<arg choice="plain" rep="repeat">
2916<replaceable>pattern</replaceable>
2917</arg>
2918</group>
2919</cmdsynopsis>
2920
2921<para>
2922Messages often have many header fields added by automatic processing
2923systems, or which may not seem useful to display on the screen. This
2924command allows you to specify header fields which you don't normally
2925want to see in the pager.
2926</para>
2927
2928<para>
2929You do not need to specify the full header field name. For example,
2930<quote>ignore content-</quote> will ignore all header fields that begin
2931with the pattern <quote>content-</quote>. <quote>ignore *</quote> will
2932ignore all headers.
2933</para>
2934
2935<para>
2936To remove a previously added token from the list, use the
2937<quote>unignore</quote> command. The <quote>unignore</quote> command
2938will make Mutt display headers with the given pattern. For example, if
2939you do <quote>ignore x-</quote> it is possible to <quote>unignore
2940x-mailer</quote>.
2941</para>
2942
2943<para>
2944<quote>unignore *</quote> will remove all tokens from the ignore list.
2945</para>
2946
2947<example id="ex-header-weeding">
2948<title>Header weeding</title>
2949<screen>
2950<emphasis role="comment"># Sven's draconian header weeding</emphasis>
2951ignore *
2952unignore from date subject to cc
2953unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
2954unignore posted-to:
2955</screen>
2956</example>
2957
2958</sect2>
2959
2960<sect2 id="hdr-order">
2961<title>Ordering Displayed Headers</title>
2962
2963<para>Usage:</para>
2964
2965<cmdsynopsis>
2966<command>hdr_order</command>
2967<arg choice="plain">
2968<replaceable class="parameter">header</replaceable>
2969</arg>
2970<arg choice="opt" rep="repeat">
2971<replaceable class="parameter">header</replaceable>
2972</arg>
2973
2974<command>unhdr_order</command>
2975<group choice="req">
2976<arg choice="plain">
2977<replaceable>*</replaceable>
2978</arg>
2979<arg choice="plain" rep="repeat">
2980<replaceable>header</replaceable>
2981</arg>
2982</group>
2983</cmdsynopsis>
2984
2985<para>
2986With the <command>hdr_order</command> command you can specify an order
2987in which Mutt will attempt to present these headers to you when viewing
2988messages.
2989</para>
2990
2991<para>
2992<quote><command>unhdr_order</command> *</quote> will clear all previous
2993headers from the order list, thus removing the header order effects set
2994by the system-wide startup file.
2995</para>
2996
2997<example id="ex-hdr-order">
2998<title>Configuring header display order</title>
2999<screen>
3000hdr_order From Date: From: To: Cc: Subject:
3001</screen>
3002</example>
3003
3004</sect2>
3005</sect1>
3006
3007<sect1 id="alternates">
3008<title>Alternative Addresses</title>
3009
3010<para>Usage:</para>
3011
3012<cmdsynopsis>
3013<command>alternates</command>
3014<arg choice="opt" rep="repeat">
3015<option>-group</option>
3016<replaceable>name</replaceable>
3017</arg>
3018<arg choice="plain">
3019<replaceable>regexp</replaceable>
3020</arg>
3021<arg choice="opt" rep="repeat">
3022<replaceable>regexp</replaceable>
3023</arg>
3024
3025<command>unalternates</command>
3026<arg choice="opt" rep="repeat">
3027<option>-group</option>
3028<replaceable>name</replaceable>
3029</arg>
3030<group choice="req">
3031<arg choice="plain">
3032<replaceable>*</replaceable>
3033</arg>
3034<arg choice="plain" rep="repeat">
3035<replaceable>regexp</replaceable>
3036</arg>
3037</group>
3038</cmdsynopsis>
3039
3040<para>
3041With various functions, Mutt will treat messages differently, depending
3042on whether you sent them or whether you received them from someone else.
3043For instance, when replying to a message that you sent to a different
3044party, Mutt will automatically suggest to send the response to the
3045original message's recipients — responding to yourself won't make
3046much sense in many cases. (See <link
3047linkend="reply-to">$reply_to</link>.)
3048</para>
3049
3050<para>
3051Many users receive e-mail under a number of different addresses. To
3052fully use Mutt's features here, the program must be able to recognize
3053what e-mail addresses you receive mail under. That's the purpose of the
3054<command>alternates</command> command: It takes a list of regular
3055expressions, each of which can identify an address under which you
3056receive e-mail.
3057</para>
3058
3059<para>
3060As addresses are matched using regular expressions and not exact strict
3061comparisons, you should make sure you specify your addresses as precise
3062as possible to avoid mismatches. For example, if you specify:
3063</para>
3064
3065<screen>
3066alternates user@example
3067</screen>
3068
3069<para>
3070Mutt will consider <quote><literal>some-user@example</literal></quote>
3071as being your address, too which may not be desired. As a solution, in
3072such cases addresses should be specified as:
3073</para>
3074
3075<screen>
3076alternates '^user@example$'
3077</screen>
3078
3079<para>
3080The <literal>-group</literal> flag causes all of the subsequent regular
3081expressions to be added to the named group.
3082</para>
3083
3084<para>
3085The <command>unalternates</command> command can be used to write
3086exceptions to <command>alternates</command> patterns. If an address
3087matches something in an <command>alternates</command> command, but you
3088nonetheless do not think it is from you, you can list a more precise
3089pattern under an <command>unalternates</command> command.
3090</para>
3091
3092<para>
3093To remove a regular expression from the <command>alternates</command>
3094list, use the <command>unalternates</command> command with exactly the
3095same <emphasis>regexp</emphasis>. Likewise, if the
3096<emphasis>regexp</emphasis> for an <command>alternates</command> command
3097matches an entry on the <command>unalternates</command> list, that
3098<command>unalternates</command> entry will be removed. If the
3099<emphasis>regexp</emphasis> for <command>unalternates</command> is
3100<quote>*</quote>, <emphasis>all entries</emphasis> on
3101<command>alternates</command> will be removed.
3102</para>
3103
3104</sect1>
3105
3106<sect1 id="lists">
3107<title>Mailing Lists</title>
3108
3109<anchor id="subscribe"/>
3110<para>Usage:</para>
3111
3112<cmdsynopsis>
3113<command>lists</command>
3114<arg choice="opt" rep="repeat">
3115<option>-group</option>
3116<replaceable class="parameter">name</replaceable>
3117</arg>
3118<arg choice="plain">
3119<replaceable class="parameter">regexp</replaceable>
3120</arg>
3121<arg choice="opt" rep="repeat">
3122<replaceable class="parameter">regexp</replaceable>
3123</arg>
3124
3125<command>unlists</command>
3126<group choice="req">
3127<arg choice="plain">
3128<replaceable class="parameter">*</replaceable>
3129</arg>
3130<arg choice="plain" rep="repeat">
3131<replaceable class="parameter">regexp</replaceable>
3132</arg>
3133</group>
3134
3135<command>subscribe</command>
3136<arg choice="opt" rep="repeat">
3137<option>-group</option>
3138<replaceable class="parameter">name</replaceable>
3139</arg>
3140<arg choice="plain">
3141<replaceable class="parameter">regexp</replaceable>
3142</arg>
3143<arg choice="opt" rep="repeat">
3144<replaceable class="parameter">regexp</replaceable>
3145</arg>
3146
3147<command>unsubscribe</command>
3148<group choice="req">
3149<arg choice="plain">
3150<replaceable class="parameter">*</replaceable>
3151</arg>
3152<arg choice="plain" rep="repeat">
3153<replaceable class="parameter">regexp</replaceable>
3154</arg>
3155</group>
3156</cmdsynopsis>
3157
3158<para>
3159Mutt has a few nice features for <link linkend="using-lists">handling
3160mailing lists</link>. In order to take advantage of them, you must
3161specify which addresses belong to mailing lists, and which mailing lists
3162you are subscribed to. Mutt also has limited support for auto-detecting
3163mailing lists: it supports parsing <literal>mailto:</literal> links in
3164the common <literal>List-Post:</literal> header which has the same
3165effect as specifying the list address via the <command>lists</command>
3166command (except the group feature). Once you have done this, the <link
3167linkend="list-reply"><literal><list-reply></literal></link>
3168function will work for all known lists. Additionally, when you send a
3169message to a subscribed list, Mutt will add a Mail-Followup-To header to
3170tell other users' mail user agents not to send copies of replies to your
3171personal address.
3172</para>
3173
3174<note>
3175<para>
3176The Mail-Followup-To header is a non-standard extension which is not
3177supported by all mail user agents. Adding it is not bullet-proof
3178against receiving personal CCs of list messages. Also note that the
3179generation of the Mail-Followup-To header is controlled by the <link
3180linkend="followup-to">$followup_to</link> configuration variable since
3181it's common practice on some mailing lists to send Cc upon replies
3182(which is more a group- than a list-reply).
3183</para>
3184</note>
3185
3186<para>
3187More precisely, Mutt maintains lists of patterns for the addresses of
3188known and subscribed mailing lists. Every subscribed mailing list is
3189known. To mark a mailing list as known, use the <command>list</command>
3190command. To mark it as subscribed, use <command>subscribe</command>.
3191</para>
3192
3193<para>
3194You can use regular expressions with both commands. To mark all messages
3195sent to a specific bug report's address on Debian's bug tracking system
3196as list mail, for instance, you could say
3197</para>
3198
3199<screen>
3200subscribe [0-9]+.*@bugs.debian.org</screen>
3201
3202<para>
3203as it's often sufficient to just give a portion of the list's e-mail
3204address.
3205</para>
3206
3207<para>
3208Specify as much of the address as you need to to remove ambiguity. For
3209example, if you've subscribed to the Mutt mailing list, you will receive
3210mail addressed to <literal>mutt-users@mutt.org</literal>. So, to tell
3211Mutt that this is a mailing list, you could add <literal>lists
3212mutt-users@</literal> to your initialization file. To tell Mutt that
3213you are subscribed to it, add <literal><command>subscribe</command>
3214mutt-users</literal> to your initialization file instead. If you also
3215happen to get mail from someone whose address is
3216<literal>mutt-users@example.com</literal>, you could use
3217<literal><command>lists</command> ^mutt-users@mutt\\.org$</literal> or
3218<literal><command>subscribe</command> ^mutt-users@mutt\\.org$</literal>
3219to match only mail from the actual list.
3220</para>
3221
3222<para>
3223The <literal>-group</literal> flag adds all of the subsequent regular
3224expressions to the named <link linkend="addrgroup">address group</link>
3225in addition to adding to the specified address list.
3226</para>
3227
3228<para>
3229The <quote>unlists</quote> command is used to remove a token from the
3230list of known and subscribed mailing-lists. Use <quote>unlists *</quote>
3231to remove all tokens.
3232</para>
3233
3234<para>
3235To remove a mailing list from the list of subscribed mailing lists, but
3236keep it on the list of known mailing lists, use
3237<command>unsubscribe</command>.
3238</para>
3239
3240</sect1>
3241
3242<sect1 id="mbox-hook">
3243<title>Using Multiple Spool Mailboxes</title>
3244
3245<para>Usage:</para>
3246
3247<cmdsynopsis>
3248<command>mbox-hook</command>
3249<arg choice="plain">
3250<replaceable class="parameter">[!]regexp</replaceable>
3251</arg>
3252<arg choice="plain">
3253<replaceable class="parameter">mailbox</replaceable>
3254</arg>
3255</cmdsynopsis>
3256
3257<para>
3258This command is used to move read messages from a specified mailbox to a
3259different mailbox automatically when you quit or change folders.
3260<emphasis>regexp</emphasis> is a regular expression specifying the
3261mailbox to treat as a <quote>spool</quote> mailbox and
3262<emphasis>mailbox</emphasis> specifies where mail should be saved when
3263read.
3264</para>
3265
3266<para>
3267The regexp parameter has <link linkend="shortcuts">mailbox
3268shortcut</link> expansion performed on the first character.
3269See <xref linkend="mailbox-hook"/> for more details.
3270</para>
3271
3272<para>
3273Unlike some of the other <emphasis>hook</emphasis> commands, only the
3274<emphasis>first</emphasis> matching regexp is used (it is not possible
3275to save read mail in more than a single mailbox).
3276</para>
3277
3278</sect1>
3279
3280<sect1 id="mailboxes">
3281<title>Monitoring Incoming Mail</title>
3282
3283<para>Usage:</para>
3284
3285<cmdsynopsis>
3286<command>mailboxes</command>
3287<arg choice="plain">
3288<replaceable class="parameter">mailbox</replaceable>
3289</arg>
3290<arg choice="opt" rep="repeat">
3291<replaceable class="parameter">mailbox</replaceable>
3292</arg>
3293
3294<command>unmailboxes</command>
3295<group choice="req">
3296<arg choice="plain">
3297<replaceable class="parameter">*</replaceable>
3298</arg>
3299<arg choice="plain" rep="repeat">
3300<replaceable class="parameter">mailbox</replaceable>
3301</arg>
3302</group>
3303</cmdsynopsis>
3304
3305<para>
3306This command specifies folders which can receive mail and which will be
3307checked for new messages periodically.
3308</para>
3309
3310<para>
3311<emphasis>folder</emphasis> can either be a local file or directory
3312(Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP
3313support, <emphasis>folder</emphasis> can also be a POP/IMAP folder
3314URL. The URL syntax is described in <xref linkend="url-syntax"/>, POP
3315and IMAP are described in <xref linkend="pop"/> and <xref
3316linkend="imap"/> respectively.
3317</para>
3318
3319<para>
3320Mutt provides a number of advanced features for handling (possibly many)
3321folders and new mail within them, please refer to <xref
3322linkend="new-mail"/> for details (including in what situations and how
3323often Mutt checks for new mail).
3324</para>
3325
3326<para>
3327The <quote>unmailboxes</quote> command is used to remove a token from
3328the list of folders which receive mail. Use <quote>unmailboxes *</quote>
3329to remove all tokens.
3330</para>
3331
3332<note>
3333<para>
3334The folders in the <command>mailboxes</command> command are resolved
3335when the command is executed, so if these names contain <link
3336linkend="shortcuts">shortcut characters</link> (such as <quote>=</quote>
3337and <quote>!</quote>), any variable definition that affects these
3338characters (like <link linkend="folder">$folder</link> and <link
3339linkend="spoolfile">$spoolfile</link>) should be set before the
3340<command>mailboxes</command> command. If none of these shortcuts are
3341used, a local path should be absolute as otherwise Mutt tries to find it
3342relative to the directory from where Mutt was started which may not
3343always be desired.
3344</para>
3345</note>
3346
3347</sect1>
3348
3349<sect1 id="my-hdr">
3350<title>User-Defined Headers</title>
3351
3352<para>Usage:</para>
3353
3354<cmdsynopsis>
3355<command>my_hdr</command>
3356<arg choice="plain">
3357<replaceable class="parameter">string</replaceable>
3358</arg>
3359
3360<command>unmy_hdr</command>
3361<group choice="req">
3362<arg choice="plain">
3363<replaceable class="parameter">*</replaceable>
3364</arg>
3365<arg choice="plain" rep="repeat">
3366<replaceable class="parameter">field</replaceable>
3367</arg>
3368</group>
3369</cmdsynopsis>
3370
3371<para>
3372The <command>my_hdr</command> command allows you to create your own
3373header fields which will be added to every message you send and appear
3374in the editor if <link linkend="edit-headers">$edit_headers</link> is
3375set.
3376</para>
3377
3378<para>
3379For example, if you would like to add an <quote>Organization:</quote>
3380header field to all of your outgoing messages, you can put the command
3381something like shown in <xref linkend="ex-my-hdr"/> in your
3382<literal>.muttrc</literal>.
3383</para>
3384
3385<example id="ex-my-hdr">
3386<title>Defining custom headers</title>
3387<screen>
3388my_hdr Organization: A Really Big Company, Anytown, USA
3389</screen>
3390</example>
3391
3392<note>
3393<para>
3394Space characters are <emphasis>not</emphasis> allowed between the
3395keyword and the colon (<quote>:</quote>). The standard for electronic
3396mail (RFC2822) says that space is illegal there, so Mutt enforces the
3397rule.
3398</para>
3399</note>
3400
3401<para>
3402If you would like to add a header field to a single message, you should
3403either set the <link linkend="edit-headers">$edit_headers</link>
3404variable, or use the <literal><edit-headers></literal> function
3405(default: <quote>E</quote>) in the compose menu so that you can edit the
3406header of your message along with the body.
3407</para>
3408
3409<para>
3410To remove user defined header fields, use the
3411<command>unmy_hdr</command> command. You may specify an asterisk
3412(<quote>*</quote>) to remove all header fields, or the fields to
3413remove. For example, to remove all <quote>To</quote> and
3414<quote>Cc</quote> header fields, you could use:
3415</para>
3416
3417<screen>
3418unmy_hdr to cc
3419</screen>
3420
3421</sect1>
3422
3423<sect1 id="save-hook">
3424<title>Specify Default Save Mailbox</title>
3425
3426<para>Usage:</para>
3427
3428<cmdsynopsis>
3429<command>save-hook</command>
3430<arg choice="plain">
3431<replaceable class="parameter">[!]pattern</replaceable>
3432</arg>
3433<arg choice="plain">
3434<replaceable class="parameter">mailbox</replaceable>
3435</arg>
3436</cmdsynopsis>
3437
3438<para>
3439This command is used to override the default mailbox used when saving
3440messages. <emphasis>mailbox</emphasis> will be used as the default if
3441the message matches <emphasis>pattern</emphasis>, see <xref
3442linkend="pattern-hook"/> for information on the exact format.
3443</para>
3444
3445<para>
3446To provide more flexibility and good defaults, Mutt applies the expandos
3447of <link linkend="index-format">$index_format</link> to
3448<emphasis>mailbox</emphasis> after it was expanded.
3449</para>
3450
3451<example id="ex-save-hook-exando">
3452<title>Using %-expandos in <command>save-hook</command></title>
3453<screen>
3454<emphasis role="comment"># default: save all to ~/Mail/<author name></emphasis>
3455save-hook . ~/Mail/%F
3456
3457<emphasis role="comment"># save from me@turing.cs.hmc.edu and me@cs.hmc.edu to $folder/elkins</emphasis>
3458save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
3459
3460<emphasis role="comment"># save from aol.com to $folder/spam</emphasis>
3461save-hook aol\\.com$ +spam
3462</screen>
3463</example>
3464
3465<para>
3466Also see the <link
3467linkend="fcc-save-hook"><command>fcc-save-hook</command></link> command.
3468</para>
3469
3470</sect1>
3471
3472<sect1 id="fcc-hook">
3473<title>Specify Default Fcc: Mailbox When Composing</title>
3474
3475<para>Usage:</para>
3476
3477<cmdsynopsis>
3478<command>fcc-hook</command>
3479<arg choice="plain">
3480<replaceable class="parameter">[!]pattern</replaceable>
3481</arg>
3482<arg choice="plain">
3483<replaceable class="parameter">mailbox</replaceable>
3484</arg>
3485</cmdsynopsis>
3486
3487<para>
3488This command is used to save outgoing mail in a mailbox other than <link
3489linkend="record">$record</link>. Mutt searches the initial list of
3490message recipients for the first matching <emphasis>pattern</emphasis>
3491and uses <emphasis>mailbox</emphasis> as the default Fcc: mailbox. If
3492no match is found the message will be saved to <link
3493linkend="record">$record</link> mailbox.
3494</para>
3495
3496<para>
3497To provide more flexibility and good defaults, Mutt applies the
3498expandos of <link linkend="index-format">$index_format</link> to
3499<emphasis>mailbox</emphasis> after it was expanded.
3500</para>
3501
3502<para>
3503See <xref linkend="pattern-hook"/> for information on the exact format
3504of <emphasis>pattern</emphasis>.
3505</para>
3506
3507<screen>fcc-hook [@.]aol\\.com$ +spammers</screen>
3508
3509<para>
3510...will save a copy of all messages going to the aol.com domain to the
3511`+spammers' mailbox by default. Also see the <link
3512linkend="fcc-save-hook"><command>fcc-save-hook</command></link> command.
3513</para>
3514
3515</sect1>
3516
3517<sect1 id="fcc-save-hook">
3518<title>Specify Default Save Filename and Default Fcc: Mailbox at Once</title>
3519
3520<para>Usage:</para>
3521
3522<cmdsynopsis>
3523<command>fcc-save-hook</command>
3524<arg choice="plain">
3525<replaceable class="parameter">[!]pattern</replaceable>
3526</arg>
3527<arg choice="plain">
3528<replaceable class="parameter">mailbox</replaceable>
3529</arg>
3530</cmdsynopsis>
3531
3532<para>
3533This command is a shortcut, equivalent to doing both a <link
3534linkend="fcc-hook"><command>fcc-hook</command></link> and a <link
3535linkend="save-hook"><command>save-hook</command></link> with its
3536arguments, including %-expansion on <emphasis>mailbox</emphasis>
3537according to <link linkend="index-format">$index_format</link>.
3538</para>
3539
3540</sect1>
3541
3542<sect1 id="send-hook">
3543<title>Change Settings Based Upon Message Recipients</title>
3544
3545<anchor id="reply-hook"/>
3546<anchor id="send2-hook"/>
3547
3548<para>Usage:</para>
3549
3550<cmdsynopsis>
3551<command>reply-hook</command>
3552<arg choice="plain">
3553<replaceable class="parameter">[!]pattern</replaceable>
3554</arg>
3555<arg choice="plain">
3556<replaceable class="parameter">command</replaceable>
3557</arg>
3558
3559<command>send-hook</command>
3560<arg choice="plain">
3561<replaceable class="parameter">[!]pattern</replaceable>
3562</arg>
3563<arg choice="plain">
3564<replaceable class="parameter">command</replaceable>
3565</arg>
3566
3567<command>send2-hook</command>
3568<arg choice="plain">
3569<replaceable class="parameter">[!]pattern</replaceable>
3570</arg>
3571<arg choice="plain">
3572<replaceable class="parameter">command</replaceable>
3573</arg>
3574</cmdsynopsis>
3575
3576<para>
3577These commands can be used to execute arbitrary configuration commands
3578based upon recipients of the message. <emphasis>pattern</emphasis> is
3579used to match the message, see <xref linkend="pattern-hook"/> for
3580details. <emphasis>command</emphasis> is executed when
3581<emphasis>pattern</emphasis> matches.
3582</para>
3583
3584<para>
3585<command>reply-hook</command> is matched against the message you are
3586<emphasis>replying to</emphasis>, instead of the message you are
3587<emphasis>sending</emphasis>. <command>send-hook</command> is matched
3588against all messages, both <emphasis>new</emphasis> and
3589<emphasis>replies</emphasis>.
3590</para>
3591
3592<note>
3593<para>
3594<command>reply-hook</command>s are matched <emphasis>before</emphasis> the
3595<command>send-hook</command>, <emphasis>regardless</emphasis> of the order
3596specified in the user's configuration file. However, you can inhibit
3597<command>send-hook</command> in the reply case by using the pattern
3598<literal>'! ~Q'</literal> (<emphasis>not replied</emphasis>, see
3599<xref linkend="pattern-hook"/>) in the <command>send-hook</command> to tell
3600when <command>reply-hook</command> have been executed.
3601</para>
3602</note>
3603
3604<para>
3605<command>send2-hook</command> is matched every time a message is
3606changed, either by editing it, or by using the compose menu to change
3607its recipients or subject. <command>send2-hook</command> is executed
3608after <command>send-hook</command>, and can, e.g., be used to set
3609parameters such as the <link linkend="sendmail">$sendmail</link>
3610variable depending on the message's sender address.
3611</para>
3612
3613<para>
3614For each type of <command>send-hook</command> or
3615<command>reply-hook</command>, when multiple matches occur, commands are
3616executed in the order they are specified in the
3617<literal>.muttrc</literal> (for that type of hook).
3618</para>
3619
3620<para>
3621Example: <literal><command>send-hook</command> mutt
3622"<command>set</command> mime_forward signature=''"</literal>
3623</para>
3624
3625<para>
3626Another typical use for this command is to change the values of the
3627<link linkend="attribution">$attribution</link>, <link
3628linkend="attribution-locale">$attribution_locale</link>, and <link
3629linkend="signature">$signature</link> variables in order to change the
3630language of the attributions and signatures based upon the recipients.
3631</para>
3632
3633<note>
3634<para>
3635<command>send-hook</command>'s are only executed once after getting the
3636initial list of recipients. Adding a recipient after replying or
3637editing the message will not cause any <command>send-hook</command> to
3638be executed, similarly if <link linkend="autoedit">$autoedit</link> is
3639set (as then the initial list of recipients is empty). Also note that
3640<link linkend="my-hdr"><command>my_hdr</command></link> commands which
3641modify recipient headers, or the message's subject, don't have any
3642effect on the current message when executed from a
3643<command>send-hook</command>.
3644</para>
3645</note>
3646
3647</sect1>
3648
3649<sect1 id="message-hook">
3650<title>Change Settings Before Formatting a Message</title>
3651
3652<para>Usage:</para>
3653
3654<cmdsynopsis>
3655<command>message-hook</command>
3656<arg choice="plain">
3657<replaceable class="parameter">[!]pattern</replaceable>
3658</arg>
3659<arg choice="plain">
3660<replaceable class="parameter">command</replaceable>
3661</arg>
3662</cmdsynopsis>
3663
3664<para>
3665This command can be used to execute arbitrary configuration commands
3666before viewing or formatting a message based upon information about the
3667message. <emphasis>command</emphasis> is executed if the
3668<emphasis>pattern</emphasis> matches the message to be displayed. When
3669multiple matches occur, commands are executed in the order they are
3670specified in the <literal>.muttrc</literal>.
3671</para>
3672
3673<para>
3674See <xref linkend="pattern-hook"/> for information on the exact format
3675of <emphasis>pattern</emphasis>.
3676</para>
3677
3678<para>
3679Example:
3680</para>
3681
3682<screen>
3683message-hook ~A 'set pager=builtin'
3684message-hook '~f freshmeat-news' 'set pager="less \"+/^ subject: .*\""'
3685</screen>
3686
3687</sect1>
3688
3689<sect1 id="crypt-hook">
3690<title>Choosing the Cryptographic Key of the Recipient</title>
3691
3692<para>Usage:</para>
3693
3694<cmdsynopsis>
3695<command>crypt-hook</command>
3696<arg choice="plain">
3697<replaceable class="parameter">regexp</replaceable>
3698</arg>
3699<arg choice="plain">
3700<replaceable class="parameter">keyid</replaceable>
3701</arg>
3702</cmdsynopsis>
3703
3704<para>
3705When encrypting messages with PGP/GnuPG or OpenSSL, you may want to
3706associate a certain key with a given e-mail address automatically,
3707either because the recipient's public key can't be deduced from the
3708destination address, or because, for some reasons, you need to override
3709the key Mutt would normally use. The <command>crypt-hook</command>
3710command provides a method by which you can specify the ID of the public
3711key to be used when encrypting messages to a certain recipient.
3712You may use multiple crypt-hooks with the same regexp; multiple
3713matching crypt-hooks result in the use of multiple keyids for
3714a recipient. During key selection, Mutt will confirm whether each
3715crypt-hook is to be used (unless the <link
3716linkend="crypt-confirmhook">$crypt_confirmhook</link> option is unset).
3717If all crypt-hooks for a recipient are declined, Mutt will use the
3718original recipient address for key selection instead.
3719</para>
3720
3721<para>
3722The meaning of <emphasis>keyid</emphasis> is to be taken broadly in this
3723context: You can either put a numerical key ID or fingerprint here, an
3724e-mail address, or even just a real name.
3725</para>
3726
3727</sect1>
3728
3729<sect1 id="push">
3730<title>Adding Key Sequences to the Keyboard Buffer</title>
3731
3732<para>Usage:</para>
3733
3734<cmdsynopsis>
3735<command>push</command>
3736<arg choice="plain">
3737<replaceable class="parameter">string</replaceable>
3738</arg>
3739</cmdsynopsis>
3740
3741<para>
3742This command adds the named string to the beginning of the keyboard buffer. The string
3743may contain control characters, key names and function names like the
3744sequence string in the <link linkend="macro">macro</link> command. You
3745may use it to automatically run a sequence of commands at startup, or
3746when entering certain folders. For example, <xref
3747linkend="ex-folder-hook-push"/> shows how to automatically collapse all
3748threads when entering a folder.
3749</para>
3750
3751<example id="ex-folder-hook-push">
3752<title>Embedding <command>push</command> in <command>folder-hook</command></title>
3753<screen>
3754folder-hook . 'push <collapse-all>'
3755</screen>
3756</example>
3757
3758<para>
3759For using functions like shown in the example, it's important to use
3760angle brackets (<quote><</quote> and <quote>></quote>) to make
3761Mutt recognize the input as a function name. Otherwise it will simulate
3762individual just keystrokes, i.e. <quote><literal>push
3763collapse-all</literal></quote> would be interpreted as if you had typed
3764<quote>c</quote>, followed by <quote>o</quote>, followed by
3765<quote>l</quote>, ..., which is not desired and may lead to very
3766unexpected behavior.
3767</para>
3768
3769<para>
3770Keystrokes can be used, too, but are less portable because of
3771potentially changed key bindings. With default bindings, this is
3772equivalent to the above example:
3773</para>
3774
3775<screen>
3776folder-hook . 'push \eV'
3777</screen>
3778
3779<para>
3780because it simulates that Esc+V was pressed (which is the default
3781binding of <literal><collapse-all></literal>).
3782</para>
3783
3784</sect1>
3785
3786<sect1 id="exec">
3787<title>Executing Functions</title>
3788
3789<para>Usage:</para>
3790
3791<cmdsynopsis>
3792<command>exec</command>
3793<arg choice="plain">
3794<replaceable class="parameter">function</replaceable>
3795</arg>
3796<arg choice="opt" rep="repeat">
3797<replaceable class="parameter">function</replaceable>
3798</arg>
3799</cmdsynopsis>
3800
3801<para>
3802This command can be used to execute any function. Functions are listed
3803in the <link linkend="functions">function reference</link>.
3804<quote><command>exec</command> <literal>function</literal></quote> is
3805equivalent to <quote><literal>push <function></literal></quote>.
3806</para>
3807
3808</sect1>
3809
3810<sect1 id="score-command">
3811<title>Message Scoring</title>
3812
3813<para>Usage:</para>
3814
3815<cmdsynopsis>
3816<command>score</command>
3817<arg choice="plain">
3818<replaceable class="parameter">pattern</replaceable>
3819</arg>
3820<arg choice="plain">
3821<replaceable class="parameter">value</replaceable>
3822</arg>
3823
3824<command>unscore</command>
3825<group choice="req">
3826<arg choice="plain">
3827<replaceable class="parameter">*</replaceable>
3828</arg>
3829<arg choice="plain" rep="repeat">
3830<replaceable class="parameter">pattern</replaceable>
3831</arg>
3832</group>
3833</cmdsynopsis>
3834
3835<para>
3836The <command>score</command> commands adds <emphasis>value</emphasis> to
3837a message's score if <emphasis>pattern</emphasis> matches it.
3838<emphasis>pattern</emphasis> is a string in the format described in the
3839<link linkend="patterns">patterns</link> section (note: For efficiency
3840reasons, patterns which scan information not available in the index,
3841such as <literal>~b</literal>, <literal>~B</literal>, <literal>~h</literal>,
3842or <literal>~X</literal> may not be used). <emphasis>value</emphasis> is
3843a positive or negative integer. A message's final score is the sum
3844total of all matching <command>score</command> entries. However, you
3845may optionally prefix <emphasis>value</emphasis> with an equal sign
3846(<quote>=</quote>) to cause evaluation to stop at a particular entry if
3847there is a match. Negative final scores are rounded up to 0.
3848</para>
3849
3850<para>
3851The <command>unscore</command> command removes score entries from the
3852list. You <emphasis>must</emphasis> specify the same pattern specified
3853in the <command>score</command> command for it to be removed. The
3854pattern <quote>*</quote> is a special token which means to clear the
3855list of all score entries.
3856</para>
3857
3858</sect1>
3859
3860<sect1 id="spam">
3861<title>Spam Detection</title>
3862
3863<para>Usage:</para>
3864
3865<cmdsynopsis>
3866<command>spam</command>
3867<arg choice="plain">
3868<replaceable class="parameter">pattern</replaceable>
3869</arg>
3870<arg choice="plain">
3871<replaceable class="parameter">format</replaceable>
3872</arg>
3873
3874<command>nospam</command>
3875<group choice="req">
3876<arg choice="plain">
3877<replaceable class="parameter">*</replaceable>
3878</arg>
3879<arg choice="plain">
3880<replaceable class="parameter">pattern</replaceable>
3881</arg>
3882</group>
3883</cmdsynopsis>
3884
3885<para>
3886Mutt has generalized support for external spam-scoring filters. By
3887defining your spam patterns with the <command>spam</command> and
3888<literal>nospam</literal> commands, you can <emphasis>limit</emphasis>,
3889<emphasis>search</emphasis>, and <emphasis>sort</emphasis> your mail
3890based on its spam attributes, as determined by the external filter. You
3891also can display the spam attributes in your index display using the
3892<literal>%H</literal> selector in the <link
3893linkend="index-format">$index_format</link> variable. (Tip: try
3894<literal>%?H?[%H] ?</literal> to display spam tags only when they are
3895defined for a given message.)
3896</para>
3897
3898<para>
3899Your first step is to define your external filter's spam patterns using
3900the <command>spam</command> command. <emphasis>pattern</emphasis> should
3901be a regular expression that matches a header in a mail message. If any
3902message in the mailbox matches this regular expression, it will receive
3903a <quote>spam tag</quote> or <quote>spam attribute</quote> (unless it
3904also matches a <command>nospam</command> pattern — see below.) The
3905appearance of this attribute is entirely up to you, and is governed by
3906the <emphasis>format</emphasis> parameter. <emphasis>format</emphasis>
3907can be any static text, but it also can include back-references from the
3908<emphasis>pattern</emphasis> expression. (A regular expression
3909<quote>back-reference</quote> refers to a sub-expression contained
3910within parentheses.) <literal>%1</literal> is replaced with the first
3911back-reference in the regex, <literal>%2</literal> with the second, etc.
3912</para>
3913
3914<para>
3915To match spam tags, mutt needs the corresponding header information
3916which is always the case for local and POP folders but not for IMAP in
3917the default configuration. Depending on the spam header to be analyzed,
3918<link linkend="imap-headers">$imap_headers</link> may need to be
3919adjusted.
3920</para>
3921
3922<para>
3923If you're using multiple spam filters, a message can have more than one
3924spam-related header. You can define <command>spam</command> patterns for
3925each filter you use. If a message matches two or more of these patterns,
3926and the <link linkend="spam-separator">$spam_separator</link> variable
3927is set to a string, then the message's spam tag will consist of all the
3928<emphasis>format</emphasis> strings joined together, with the value of
3929<link linkend="spam-separator">$spam_separator</link> separating them.
3930</para>
3931
3932<para>
3933For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
3934the configuration might look like in <xref linkend="ex-spam"/>.
3935</para>
3936
3937<example id="ex-spam">
3938<title>Configuring spam detection</title>
3939<screen>
3940spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
3941spam "X-Spam-Status: Yes" "90+/SA"
3942spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
3943set spam_separator=", "
3944</screen>
3945</example>
3946
3947<para>
3948If then a message is received that DCC registered with
3949<quote>many</quote> hits under the <quote>Fuz2</quote> checksum, and
3950that PureMessage registered with a 97% probability of being spam, that
3951message's spam tag would read <literal>90+/DCC-Fuz2,
395297/PM</literal>. (The four characters before <quote>=many</quote> in a
3953DCC report indicate the checksum used — in this case,
3954<quote>Fuz2</quote>.)
3955</para>
3956
3957<para>
3958If the <link linkend="spam-separator">$spam_separator</link> variable is
3959unset, then each spam pattern match supersedes the previous one. Instead
3960of getting joined <emphasis>format</emphasis> strings, you'll get only
3961the last one to match.
3962</para>
3963
3964<para>
3965The spam tag is what will be displayed in the index when you use
3966<literal>%H</literal> in the <link
3967linkend="index-format">$index_format</link> variable. It's also the
3968string that the <literal>~H</literal> pattern-matching expression
3969matches against for <literal><search></literal> and
3970<literal><limit></literal> functions. And it's what sorting by
3971spam attribute will use as a sort key.
3972</para>
3973
3974<para>
3975That's a pretty complicated example, and most people's actual
3976environments will have only one spam filter. The simpler your
3977configuration, the more effective Mutt can be, especially when it comes
3978to sorting.
3979</para>
3980
3981<para>
3982Generally, when you sort by spam tag, Mutt will sort
3983<emphasis>lexically</emphasis> — that is, by ordering strings
3984alphanumerically. However, if a spam tag begins with a number, Mutt will
3985sort numerically first, and lexically only when two numbers are equal in
3986value. (This is like UNIX's <literal>sort -n</literal>.) A message with
3987no spam attributes at all — that is, one that didn't match
3988<emphasis>any</emphasis> of your <command>spam</command> patterns
3989— is sorted at lowest priority. Numbers are sorted next, beginning
3990with 0 and ranging upward. Finally, non-numeric strings are sorted, with
3991<quote>a</quote> taking lower priority than <quote>z</quote>. Clearly,
3992in general, sorting by spam tags is most effective when you can coerce
3993your filter to give you a raw number. But in case you can't, Mutt can
3994still do something useful.
3995</para>
3996
3997<para>
3998The <command>nospam</command> command can be used to write exceptions to
3999<command>spam</command> patterns. If a header pattern matches something
4000in a <command>spam</command> command, but you nonetheless do not want it
4001to receive a spam tag, you can list a more precise pattern under a
4002<command>nospam</command> command.
4003</para>
4004
4005<para>
4006If the <emphasis>pattern</emphasis> given to <command>nospam</command>
4007is exactly the same as the <emphasis>pattern</emphasis> on an existing
4008<command>spam</command> list entry, the effect will be to remove the
4009entry from the spam list, instead of adding an exception. Likewise, if
4010the <emphasis>pattern</emphasis> for a <command>spam</command> command
4011matches an entry on the <command>nospam</command> list, that nospam
4012entry will be removed. If the <emphasis>pattern</emphasis> for
4013<command>nospam</command> is <quote>*</quote>, <emphasis>all entries on
4014both lists</emphasis> will be removed. This might be the default action
4015if you use <command>spam</command> and <command>nospam</command> in
4016conjunction with a <command>folder-hook</command>.
4017</para>
4018
4019<para>
4020You can have as many <command>spam</command> or
4021<command>nospam</command> commands as you like. You can even do your
4022own primitive <command>spam</command> detection within Mutt — for
4023example, if you consider all mail from <literal>MAILER-DAEMON</literal>
4024to be spam, you can use a <command>spam</command> command like this:
4025</para>
4026
4027<screen>
4028spam "^From: .*MAILER-DAEMON" "999"
4029</screen>
4030
4031</sect1>
4032
4033<sect1 id="set">
4034<title>Setting and Querying Variables</title>
4035
4036<sect2 id="var-types">
4037<title>Variable Types</title>
4038
4039<para>
4040Mutt supports these types of configuration variables:
4041</para>
4042
4043<variablelist>
4044<varlistentry>
4045<term>boolean</term>
4046<listitem>
4047<para>
4048A boolean expression, either <quote>yes</quote> or <quote>no</quote>.
4049</para>
4050</listitem>
4051</varlistentry>
4052<varlistentry>
4053<term>number</term>
4054<listitem>
4055<para>
4056A signed integer number in the range -32768 to 32767.
4057</para>
4058</listitem>
4059</varlistentry>
4060<varlistentry>
4061<term>string</term>
4062<listitem>
4063<para>
4064Arbitrary text.
4065</para>
4066</listitem>
4067</varlistentry>
4068<varlistentry>
4069<term>path</term>
4070<listitem>
4071<para>
4072A specialized string for representing paths including support for
4073mailbox shortcuts (see <xref linkend="shortcuts"/>) as well as tilde
4074(<quote>~</quote>) for a user's home directory and more.
4075</para>
4076</listitem>
4077</varlistentry>
4078<varlistentry>
4079<term>quadoption</term>
4080<listitem>
4081<para>
4082Like a boolean but triggers a prompt when set to <quote>ask-yes</quote>
4083or <quote>ask-no</quote> with <quote>yes</quote> and <quote>no</quote>
4084preselected respectively.
4085</para>
4086</listitem>
4087</varlistentry>
4088<varlistentry>
4089<term>sort order</term>
4090<listitem>
4091<para>
4092A specialized string allowing only particular words as values depending
4093on the variable.
4094</para>
4095</listitem>
4096</varlistentry>
4097<varlistentry>
4098<term>regular expression</term>
4099<listitem>
4100<para>
4101A regular expression, see <xref linkend="regexp"/> for an introduction.
4102</para>
4103</listitem>
4104</varlistentry>
4105<varlistentry>
4106<term>folder magic</term>
4107<listitem>
4108<para>
4109Specifies the type of folder to use: <emphasis>mbox</emphasis>,
4110<emphasis>mmdf</emphasis>, <emphasis>mh</emphasis> or
4111<emphasis>maildir</emphasis>. Currently only used to determine the type
4112for newly created folders.
4113</para>
4114</listitem>
4115</varlistentry>
4116<varlistentry>
4117<term>e-mail address</term>
4118<listitem>
4119<para>
4120An e-mail address either with or without realname. The older
4121<quote><literal>user@example.org (Joe User)</literal></quote> form is
4122supported but strongly deprecated.
4123</para>
4124</listitem>
4125</varlistentry>
4126<varlistentry>
4127<term>user-defined</term>
4128<listitem>
4129<para>
4130Arbitrary text, see <xref linkend="set-myvar"/> for details.
4131</para>
4132</listitem>
4133</varlistentry>
4134</variablelist>
4135
4136</sect2>
4137
4138<sect2 id="set-commands">
4139<title>Commands</title>
4140
4141<para>
4142The following commands are available to manipulate and query variables:
4143</para>
4144
4145<para>Usage:</para>
4146
4147<cmdsynopsis>
4148<command>set</command>
4149<group choice="req">
4150<arg choice="plain">
4151<group choice="opt">
4152<arg choice="plain"><option>no</option></arg>
4153<arg choice="plain"><option>inv</option></arg>
4154</group>
4155<replaceable class="parameter">variable</replaceable>
4156</arg>
4157<arg choice="plain">
4158<replaceable class="parameter">variable=value</replaceable>
4159</arg>
4160</group>
4161<arg choice="opt" rep="repeat"></arg>
4162
4163<command>toggle</command>
4164<arg choice="plain">
4165<replaceable class="parameter">variable</replaceable>
4166</arg>
4167<arg choice="opt" rep="repeat">
4168<replaceable class="parameter">variable</replaceable>
4169</arg>
4170
4171<command>unset</command>
4172<arg choice="plain">
4173<replaceable class="parameter">variable</replaceable>
4174</arg>
4175<arg choice="opt" rep="repeat">
4176<replaceable class="parameter">variable</replaceable>
4177</arg>
4178
4179<command>reset</command>
4180<arg choice="plain">
4181<replaceable class="parameter">variable</replaceable>
4182</arg>
4183<arg choice="opt" rep="repeat">
4184<replaceable class="parameter">variable</replaceable>
4185</arg>
4186</cmdsynopsis>
4187
4188<para>
4189This command is used to set (and unset) <link
4190linkend="variables">configuration variables</link>. There are four
4191basic types of variables: boolean, number, string and quadoption.
4192<emphasis>boolean</emphasis> variables can be <emphasis>set</emphasis>
4193(true) or <emphasis>unset</emphasis> (false).
4194<emphasis>number</emphasis> variables can be assigned a positive integer
4195value. <emphasis>string</emphasis> variables consist of any number of
4196printable characters and must be enclosed in quotes if they contain
4197spaces or tabs. You may also use the escape sequences <quote>\n</quote>
4198and <quote>\t</quote> for newline and tab, respectively.
4199<emphasis>quadoption</emphasis> variables are used to control whether or
4200not to be prompted for certain actions, or to specify a default action.
4201A value of <emphasis>yes</emphasis> will cause the action to be carried
4202out automatically as if you had answered yes to the question.
4203Similarly, a value of <emphasis>no</emphasis> will cause the action to
4204be carried out as if you had answered <quote>no.</quote> A value of
4205<emphasis>ask-yes</emphasis> will cause a prompt with a default answer
4206of <quote>yes</quote> and <emphasis>ask-no</emphasis> will provide a
4207default answer of <quote>no.</quote>
4208</para>
4209
4210<para>
4211Prefixing a variable with <quote>no</quote> will unset it. Example:
4212<literal><command>set</command> noaskbcc</literal>.
4213</para>
4214
4215<para>
4216For <emphasis>boolean</emphasis> variables, you may optionally prefix
4217the variable name with <literal>inv</literal> to toggle the value (on or
4218off). This is useful when writing macros. Example:
4219<literal><command>set</command> invsmart_wrap</literal>.
4220</para>
4221
4222<para>
4223The <command>toggle</command> command automatically prepends the
4224<literal>inv</literal> prefix to all specified variables.
4225</para>
4226
4227<para>
4228The <command>unset</command> command automatically prepends the
4229<literal>no</literal> prefix to all specified variables.
4230</para>
4231
4232<para>
4233Using the <literal><enter-command></literal> function in the
4234<emphasis>index</emphasis> menu, you can query the value of a variable
4235by prefixing the name of the variable with a question mark:
4236</para>
4237
4238<screen>
4239set ?allow_8bit
4240</screen>
4241
4242<para>
4243The question mark is actually only required for boolean and quadoption
4244variables.
4245</para>
4246
4247<para>
4248The <command>reset</command> command resets all given variables to the
4249compile time defaults (hopefully mentioned in this manual). If you use
4250the command <command>set</command> and prefix the variable with
4251<quote>&</quote> this has the same behavior as the
4252<command>reset</command> command.
4253</para>
4254
4255<para>
4256With the <command>reset</command> command there exists the special
4257variable <quote>all</quote>, which allows you to reset all variables to
4258their system defaults.
4259</para>
4260
4261</sect2>
4262
4263<sect2 id="set-myvar">
4264<title>User-Defined Variables</title>
4265
4266<sect3 id="set-myvar-intro">
4267<title>Introduction</title>
4268
4269<para>
4270Along with the variables listed in the <link
4271linkend="variables">Configuration variables</link> section, Mutt
4272supports user-defined variables with names starting with
4273<literal>my_</literal> as in, for example, <literal>my_cfgdir</literal>.
4274</para>
4275
4276<para>
4277The <command>set</command> command either creates a custom
4278<literal>my_</literal> variable or changes its value if it does exist
4279already. The <command>unset</command> and <command>reset</command>
4280commands remove the variable entirely.
4281</para>
4282
4283<para>
4284Since user-defined variables are expanded in the same way that
4285environment variables are (except for the <link
4286linkend="shell-escape">shell-escape</link> command and backtick
4287expansion), this feature can be used to make configuration files more
4288readable.
4289</para>
4290
4291</sect3>
4292
4293<sect3 id="set-myvar-examples">
4294<title>Examples</title>
4295
4296<para>
4297The following example defines and uses the variable
4298<literal>my_cfgdir</literal> to abbreviate the calls of the <link
4299linkend="source"><command>source</command></link> command:
4300</para>
4301
4302<example id="ex-myvar1">
4303<title>Using user-defined variables for config file readability</title>
4304<screen>
4305set my_cfgdir = $HOME/mutt/config
4306
4307source $my_cfgdir/hooks
4308source $my_cfgdir/macros
4309<emphasis role="comment"># more source commands...</emphasis>
4310</screen>
4311</example>
4312
4313<para>
4314A custom variable can also be used in macros to backup the current value
4315of another variable. In the following example, the value of the <link
4316linkend="delete">$delete</link> is changed temporarily while its
4317original value is saved as <literal>my_delete</literal>. After the
4318macro has executed all commands, the original value of <link
4319linkend="delete">$delete</link> is restored.
4320</para>
4321
4322<example id="ex-myvar2">
4323<title>Using user-defined variables for backing up other config option values</title>
4324<screen>
4325macro pager ,x '\
4326<enter-command>set my_delete=$delete<enter>\
4327<enter-command>set delete=yes<enter>\
4328...\
4329<enter-command>set delete=$my_delete<enter>'
4330</screen>
4331</example>
4332
4333<para>
4334Since Mutt expands such values already when parsing the configuration
4335file(s), the value of <literal>$my_delete</literal> in the
4336last example would be the value of <link linkend="delete">$delete</link> exactly
4337as it was at that point during parsing the configuration file. If
4338another statement would change the value for <link linkend="delete">$delete</link>
4339later in the same or another file, it would have no effect on
4340<literal>$my_delete</literal>. However, the expansion can
4341be deferred to runtime, as shown in the next example, when escaping the
4342dollar sign.
4343</para>
4344
4345<example id="ex-myvar3">
4346<title>Deferring user-defined variable expansion to runtime</title>
4347<screen>
4348macro pager <PageDown> "\
4349<enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
4350<next-page>\
4351<enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
4352<enter-command> unset my_old_pager_stop<Enter>"
4353</screen>
4354</example>
4355
4356<para>
4357Note that there is a space between
4358<literal><enter-command></literal> and the <command>set</command>
4359configuration command, preventing Mutt from recording the
4360<command>macro</command>'s commands into its history.
4361</para>
4362
4363</sect3>
4364
4365</sect2>
4366
4367<sect2 id="set-conversions">
4368<title>Type Conversions</title>
4369
4370<para>
4371Variables are always assigned string values which Mutt parses into its
4372internal representation according to the type of the variable, for
4373example an integer number for numeric types. For all queries (including
4374$-expansion) the value is converted from its internal type back into
4375string. As a result, any variable can be assigned any value given that
4376its content is valid for the target. This also counts for custom
4377variables which are of type string. In case of parsing errors, Mutt will
4378print error messages. <xref linkend="ex-myvar4"/> demonstrates type
4379conversions.
4380</para>
4381
4382<example id="ex-myvar4">
4383<title>Type conversions using variables</title>
4384<screen>
4385set my_lines = "5" <emphasis role="comment"># value is string "5"</emphasis>
4386set pager_index_lines = $my_lines <emphasis role="comment"># value is integer 5</emphasis>
4387
4388set my_sort = "date-received" <emphasis role="comment"># value is string "date-received"</emphasis>
4389set sort = "last-$my_sort" <emphasis role="comment"># value is sort last-date-received</emphasis>
4390
4391set my_inc = $read_inc <emphasis role="comment"># value is string "10" (default of $read_inc)</emphasis>
4392set my_foo = $my_inc <emphasis role="comment"># value is string "10"</emphasis>
4393</screen>
4394</example>
4395
4396<para>
4397These assignments are all valid. If, however, the value of
4398<literal>$my_lines</literal> would have been
4399<quote>five</quote> (or something else that cannot be parsed into a
4400number), the assignment to
4401<literal>$pager_index_lines</literal> would have
4402produced an error message.
4403</para>
4404
4405<para>
4406Type conversion applies to all configuration commands which take
4407arguments. But please note that every expanded value of a variable is
4408considered just a single token. A working example is:
4409</para>
4410
4411<screen>
4412set my_pattern = "~A"
4413set my_number = "10"
4414
4415<emphasis role="comment"># same as: score ~A +10</emphasis>
4416score $my_pattern +$my_number</screen>
4417
4418<para>
4419What does <emphasis>not</emphasis> work is:
4420</para>
4421
4422<screen>
4423set my_mx = "+mailbox1 +mailbox2"
4424mailboxes $my_mx +mailbox3</screen>
4425
4426<para>
4427because the value of <literal>$my_mx</literal> is interpreted as a
4428single mailbox named <quote>+mailbox1 +mailbox2</quote> and not two
4429distinct mailboxes.
4430</para>
4431
4432</sect2>
4433
4434</sect1>
4435
4436<sect1 id="source">
4437<title>Reading Initialization Commands From Another File</title>
4438
4439<para>Usage:</para>
4440
4441<cmdsynopsis>
4442<command>source</command>
4443<arg choice="plain">
4444<replaceable class="parameter">filename</replaceable>
4445</arg>
4446</cmdsynopsis>
4447
4448<para>
4449This command allows the inclusion of initialization commands from other
4450files. For example, I place all of my aliases in
4451<literal>~/.mail_aliases</literal> so that I can make my
4452<literal>~/.muttrc</literal> readable and keep my aliases private.
4453</para>
4454
4455<para>
4456If the filename begins with a tilde (<quote>~</quote>), it will be
4457expanded to the path of your home directory.
4458</para>
4459
4460<para>
4461If the filename ends with a vertical bar (<quote>|</quote>), then
4462<emphasis>filename</emphasis> is considered to be an executable program
4463from which to read input (e.g. <literal><command>source</command>
4464~/bin/myscript|</literal>).
4465</para>
4466
4467</sect1>
4468
4469<sect1 id="unhook">
4470<title>Removing Hooks</title>
4471
4472<para>Usage:</para>
4473
4474<cmdsynopsis>
4475<command>unhook</command>
4476<group choice="req">
4477<arg choice="plain">
4478<replaceable class="parameter">*</replaceable>
4479</arg>
4480<arg choice="plain">
4481<replaceable class="parameter">hook-type</replaceable>
4482</arg>
4483</group>
4484</cmdsynopsis>
4485
4486<para>
4487This command permits you to flush hooks you have previously defined.
4488You can either remove all hooks by giving the <quote>*</quote> character
4489as an argument, or you can remove all hooks of a specific type by saying
4490something like <literal><command>unhook</command> send-hook</literal>.
4491</para>
4492
4493</sect1>
4494
4495<sect1 id="formatstrings">
4496<title>Format Strings</title>
4497
4498<sect2 id="formatstrings-basics">
4499<title>Basic usage</title>
4500
4501<para>
4502Format strings are a general concept you'll find in several locations
4503through the Mutt configuration, especially in the <link
4504linkend="index-format">$index_format</link>, <link
4505linkend="pager-format">$pager_format</link>, <link
4506linkend="status-format">$status_format</link>, and other related
4507variables. These can be very straightforward, and it's quite possible
4508you already know how to use them.
4509</para>
4510
4511<para>
4512The most basic format string element is a percent symbol followed by
4513another character. For example, <literal>%s</literal> represents a
4514message's Subject: header in the <link
4515linkend="index-format">$index_format</link> variable. The
4516<quote>expandos</quote> available are documented with each format
4517variable, but there are general modifiers available with all formatting
4518expandos, too. Those are our concern here.
4519</para>
4520
4521<para>
4522Some of the modifiers are borrowed right out of C (though you might know
4523them from Perl, Python, shell, or another language). These are the
4524<literal>[-]m.n</literal> modifiers, as in
4525<literal>%-12.12s</literal>. As with such programming languages, these
4526modifiers allow you to specify the minimum and maximum size of the
4527resulting string, as well as its justification. If the <quote>-</quote>
4528sign follows the percent, the string will be left-justified instead of
4529right-justified. If there's a number immediately following that, it's
4530the minimum amount of space the formatted string will occupy — if
4531it's naturally smaller than that, it will be padded out with spaces. If
4532a decimal point and another number follow, that's the maximum space
4533allowable — the string will not be permitted to exceed that width,
4534no matter its natural size. Each of these three elements is optional, so
4535that all these are legal format strings: <literal>%-12s</literal>,
4536<literal>%4c</literal>, <literal>%.15F</literal> and
4537<literal>%-12.15L</literal>.
4538</para>
4539
4540<para>
4541Mutt adds some other modifiers to format strings. If you use an equals
4542symbol (<literal>=</literal>) as a numeric prefix (like the minus
4543above), it will force the string to be centered within its minimum space
4544range. For example, <literal>%=14y</literal> will reserve 14 characters
4545for the %y expansion — that's the X-Label: header, in <link
4546linkend="index-format">$index_format</link>. If the expansion results in
4547a string less than 14 characters, it will be centered in a 14-character
4548space. If the X-Label for a message were <quote>test</quote>, that
4549expansion would look like
4550<quote> test </quote>.
4551</para>
4552
4553<para>
4554There are two very little-known modifiers that affect the way that an
4555expando is replaced. If there is an underline (<quote>_</quote>)
4556character between any format modifiers (as above) and the expando
4557letter, it will expands in all lower case. And if you use a colon
4558(<quote>:</quote>), it will replace all decimal points with underlines.
4559</para>
4560
4561</sect2>
4562
4563<sect2 id="formatstrings-conditionals">
4564<title>Conditionals</title>
4565
4566<para>
4567Depending on the format string variable, some of its sequences can be
4568used to optionally print a string if their value is nonzero. For
4569example, you may only want to see the number of flagged messages if such
4570messages exist, since zero is not particularly meaningful. To optionally
4571print a string based upon one of the above sequences, the following
4572construct is used:
4573</para>
4574
4575<screen>
4576%?<sequence_char>?<optional_string>?</screen>
4577
4578<para>
4579where <emphasis>sequence_char</emphasis> is an expando, and
4580<emphasis>optional_string</emphasis> is the string you would like
4581printed if <emphasis>sequence_char</emphasis> is nonzero.
4582<emphasis>optional_string</emphasis> may contain other sequences as well
4583as normal text, but you may not nest optional strings.
4584</para>
4585
4586<para>
4587Here is an example illustrating how to optionally print the number of
4588new messages in a mailbox in <link
4589linkend="status-format">$status_format</link>:
4590</para>
4591
4592<screen>
4593%?n?%n new messages.?</screen>
4594
4595<para>
4596You can also switch between two strings using the following construct:
4597</para>
4598
4599<screen>
4600%?<sequence_char>?<if_string>&<else_string>?</screen>
4601
4602<para>
4603If the value of <emphasis>sequence_char</emphasis> is non-zero,
4604<emphasis>if_string</emphasis> will be expanded, otherwise
4605<emphasis>else_string</emphasis> will be expanded.
4606</para>
4607
4608</sect2>
4609
4610<sect2 id="formatstrings-filters">
4611<title>Filters</title>
4612
4613<para>
4614Any format string ending in a vertical bar (<quote>|</quote>) will be
4615expanded and piped through the first word in the string, using spaces as
4616separator. The string returned will be used for display. If the
4617returned string ends in %, it will be passed through the formatter a
4618second time. This allows the filter to generate a replacement format
4619string including % expandos.
4620</para>
4621
4622<para>
4623All % expandos in a format string are expanded before the script is
4624called so that:
4625</para>
4626
4627<example id="ex-fmtpipe">
4628<title>Using external filters in format strings</title>
4629<screen>
4630set status_format="script.sh '%r %f (%L)'|"
4631</screen>
4632</example>
4633
4634<para>
4635will make Mutt expand <literal>%r</literal>, <literal>%f</literal> and
4636<literal>%L</literal> before calling the script. The example also shows
4637that arguments can be quoted: the script will receive the expanded
4638string between the single quotes as the only argument.
4639</para>
4640
4641<para>
4642A practical example is the <literal>mutt_xtitle</literal> script
4643installed in the <literal>samples</literal> subdirectory of the Mutt
4644documentation: it can be used as filter for <link
4645linkend="status-format">$status_format</link> to set the current
4646terminal's title, if supported.
4647</para>
4648
4649</sect2>
4650
4651<sect2 id="formatstrings-padding">
4652<title>Padding</title>
4653
4654<para>
4655In most format strings, Mutt supports different types of padding using
4656special %-expandos:
4657</para>
4658
4659<variablelist>
4660<varlistentry>
4661<term><literal>%|X</literal></term>
4662<listitem>
4663<para>
4664When this occurs, Mutt will fill the rest of the line with the character
4665<literal>X</literal>. For example, filling the rest of the line with
4666dashes is done by setting:
4667</para>
4668<screen>
4669set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"</screen>
4670</listitem>
4671</varlistentry>
4672<varlistentry>
4673<term>
4674<literal>%>X</literal>
4675</term>
4676<listitem>
4677<para>
4678Since the previous expando stops at the end of line, there must be a way
4679to fill the gap between two items via the <literal>%>X</literal>
4680expando: it puts as many characters <literal>X</literal> in between two
4681items so that the rest of the line will be right-justified. For example,
4682to not put the version string and hostname the above example on the left
4683but on the right and fill the gap with spaces, one might use (note the
4684space after <literal>%></literal>):
4685</para>
4686<screen>
4687set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"</screen>
4688</listitem>
4689</varlistentry>
4690<varlistentry>
4691<term><literal>%*X</literal>
4692</term>
4693<listitem>
4694<para>
4695Normal right-justification will print everything to the left of the
4696<literal>%></literal>, displaying padding and whatever lies to the
4697right only if there's room. By contrast, <quote>soft-fill</quote> gives
4698priority to the right-hand side, guaranteeing space to display it and
4699showing padding only if there's still room. If necessary, soft-fill will
4700eat text leftwards to make room for rightward text. For example, to
4701right-justify the subject making sure as much as possible of it fits on
4702screen, one might use (note two spaces after <literal>%* </literal>: the
4703second ensures there's a space between the truncated right-hand side and
4704the subject):
4705</para>
4706<screen>
4707set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%* %s"</screen>
4708</listitem>
4709</varlistentry>
4710</variablelist>
4711
4712</sect2>
4713
4714</sect1>
4715
4716<sect1 id="mailto-allow">
4717<title>Control allowed header fields in a mailto: URL</title>
4718
4719<para>Usage:</para>
4720
4721<cmdsynopsis>
4722<command>mailto_allow</command>
4723<group choice="req">
4724<arg choice="plain">
4725<replaceable class="parameter">*</replaceable>
4726</arg>
4727<arg choice="plain" rep="repeat">
4728<replaceable class="parameter">header-field</replaceable>
4729</arg>
4730</group>
4731
4732<command>unmailto_allow</command>
4733<group choice="req">
4734<arg choice="plain">
4735<replaceable class="parameter">*</replaceable>
4736</arg>
4737<arg choice="plain" rep="repeat">
4738<replaceable class="parameter">header-field</replaceable>
4739</arg>
4740</group>
4741</cmdsynopsis>
4742
4743<para>
4744As a security measure, Mutt will only add user-approved header fields from a
4745<literal>mailto:</literal> URL. This is necessary since Mutt will handle
4746certain header fields, such as <literal>Attach:</literal>, in a special way.
4747The <literal>mailto_allow</literal> and <literal>unmailto_allow</literal>
4748commands allow the user to modify the list of approved headers.
4749</para>
4750<para>
4751Mutt initializes the default list to contain only the <literal>Subject</literal>
4752and <literal>Body</literal> header fields, which are the only requirement specified
4753by the <literal>mailto:</literal> specification in RFC2368.
4754</para>
4755</sect1>
4756
4757</chapter>
4758
4759<chapter id="advancedusage">
4760<title>Advanced Usage</title>
4761
4762<sect1 id="charset-handling">
4763<title>Character Set Handling</title>
4764
4765<para>
4766A <quote>character set</quote> is basically a mapping between bytes and
4767glyphs and implies a certain character encoding scheme. For example, for
4768the ISO 8859 family of character sets, an encoding of 8bit per character
4769is used. For the Unicode character set, different character encodings
4770may be used, UTF-8 being the most popular. In UTF-8, a character is
4771represented using a variable number of bytes ranging from 1 to 4.
4772</para>
4773
4774<para>
4775Since Mutt is a command-line tool run from a shell, and delegates
4776certain tasks to external tools (such as an editor for composing/editing
4777messages), all of these tools need to agree on a character set and
4778encoding. There exists no way to reliably deduce the character set a
4779plain text file has. Interoperability is gained by the use of
4780well-defined environment variables. The full set can be printed by
4781issuing <literal>locale</literal> on the command line.
4782</para>
4783
4784<para>
4785Upon startup, Mutt determines the character set on its own using
4786routines that inspect locale-specific environment variables. Therefore,
4787it is generally not necessary to set the <literal>$charset</literal>
4788variable in Mutt. It may even be counter-productive as Mutt uses system
4789and library functions that derive the character set themselves and on
4790which Mutt has no influence. It's safest to let Mutt work out the locale
4791setup itself.
4792</para>
4793
4794<para>
4795If you happen to work with several character sets on a regular basis,
4796it's highly advisable to use Unicode and an UTF-8 locale. Unicode can
4797represent nearly all characters in a message at the same time. When not
4798using a Unicode locale, it may happen that you receive messages with
4799characters not representable in your locale. When displaying such a
4800message, or replying to or forwarding it, information may get lost
4801possibly rendering the message unusable (not only for you but also for
4802the recipient, this breakage is not reversible as lost information
4803cannot be guessed).
4804</para>
4805
4806<para>
4807A Unicode locale makes all conversions superfluous which eliminates the
4808risk of conversion errors. It also eliminates potentially wrong
4809expectations about the character set between Mutt and external programs.
4810</para>
4811
4812<para>
4813The terminal emulator used also must be properly configured for the
4814current locale. Terminal emulators usually do <emphasis>not</emphasis>
4815derive the locale from environment variables, they need to be configured
4816separately. If the terminal is incorrectly configured, Mutt may display
4817random and unexpected characters (question marks, octal codes, or just
4818random glyphs), format strings may not work as expected, you may not be
4819abled to enter non-ascii characters, and possible more. Data is always
4820represented using bytes and so a correct setup is very important as to
4821the machine, all character sets <quote>look</quote> the same.
4822</para>
4823
4824<para>
4825Warning: A mismatch between what system and library functions think the
4826locale is and what Mutt was told what the locale is may make it behave
4827badly with non-ascii input: it will fail at seemingly random places.
4828This warning is to be taken seriously since not only local mail handling
4829may suffer: sent messages may carry wrong character set information the
4830<emphasis>receiver</emphasis> has too deal with. The need to set
4831<literal>$charset</literal> directly in most cases points at terminal
4832and environment variable setup problems, not Mutt problems.
4833</para>
4834
4835<para>
4836A list of officially assigned and known character sets can be found at
4837<ulink url="http://www.iana.org/assignments/character-sets">IANA</ulink>,
4838a list of locally supported locales can be obtained by running
4839<literal>locale -a</literal>.
4840</para>
4841
4842</sect1>
4843
4844<sect1 id="regexp">
4845<title>Regular Expressions</title>
4846
4847<para>
4848All string patterns in Mutt including those in more complex <link
4849linkend="patterns">patterns</link> must be specified using regular
4850expressions (regexp) in the <quote>POSIX extended</quote> syntax (which
4851is more or less the syntax used by egrep and GNU awk). For your
4852convenience, we have included below a brief description of this syntax.
4853</para>
4854
4855<para>
4856The search is case sensitive if the pattern contains at least one upper
4857case letter, and case insensitive otherwise.
4858</para>
4859
4860<note>
4861<para>
4862<quote>\</quote> must be quoted if used for a regular expression in an
4863initialization command: <quote>\\</quote>.
4864</para>
4865</note>
4866
4867<para>
4868A regular expression is a pattern that describes a set of strings.
4869Regular expressions are constructed analogously to arithmetic
4870expressions, by using various operators to combine smaller expressions.
4871</para>
4872
4873<note>
4874<para>
4875The regular expression can be enclosed/delimited by either " or ' which
4876is useful if the regular expression includes a white-space character.
4877See <xref linkend="muttrc-syntax"/> for more information on " and '
4878delimiter processing. To match a literal " or ' you must preface it
4879with \ (backslash).
4880</para>
4881</note>
4882
4883<para>
4884The fundamental building blocks are the regular expressions that match a
4885single character. Most characters, including all letters and digits,
4886are regular expressions that match themselves. Any metacharacter with
4887special meaning may be quoted by preceding it with a backslash.
4888</para>
4889
4890<para>
4891The period <quote>.</quote> matches any single character. The caret
4892<quote>^</quote> and the dollar sign <quote>$</quote> are metacharacters
4893that respectively match the empty string at the beginning and end of a
4894line.
4895</para>
4896
4897<para>
4898A list of characters enclosed by <quote>[</quote> and <quote>]</quote>
4899matches any single character in that list; if the first character of the
4900list is a caret <quote>^</quote> then it matches any character
4901<emphasis>not</emphasis> in the list. For example, the regular
4902expression <emphasis>[0123456789]</emphasis> matches any single digit.
4903A range of ASCII characters may be specified by giving the first and
4904last characters, separated by a hyphen <quote>-</quote>. Most
4905metacharacters lose their special meaning inside lists. To include a
4906literal <quote>]</quote> place it first in the list. Similarly, to
4907include a literal <quote>^</quote> place it anywhere but first.
4908Finally, to include a literal hyphen <quote>-</quote> place it last.
4909</para>
4910
4911<para>
4912Certain named classes of characters are predefined. Character classes
4913consist of <quote>[:</quote>, a keyword denoting the class, and
4914<quote>:]</quote>. The following classes are defined by the POSIX
4915standard in
4916<xref linkend="posix-regex-char-classes"/>
4917</para>
4918
4919<table id="posix-regex-char-classes">
4920<title>POSIX regular expression character classes</title>
4921<tgroup cols="2">
4922<thead>
4923<row><entry>Character class</entry><entry>Description</entry></row>
4924</thead>
4925<tbody>
4926<row><entry>[:alnum:]</entry><entry>Alphanumeric characters</entry></row>
4927<row><entry>[:alpha:]</entry><entry>Alphabetic characters</entry></row>
4928<row><entry>[:blank:]</entry><entry>Space or tab characters</entry></row>
4929<row><entry>[:cntrl:]</entry><entry>Control characters</entry></row>
4930<row><entry>[:digit:]</entry><entry>Numeric characters</entry></row>
4931<row><entry>[:graph:]</entry><entry>Characters that are both printable and visible. (A space is printable, but not visible, while an <quote>a</quote> is both)</entry></row>
4932<row><entry>[:lower:]</entry><entry>Lower-case alphabetic characters</entry></row>
4933<row><entry>[:print:]</entry><entry>Printable characters (characters that are not control characters)</entry></row>
4934<row><entry>[:punct:]</entry><entry>Punctuation characters (characters that are not letter, digits, control characters, or space characters)</entry></row>
4935<row><entry>[:space:]</entry><entry>Space characters (such as space, tab and formfeed, to name a few)</entry></row>
4936<row><entry>[:upper:]</entry><entry>Upper-case alphabetic characters</entry></row>
4937<row><entry>[:xdigit:]</entry><entry>Characters that are hexadecimal digits</entry></row>
4938</tbody>
4939</tgroup>
4940</table>
4941
4942<para>
4943A character class is only valid in a regular expression inside the
4944brackets of a character list.
4945</para>
4946
4947<note>
4948<para>
4949Note that the brackets in these class names are part of the symbolic
4950names, and must be included in addition to the brackets delimiting the
4951bracket list. For example, <emphasis>[[:digit:]]</emphasis> is
4952equivalent to <emphasis>[0-9]</emphasis>.
4953</para>
4954</note>
4955
4956<para>
4957Two additional special sequences can appear in character lists. These
4958apply to non-ASCII character sets, which can have single symbols (called
4959collating elements) that are represented with more than one character,
4960as well as several characters that are equivalent for collating or
4961sorting purposes:
4962</para>
4963
4964<variablelist>
4965
4966<varlistentry>
4967<term>Collating Symbols</term>
4968<listitem>
4969<para>
4970A collating symbol is a multi-character collating element enclosed in
4971<quote>[.</quote> and <quote>.]</quote>. For example, if
4972<quote>ch</quote> is a collating element, then
4973<emphasis>[[.ch.]]</emphasis> is a regexp that matches this collating
4974element, while <emphasis>[ch]</emphasis> is a regexp that matches either
4975<quote>c</quote> or <quote>h</quote>.
4976</para>
4977</listitem>
4978</varlistentry>
4979<varlistentry>
4980<term>Equivalence Classes</term>
4981<listitem>
4982<para>
4983An equivalence class is a locale-specific name for a list of characters
4984that are equivalent. The name is enclosed in <quote>[=</quote> and
4985<quote>=]</quote>. For example, the name <quote>e</quote> might be used
4986to represent all of <quote>e</quote> with grave
4987(<quote>è</quote>), <quote>e</quote> with acute
4988(<quote>é</quote>) and <quote>e</quote>. In this case,
4989<emphasis>[[=e=]]</emphasis> is a regexp that matches any of:
4990<quote>e</quote> with grave (<quote>è</quote>), <quote>e</quote>
4991with acute (<quote>é</quote>) and <quote>e</quote>.
4992</para>
4993</listitem>
4994</varlistentry>
4995</variablelist>
4996
4997<para>
4998A regular expression matching a single character may be followed by one
4999of several repetition operators described in <xref
5000linkend="regex-repeat"/>.
5001</para>
5002
5003<table id="regex-repeat">
5004<title>Regular expression repetition operators</title>
5005<tgroup cols="2">
5006<thead>
5007<row><entry>Operator</entry><entry>Description</entry></row>
5008</thead>
5009<tbody>
5010<row><entry>?</entry><entry>The preceding item is optional and matched at most once</entry></row>
5011<row><entry>*</entry><entry>The preceding item will be matched zero or more times</entry></row>
5012<row><entry>+</entry><entry>The preceding item will be matched one or more times</entry></row>
5013<row><entry>{n}</entry><entry>The preceding item is matched exactly <emphasis>n</emphasis> times</entry></row>
5014<row><entry>{n,}</entry><entry>The preceding item is matched <emphasis>n</emphasis> or more times</entry></row>
5015<row><entry>{,m}</entry><entry>The preceding item is matched at most <emphasis>m</emphasis> times</entry></row>
5016<row><entry>{n,m}</entry><entry>The preceding item is matched at least <emphasis>n</emphasis> times, but no more than <emphasis>m</emphasis> times</entry></row>
5017</tbody>
5018</tgroup>
5019</table>
5020
5021<para>
5022Two regular expressions may be concatenated; the resulting regular
5023expression matches any string formed by concatenating two substrings
5024that respectively match the concatenated subexpressions.
5025</para>
5026
5027<para>
5028Two regular expressions may be joined by the infix operator
5029<quote>|</quote>; the resulting regular expression matches any string
5030matching either subexpression.
5031</para>
5032
5033<para>
5034Repetition takes precedence over concatenation, which in turn takes
5035precedence over alternation. A whole subexpression may be enclosed in
5036parentheses to override these precedence rules.
5037</para>
5038
5039<note>
5040<para>
5041If you compile Mutt with the included regular expression engine, the
5042following operators may also be used in regular expressions as described
5043in <xref linkend="regex-gnu-ext"/>.
5044</para>
5045</note>
5046
5047<table id="regex-gnu-ext">
5048<title>GNU regular expression extensions</title>
5049<tgroup cols="2">
5050<thead>
5051<row><entry>Expression</entry><entry>Description</entry></row>
5052</thead>
5053<tbody>
5054<row><entry>\\y</entry><entry>Matches the empty string at either the beginning or the end of a word</entry></row>
5055<row><entry>\\B</entry><entry>Matches the empty string within a word</entry></row>
5056<row><entry>\\<</entry><entry>Matches the empty string at the beginning of a word</entry></row>
5057<row><entry>\\></entry><entry>Matches the empty string at the end of a word</entry></row>
5058<row><entry>\\w</entry><entry>Matches any word-constituent character (letter, digit, or underscore)</entry></row>
5059<row><entry>\\W</entry><entry>Matches any character that is not word-constituent</entry></row>
5060<row><entry>\\`</entry><entry>Matches the empty string at the beginning of a buffer (string)</entry></row>
5061<row><entry>\\'</entry><entry>Matches the empty string at the end of a buffer</entry></row>
5062</tbody>
5063</tgroup>
5064</table>
5065
5066<para>
5067Please note however that these operators are not defined by POSIX, so
5068they may or may not be available in stock libraries on various systems.
5069</para>
5070
5071</sect1>
5072
5073<sect1 id="patterns">
5074<title>Patterns: Searching, Limiting and Tagging</title>
5075
5076<sect2 id="patterns-modifier">
5077<title>Pattern Modifier</title>
5078
5079<para>
5080Many of Mutt's commands allow you to specify a pattern to match
5081(<literal>limit</literal>, <literal>tag-pattern</literal>,
5082<literal>delete-pattern</literal>, etc.). <xref linkend="tab-patterns"/>
5083shows several ways to select messages.
5084</para>
5085
5086<table id="tab-patterns">
5087<title>Pattern modifiers</title>
5088<tgroup cols="2">
5089<thead>
5090<row><entry>Pattern modifier</entry><entry>Description</entry></row>
5091</thead>
5092<tbody>
5093<row><entry>~A</entry><entry>all messages</entry></row>
5094<row><entry>~b <emphasis>EXPR</emphasis></entry><entry>messages which contain <emphasis>EXPR</emphasis> in the message body</entry></row>
5095<row><entry>=b <emphasis>STRING</emphasis></entry><entry>messages which contain <emphasis>STRING</emphasis> in the message body. If IMAP is enabled, searches for <emphasis>STRING</emphasis> on the server, rather than downloading each message and searching it locally.</entry></row>
5096<row><entry>~B <emphasis>EXPR</emphasis></entry><entry>messages which contain <emphasis>EXPR</emphasis> in the whole message</entry></row>
5097<row><entry>=B <emphasis>STRING</emphasis></entry><entry>messages which contain <emphasis>STRING</emphasis> in the whole message. If IMAP is enabled, searches for <emphasis>STRING</emphasis> on the server, rather than downloading each message and searching it locally.</entry></row>
5098<row><entry>~c <emphasis>EXPR</emphasis></entry><entry>messages carbon-copied to <emphasis>EXPR</emphasis></entry></row>
5099<row><entry>%c <emphasis>GROUP</emphasis></entry><entry>messages carbon-copied to any member of <emphasis>GROUP</emphasis></entry></row>
5100<row><entry>~C <emphasis>EXPR</emphasis></entry><entry>messages either to: or cc: <emphasis>EXPR</emphasis></entry></row>
5101<row><entry>%C <emphasis>GROUP</emphasis></entry><entry>messages either to: or cc: to any member of <emphasis>GROUP</emphasis></entry></row>
5102<row><entry>~d [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with <quote>date-sent</quote> in a Date range</entry></row>
5103<row><entry>~D</entry><entry>deleted messages</entry></row>
5104<row><entry>~e <emphasis>EXPR</emphasis></entry><entry>messages which contains <emphasis>EXPR</emphasis> in the <quote>Sender</quote> field</entry></row>
5105<row><entry>%e <emphasis>GROUP</emphasis></entry><entry>messages which contain a member of <emphasis>GROUP</emphasis> in the <quote>Sender</quote> field</entry></row>
5106<row><entry>~E</entry><entry>expired messages</entry></row>
5107<row><entry>~F</entry><entry>flagged messages</entry></row>
5108<row><entry>~f <emphasis>EXPR</emphasis></entry><entry>messages originating from <emphasis>EXPR</emphasis></entry></row>
5109<row><entry>%f <emphasis>GROUP</emphasis></entry><entry>messages originating from any member of <emphasis>GROUP</emphasis></entry></row>
5110<row><entry>~g</entry><entry>cryptographically signed messages</entry></row>
5111<row><entry>~G</entry><entry>cryptographically encrypted messages</entry></row>
5112<row><entry>~h <emphasis>EXPR</emphasis></entry><entry>messages which contain <emphasis>EXPR</emphasis> in the message header</entry></row>
5113<row><entry>=h <emphasis>STRING</emphasis></entry><entry>messages which contain <emphasis>STRING</emphasis> in the message header. If IMAP is enabled, searches for <emphasis>STRING</emphasis> on the server, rather than downloading each message and searching it locally; <emphasis>STRING</emphasis> must be of the form <quote>header: substring</quote> (see below).</entry></row>
5114<row><entry>~H <emphasis>EXPR</emphasis></entry><entry>messages with a spam attribute matching <emphasis>EXPR</emphasis></entry></row>
5115<row><entry>~i <emphasis>EXPR</emphasis></entry><entry>messages which match <emphasis>EXPR</emphasis> in the <quote>Message-ID</quote> field</entry></row>
5116<row><entry>~k</entry><entry>messages which contain PGP key material</entry></row>
5117<row><entry>~L <emphasis>EXPR</emphasis></entry><entry>messages either originated or received by <emphasis>EXPR</emphasis></entry></row>
5118<row><entry>%L <emphasis>GROUP</emphasis></entry><entry>message either originated or received by any member of <emphasis>GROUP</emphasis></entry></row>
5119<row><entry>~l</entry><entry>messages addressed to a known mailing list</entry></row>
5120<row><entry>~m [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages in the range <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> *)</entry></row>
5121<row><entry>~n [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with a score in the range <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> *)</entry></row>
5122<row><entry>~N</entry><entry>new messages</entry></row>
5123<row><entry>~O</entry><entry>old messages</entry></row>
5124<row><entry>~p</entry><entry>messages addressed to you (consults <command>alternates</command>)</entry></row>
5125<row><entry>~P</entry><entry>messages from you (consults <command>alternates</command>)</entry></row>
5126<row><entry>~Q</entry><entry>messages which have been replied to</entry></row>
5127<row><entry>~r [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with <quote>date-received</quote> in a Date range</entry></row>
5128<row><entry>~R</entry><entry>read messages</entry></row>
5129<row><entry>~s <emphasis>EXPR</emphasis></entry><entry>messages having <emphasis>EXPR</emphasis> in the <quote>Subject</quote> field.</entry></row>
5130<row><entry>~S</entry><entry>superseded messages</entry></row>
5131<row><entry>~t <emphasis>EXPR</emphasis></entry><entry>messages addressed to <emphasis>EXPR</emphasis></entry></row>
5132<row><entry>~T</entry><entry>tagged messages</entry></row>
5133<row><entry>~u</entry><entry>messages addressed to a subscribed mailing list</entry></row>
5134<row><entry>~U</entry><entry>unread messages</entry></row>
5135<row><entry>~v</entry><entry>messages part of a collapsed thread.</entry></row>
5136<row><entry>~V</entry><entry>cryptographically verified messages</entry></row>
5137<row><entry>~x <emphasis>EXPR</emphasis></entry><entry>messages which contain <emphasis>EXPR</emphasis> in the <quote>References</quote> or <quote>In-Reply-To</quote> field</entry></row>
5138<row><entry>~X [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> attachments *)</entry></row>
5139<row><entry>~y <emphasis>EXPR</emphasis></entry><entry>messages which contain <emphasis>EXPR</emphasis> in the <quote>X-Label</quote> field</entry></row>
5140<row><entry>~z [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with a size in the range <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> *) **)</entry></row>
5141<row><entry>~=</entry><entry>duplicated messages (see <link linkend="duplicate-threads">$duplicate_threads</link>)</entry></row>
5142<row><entry>~$</entry><entry>unreferenced messages (requires threaded view)</entry></row>
5143<row><entry>~(<emphasis>PATTERN</emphasis>)</entry><entry>messages in threads
5144containing messages matching <emphasis>PATTERN</emphasis>, e.g. all
5145threads containing messages from you: ~(~P)</entry></row>
5146</tbody>
5147</tgroup>
5148</table>
5149
5150<para>
5151Where <emphasis>EXPR</emphasis> is a <link linkend="regexp">regular expression</link>, and <emphasis>GROUP</emphasis> is an
5152<link linkend="addrgroup">address group</link>.
5153</para>
5154
5155<para>
5156*) The forms <quote><[<emphasis>MAX</emphasis>]</quote>,
5157<quote>>[<emphasis>MIN</emphasis>]</quote>,
5158<quote>[<emphasis>MIN</emphasis>]-</quote> and
5159<quote>-[<emphasis>MAX</emphasis>]</quote> are allowed, too.
5160</para>
5161
5162<para>
5163**) The suffixes <quote>K</quote> and <quote>M</quote> are allowed to
5164specify kilobyte and megabyte respectively.
5165</para>
5166
5167<para>
5168Special attention has to be payed when using regular expressions inside
5169of patterns. Specifically, Mutt's parser for these patterns will strip
5170one level of backslash (<quote>\</quote>), which is normally used for
5171quoting. If it is your intention to use a backslash in the regular
5172expression, you will need to use two backslashes instead
5173(<quote>\\</quote>). You can force Mutt to treat
5174<emphasis>EXPR</emphasis> as a simple string instead of a regular
5175expression by using = instead of ~ in the pattern name. For example,
5176<literal>=b *.*</literal> will find all messages that contain the
5177literal string <quote>*.*</quote>. Simple string matches are less
5178powerful than regular expressions but can be considerably faster. This
5179is especially true for IMAP folders, because string matches can be
5180performed on the server instead of by fetching every message. IMAP
5181treats <literal>=h</literal> specially: it must be of the form
5182<quote>header: substring</quote> and will not partially match header
5183names. The substring part may be omitted if you simply wish to find
5184messages containing a particular header without regard to its value.
5185</para>
5186
5187<para>
5188Patterns matching lists of addresses (notably c, C, p, P and t) match if
5189there is at least one match in the whole list. If you want to make sure
5190that all elements of that list match, you need to prefix your pattern
5191with <quote>^</quote>. This example matches all mails which only has
5192recipients from Germany.
5193</para>
5194
5195<example id="ex-recips">
5196<title>Matching all addresses in address lists</title>
5197<screen>
5198^~C \.de$
5199</screen>
5200</example>
5201
5202<para>
5203You can restrict address pattern matching to aliases that you have
5204defined with the "@" modifier. This example matches messages whose
5205recipients are all from Germany, and who are known to your alias list.
5206</para>
5207
5208<example id="ex-restrict-to-aliases">
5209<title>Matching restricted to aliases</title>
5210<screen>
5211^@~C \.de$
5212</screen>
5213</example>
5214
5215<para>
5216To match any defined alias, use a regular expression that matches any
5217string. This example matches messages whose senders are known aliases.
5218</para>
5219
5220<example id="ex-match-alias">
5221<title>Matching any defined alias</title>
5222<screen>
5223@~f .
5224</screen>
5225</example>
5226
5227</sect2>
5228
5229<sect2 id="simple-searches">
5230<title>Simple Searches</title>
5231
5232<para>
5233Mutt supports two versions of so called <quote>simple
5234searches</quote>. These are issued if the query entered for searching,
5235limiting and similar operations does not seem to contain a valid pattern
5236modifier (i.e. it does not contain one of these characters:
5237<quote>~</quote>, <quote>=</quote> or <quote>%</quote>). If the query is
5238supposed to contain one of these special characters, they must be
5239escaped by prepending a backslash (<quote>\</quote>).
5240</para>
5241
5242<para>
5243The first type is by checking whether the query string equals
5244a keyword case-insensitively from <xref linkend="tab-simplesearch-keywords"/>:
5245If that is the case, Mutt will use the shown pattern modifier instead.
5246If a keyword would conflict with your search keyword, you need to turn
5247it into a regular expression to avoid matching the keyword table. For
5248example, if you want to find all messages matching <quote>flag</quote>
5249(using <link linkend="simple-search">$simple_search</link>)
5250but don't want to match flagged messages, simply search for
5251<quote><literal>[f]lag</literal></quote>.
5252</para>
5253
5254<table id="tab-simplesearch-keywords">
5255<title>Simple search keywords</title>
5256<tgroup cols="2">
5257<thead>
5258<row><entry>Keyword</entry><entry>Pattern modifier</entry></row>
5259</thead>
5260<tbody>
5261<row><entry>all</entry><entry>~A</entry></row>
5262<row><entry>.</entry><entry>~A</entry></row>
5263<row><entry>^</entry><entry>~A</entry></row>
5264<row><entry>del</entry><entry>~D</entry></row>
5265<row><entry>flag</entry><entry>~F</entry></row>
5266<row><entry>new</entry><entry>~N</entry></row>
5267<row><entry>old</entry><entry>~O</entry></row>
5268<row><entry>repl</entry><entry>~Q</entry></row>
5269<row><entry>read</entry><entry>~R</entry></row>
5270<row><entry>tag</entry><entry>~T</entry></row>
5271<row><entry>unread</entry><entry>~U</entry></row>
5272</tbody>
5273</tgroup>
5274</table>
5275
5276<para>
5277The second type of simple search is to build a complex search pattern
5278using <link linkend="simple-search">$simple_search</link> as a
5279template. Mutt will insert your query properly quoted and search for the
5280composed complex query.
5281</para>
5282
5283</sect2>
5284
5285<sect2 id="complex-patterns">
5286<title>Nesting and Boolean Operators</title>
5287
5288<para>
5289Logical AND is performed by specifying more than one criterion. For
5290example:
5291</para>
5292
5293<screen>
5294~t mutt ~f elkins
5295</screen>
5296
5297<para>
5298would select messages which contain the word <quote>mutt</quote> in the
5299list of recipients <emphasis>and</emphasis> that have the word
5300<quote>elkins</quote> in the <quote>From</quote> header field.
5301</para>
5302
5303<para>
5304Mutt also recognizes the following operators to create more complex
5305search patterns:
5306</para>
5307
5308<itemizedlist>
5309<listitem>
5310
5311<para>
5312! — logical NOT operator
5313</para>
5314</listitem>
5315<listitem>
5316
5317<para>
5318| — logical OR operator
5319</para>
5320</listitem>
5321<listitem>
5322
5323<para>
5324() — logical grouping operator
5325</para>
5326</listitem>
5327
5328</itemizedlist>
5329
5330<para>
5331Here is an example illustrating a complex search pattern. This pattern
5332will select all messages which do not contain <quote>mutt</quote> in the
5333<quote>To</quote> or <quote>Cc</quote> field and which are from
5334<quote>elkins</quote>.
5335</para>
5336
5337<example id="ex-pattern-bool">
5338<title>Using boolean operators in patterns</title>
5339<screen>
5340!(~t mutt|~c mutt) ~f elkins
5341</screen>
5342</example>
5343
5344<para>
5345Here is an example using white space in the regular expression (note the
5346<quote>'</quote> and <quote>"</quote> delimiters). For this to match,
5347the mail's subject must match the <quote>^Junk +From +Me$</quote> and it
5348must be from either <quote>Jim +Somebody</quote> or <quote>Ed
5349+SomeoneElse</quote>:
5350</para>
5351
5352<screen>
5353'~s "^Junk +From +Me$" ~f ("Jim +Somebody"|"Ed +SomeoneElse")'
5354</screen>
5355
5356<note>
5357<para>
5358If a regular expression contains parenthesis, or a vertical bar ("|"),
5359you <emphasis>must</emphasis> enclose the expression in double or single
5360quotes since those characters are also used to separate different parts
5361of Mutt's pattern language. For example: <literal>~f
5362"me@(mutt\.org|cs\.hmc\.edu)"</literal> Without the quotes, the
5363parenthesis wouldn't end. This would be separated to two OR'd patterns:
5364<emphasis>~f me@(mutt\.org</emphasis> and
5365<emphasis>cs\.hmc\.edu)</emphasis>. They are never what you want.
5366</para>
5367</note>
5368
5369</sect2>
5370
5371<sect2 id="date-patterns">
5372<title>Searching by Date</title>
5373
5374<para>
5375Mutt supports two types of dates, <emphasis>absolute</emphasis> and
5376<emphasis>relative</emphasis>.
5377</para>
5378
5379<sect3 id="date-absolute">
5380<title>Absolute Dates</title>
5381
5382<para>
5383Dates <emphasis>must</emphasis> be in DD/MM/YY format (month and year
5384are optional, defaulting to the current month and year). An example of
5385a valid range of dates is:
5386</para>
5387
5388<screen>
5389Limit to messages matching: ~d 20/1/95-31/10
5390</screen>
5391
5392<para>
5393If you omit the minimum (first) date, and just specify
5394<quote>-DD/MM/YY</quote>, all messages <emphasis>before</emphasis> the
5395given date will be selected. If you omit the maximum (second) date, and
5396specify <quote>DD/MM/YY-</quote>, all messages
5397<emphasis>after</emphasis> the given date will be selected. If you
5398specify a single date with no dash (<quote>-</quote>), only messages
5399sent on the given date will be selected.
5400</para>
5401
5402<para>
5403You can add error margins to absolute dates. An error margin is a sign
5404(+ or -), followed by a digit, followed by one of the units in <xref
5405linkend="tab-date-units"/>. As a special case, you can replace the sign
5406by a <quote>*</quote> character, which is equivalent to giving identical
5407plus and minus error margins.
5408</para>
5409
5410<table id="tab-date-units">
5411<title>Date units</title>
5412<tgroup cols="2">
5413<thead>
5414<row><entry>Unit</entry><entry>Description</entry></row>
5415</thead>
5416<tbody>
5417<row><entry>y</entry><entry>Years</entry></row>
5418<row><entry>m</entry><entry>Months</entry></row>
5419<row><entry>w</entry><entry>Weeks</entry></row>
5420<row><entry>d</entry><entry>Days</entry></row>
5421</tbody>
5422</tgroup>
5423</table>
5424
5425<para>
5426Example: To select any messages two weeks around January 15, 2001, you'd
5427use the following pattern:
5428</para>
5429
5430<screen>
5431Limit to messages matching: ~d 15/1/2001*2w
5432</screen>
5433
5434</sect3>
5435
5436<sect3 id="dates-relative">
5437<title>Relative Dates</title>
5438
5439<para>
5440This type of date is relative to the current date, and may be specified
5441as:
5442</para>
5443
5444<itemizedlist>
5445<listitem>
5446
5447<para>
5448><emphasis>offset</emphasis> for messages older than
5449<emphasis>offset</emphasis> units
5450</para>
5451</listitem>
5452<listitem>
5453
5454<para>
5455<<emphasis>offset</emphasis> for messages newer than
5456<emphasis>offset</emphasis> units
5457</para>
5458</listitem>
5459<listitem>
5460
5461<para>
5462=<emphasis>offset</emphasis> for messages exactly
5463<emphasis>offset</emphasis> units old
5464</para>
5465</listitem>
5466
5467</itemizedlist>
5468
5469<para>
5470<emphasis>offset</emphasis> is specified as a positive number with one
5471of the units from <xref linkend="tab-date-units"/>.
5472</para>
5473
5474<para>
5475Example: to select messages less than 1 month old, you would use
5476</para>
5477
5478<screen>
5479Limit to messages matching: ~d <1m
5480</screen>
5481
5482<note>
5483<para>
5484All dates used when searching are relative to the
5485<emphasis>local</emphasis> time zone, so unless you change the setting
5486of your <link linkend="index-format">$index_format</link> to include a
5487<literal>%[...]</literal> format, these are <emphasis>not</emphasis> the
5488dates shown in the main index.
5489</para>
5490</note>
5491
5492</sect3>
5493
5494</sect2>
5495
5496</sect1>
5497
5498<sect1 id="markmsg">
5499<title>Marking Messages</title>
5500
5501<para>
5502There are times that it's useful to ask Mutt to "remember" which message
5503you're currently looking at, while you move elsewhere in your mailbox.
5504You can do this with the <quote>mark-message</quote> operator, which
5505is bound to the <quote>~</quote> key by default. Press this key to
5506enter an identifier for the marked message. When you want to return to
5507this message, press <quote>'</quote> and the name that you previously
5508entered.
5509</para>
5510
5511<para>
5512(Message marking is really just a shortcut for defining a macro
5513that returns you to the current message by searching for its
5514Message-ID. You can choose a different prefix by setting the <link
5515linkend="mark-macro-prefix">$mark_macro_prefix</link> variable.)
5516</para>
5517</sect1>
5518
5519<sect1 id="tags">
5520<title>Using Tags</title>
5521
5522<para>
5523Sometimes it is desirable to perform an operation on a group of messages
5524all at once rather than one at a time. An example might be to save
5525messages to a mailing list to a separate folder, or to delete all
5526messages with a given subject. To tag all messages matching a pattern,
5527use the <literal><tag-pattern></literal> function, which is bound
5528to <quote>shift-T</quote> by default. Or you can select individual
5529messages by hand using the <literal><tag-message></literal>
5530function, which is bound to <quote>t</quote> by default. See <link
5531linkend="patterns">patterns</link> for Mutt's pattern matching syntax.
5532</para>
5533
5534<para>
5535Once you have tagged the desired messages, you can use the
5536<quote>tag-prefix</quote> operator, which is the <quote>;</quote>
5537(semicolon) key by default. When the <quote>tag-prefix</quote> operator
5538is used, the <emphasis>next</emphasis> operation will be applied to all
5539tagged messages if that operation can be used in that manner. If the
5540<link linkend="auto-tag">$auto_tag</link> variable is set, the next
5541operation applies to the tagged messages automatically, without
5542requiring the <quote>tag-prefix</quote>.
5543</para>
5544
5545<para>
5546In <link linkend="macro"><command>macro</command>s</link> or <link
5547linkend="push"><command>push</command></link> commands, you can use the
5548<literal><tag-prefix-cond></literal> operator. If there are no
5549tagged messages, Mutt will <quote>eat</quote> the rest of the macro to
5550abort it's execution. Mutt will stop <quote>eating</quote> the macro
5551when it encounters the <literal><end-cond></literal> operator;
5552after this operator the rest of the macro will be executed as normal.
5553</para>
5554
5555</sect1>
5556
5557<sect1 id="hooks">
5558<title>Using Hooks</title>
5559
5560<para>
5561A <emphasis>hook</emphasis> is a concept found in many other programs
5562which allows you to execute arbitrary commands before performing some
5563operation. For example, you may wish to tailor your configuration based
5564upon which mailbox you are reading, or to whom you are sending mail. In
5565the Mutt world, a <emphasis>hook</emphasis> consists of a <link
5566linkend="regexp">regular expression</link> or <link
5567linkend="patterns">pattern</link> along with a configuration
5568option/command. See:
5569
5570<itemizedlist>
5571
5572<listitem>
5573<para>
5574<link linkend="account-hook"><command>account-hook</command></link>
5575</para>
5576</listitem>
5577
5578<listitem>
5579<para>
5580<link linkend="charset-hook"><command>charset-hook</command></link>
5581</para>
5582</listitem>
5583
5584<listitem>
5585<para>
5586<link linkend="crypt-hook"><command>crypt-hook</command></link>
5587</para>
5588</listitem>
5589
5590<listitem>
5591<para>
5592<link linkend="fcc-hook"><command>fcc-hook</command></link>
5593</para>
5594</listitem>
5595
5596<listitem>
5597<para>
5598<link linkend="fcc-save-hook"><command>fcc-save-hook</command></link>
5599</para>
5600</listitem>
5601
5602<listitem>
5603<para>
5604<link linkend="folder-hook"><command>folder-hook</command></link>
5605</para>
5606</listitem>
5607
5608<listitem>
5609<para>
5610<link linkend="iconv-hook"><command>iconv-hook</command></link>
5611</para>
5612</listitem>
5613
5614<listitem>
5615<para>
5616<link linkend="mbox-hook"><command>mbox-hook</command></link>
5617</para>
5618</listitem>
5619
5620<listitem>
5621<para>
5622<link linkend="message-hook"><command>message-hook</command></link>
5623</para>
5624</listitem>
5625
5626<listitem>
5627<para>
5628<link linkend="reply-hook"><command>reply-hook</command></link>
5629</para>
5630</listitem>
5631
5632<listitem>
5633<para>
5634<link linkend="save-hook"><command>save-hook</command></link>
5635</para>
5636</listitem>
5637
5638<listitem>
5639<para>
5640<link linkend="send-hook"><command>send-hook</command></link>
5641</para>
5642</listitem>
5643
5644<listitem>
5645<para>
5646<link linkend="send2-hook"><command>send2-hook</command></link>
5647</para>
5648</listitem>
5649
5650</itemizedlist>
5651
5652for specific details on each type of <emphasis>hook</emphasis> available.
5653</para>
5654
5655<note>
5656<para>
5657If a hook changes configuration settings, these changes remain effective
5658until the end of the current Mutt session. As this is generally not
5659desired, a <quote>default</quote> hook needs to be added before all
5660other hooks of that type to restore configuration defaults.
5661</para>
5662</note>
5663
5664<example id="ex-default-hook">
5665<title>Specifying a <quote>default</quote> hook</title>
5666<screen>
5667send-hook . 'unmy_hdr From:'
5668send-hook ~C'^b@b\.b$' my_hdr from: c@c.c
5669</screen>
5670</example>
5671
5672<para>
5673In <xref linkend="ex-default-hook"/>, by default the value of <link
5674linkend="from">$from</link> and <link
5675linkend="realname">$realname</link> is not overridden. When sending
5676messages either To: or Cc: to <literal><b@b.b></literal>, the
5677From: header is changed to <literal><c@c.c></literal>.
5678</para>
5679
5680<sect2 id="pattern-hook" xreflabel="Message Matching in Hooks">
5681<title>Message Matching in Hooks</title>
5682
5683<para>
5684Hooks that act upon messages (<command>message-hook</command>,
5685<command>reply-hook</command>, <command>send-hook</command>,
5686<command>send2-hook</command>, <command>save-hook</command>,
5687<command>fcc-hook</command>) are evaluated in a slightly different
5688manner. For the other types of hooks, a <link linkend="regexp">regular
5689expression</link> is sufficient. But in dealing with messages a finer
5690grain of control is needed for matching since for different purposes you
5691want to match different criteria.
5692</para>
5693
5694<para>
5695Mutt allows the use of the <link linkend="patterns">search
5696pattern</link> language for matching messages in hook commands. This
5697works in exactly the same way as it would when
5698<emphasis>limiting</emphasis> or <emphasis>searching</emphasis> the
5699mailbox, except that you are restricted to those operators which match
5700information Mutt extracts from the header of the message (i.e., from,
5701to, cc, date, subject, etc.).
5702</para>
5703
5704<para>
5705For example, if you wanted to set your return address based upon sending
5706mail to a specific address, you could do something like:
5707</para>
5708
5709<screen>
5710send-hook '~t ^me@cs\.hmc\.edu$' 'my_hdr From: Mutt User <user@host>'
5711</screen>
5712
5713<para>
5714which would execute the given command when sending mail to
5715<emphasis>me@cs.hmc.edu</emphasis>.
5716</para>
5717
5718<para>
5719However, it is not required that you write the pattern to match using
5720the full searching language. You can still specify a simple
5721<emphasis>regular expression</emphasis> like the other hooks, in which
5722case Mutt will translate your pattern into the full language, using the
5723translation specified by the <link
5724linkend="default-hook">$default_hook</link> variable. The pattern is
5725translated at the time the hook is declared, so the value of <link
5726linkend="default-hook">$default_hook</link> that is in effect at that
5727time will be used.
5728</para>
5729
5730</sect2>
5731
5732<sect2 id="mailbox-hook" xreflabel="Mailbox Matching in Hooks">
5733<title>Mailbox Matching in Hooks</title>
5734
5735<para>
5736Hooks that match against mailboxes (<command>folder-hook</command>,
5737<command>mbox-hook</command>) apply both <link linkend="regexp">regular
5738expression</link> syntax as well as <link linkend="shortcuts">mailbox
5739shortcut</link> expansion on the regexp parameter. There is some
5740overlap between these, so special attention should be paid to the first
5741character of the regexp.
5742</para>
5743
5744<screen>
5745# Here, ^ will expand to "the current mailbox" not "beginning of string":
5746folder-hook ^/home/user/Mail/bar "set sort=threads"
5747
5748# If you want ^ to be interpreted as "beginning of string", one workaround
5749# is to enclose the regexp in parenthesis:
5750folder-hook (^/home/user/Mail/bar) "set sort=threads"
5751
5752# This will expand to the default save folder for the alias "imap.example.com", which
5753# is probably not what you want:
5754folder-hook @imap.example.com "set sort=threads"
5755
5756# A workaround is to use parenthesis or a backslash:
5757folder-hook (@imap.example.com) "set sort=threads"
5758folder-hook '\@imap.example.com' "set sort=threads"
5759</screen>
5760
5761<para>
5762Keep in mind that mailbox shortcut expansion on the regexp parameter
5763takes place when the hook is initially parsed, not when the hook is
5764matching against a mailbox. When Mutt starts up and is reading the
5765.muttrc, some mailbox shortcuts may not be usable. For example, the
5766"current mailbox" shortcut, ^, will expand to an empty string because no
5767mailbox has been opened yet. Mutt will issue an error for this case or
5768if the mailbox shortcut results in an empty regexp.
5769</para>
5770
5771</sect2>
5772
5773</sect1>
5774
5775<sect1 id="setenv">
5776<title>Managing the Environment</title>
5777
5778<para>
5779You can alter the environment that Mutt passes on to its child processes
5780using the <quote>setenv</quote> and <quote>unsetenv</quote> operators.
5781(N.B. These follow Mutt-style syntax, not shell-style!) You can also
5782query current environment values by prefixing a <quote>?</quote> character.
5783</para>
5784
5785<screen>
5786setenv TERM vt100
5787setenv ORGANIZATION "The Mutt Development Team"
5788unsetenv DISPLAY
5789setenv ?LESS
5790</screen>
5791</sect1>
5792
5793<sect1 id="query">
5794<title>External Address Queries</title>
5795
5796<para>
5797Mutt supports connecting to external directory databases such as LDAP,
5798ph/qi, bbdb, or NIS through a wrapper script which connects to Mutt
5799using a simple interface. Using the <link
5800linkend="query-command">$query_command</link> variable, you specify the
5801wrapper command to use. For example:
5802</para>
5803
5804<screen>
5805set query_command = "mutt_ldap_query.pl %s"
5806</screen>
5807
5808<para>
5809The wrapper script should accept the query on the command-line. It
5810should return a one line message, then each matching response on a
5811single line, each line containing a tab separated address then name then
5812some other optional information. On error, or if there are no matching
5813addresses, return a non-zero exit code and a one line error message.
5814</para>
5815
5816<para>
5817An example multiple response output:
5818</para>
5819
5820<screen>
5821Searching database ... 20 entries ... 3 matching:
5822me@cs.hmc.edu Michael Elkins mutt dude
5823blong@fiction.net Brandon Long mutt and more
5824roessler@does-not-exist.org Thomas Roessler mutt pgp
5825</screen>
5826
5827<para>
5828There are two mechanisms for accessing the query function of Mutt. One
5829is to do a query from the index menu using the
5830<literal><query></literal> function (default: Q). This will
5831prompt for a query, then bring up the query menu which will list the
5832matching responses. From the query menu, you can select addresses to
5833create aliases, or to mail. You can tag multiple addresses to mail,
5834start a new query, or have a new query appended to the current
5835responses.
5836</para>
5837
5838<para>
5839The other mechanism for accessing the query function is for address
5840completion, similar to the alias completion. In any prompt for address
5841entry, you can use the <literal><complete-query></literal>
5842function (default: ^T) to run a query based on the current address you
5843have typed. Like aliases, Mutt will look for what you have typed back
5844to the last space or comma. If there is a single response for that
5845query, Mutt will expand the address in place. If there are multiple
5846responses, Mutt will activate the query menu. At the query menu, you
5847can select one or more addresses to be added to the prompt.
5848</para>
5849
5850</sect1>
5851
5852<sect1 id="mailbox-formats">
5853<title>Mailbox Formats</title>
5854
5855<para>
5856Mutt supports reading and writing of four different local mailbox
5857formats: mbox, MMDF, MH and Maildir. The mailbox type is auto detected,
5858so there is no need to use a flag for different mailbox types. When
5859creating new mailboxes, Mutt uses the default specified with the <link
5860linkend="mbox-type">$mbox_type</link> variable. A short description of
5861the formats follows.
5862</para>
5863
5864<para>
5865<emphasis>mbox</emphasis>. This is a widely used mailbox format for
5866UNIX. All messages are stored in a single file. Each message has a
5867line of the form:
5868</para>
5869
5870<screen>
5871From me@cs.hmc.edu Fri, 11 Apr 1997 11:44:56 PST
5872</screen>
5873
5874<para>
5875to denote the start of a new message (this is often referred to as the
5876<quote>From_</quote> line). The mbox format requires mailbox locking, is
5877prone to mailbox corruption with concurrently writing clients or
5878misinterpreted From_ lines. Depending on the environment, new mail
5879detection can be unreliable. Mbox folders are fast to open and easy to
5880archive.
5881</para>
5882
5883<para>
5884<emphasis>MMDF</emphasis>. This is a variant of the
5885<emphasis>mbox</emphasis> format. Each message is surrounded by lines
5886containing <quote>^A^A^A^A</quote> (four times control-A's). The same
5887problems as for mbox apply (also with finding the right message
5888separator as four control-A's may appear in message bodies).
5889</para>
5890
5891<para>
5892<emphasis>MH</emphasis>. A radical departure from
5893<emphasis>mbox</emphasis> and <emphasis>MMDF</emphasis>, a mailbox
5894consists of a directory and each message is stored in a separate file.
5895The filename indicates the message number (however, this is may not
5896correspond to the message number Mutt displays). Deleted messages are
5897renamed with a comma (<quote>,</quote>) prepended to the filename. Mutt
5898detects this type of mailbox by looking for either
5899<literal>.mh_sequences</literal> or <literal>.xmhcache</literal> files
5900(needed to distinguish normal directories from MH mailboxes). MH is more
5901robust with concurrent clients writing the mailbox, but still may suffer
5902from lost flags; message corruption is less likely to occur than with
5903mbox/mmdf. It's usually slower to open compared to mbox/mmdf since many
5904small files have to be read (Mutt provides <xref
5905linkend="header-caching"/> to greatly speed this process up). Depending
5906on the environment, MH is not very disk-space efficient.
5907</para>
5908
5909<para>
5910<emphasis>Maildir</emphasis>. The newest of the mailbox formats, used
5911by the Qmail MTA (a replacement for sendmail). Similar to
5912<emphasis>MH</emphasis>, except that it adds three subdirectories of the
5913mailbox: <emphasis>tmp</emphasis>, <emphasis>new</emphasis> and
5914<emphasis>cur</emphasis>. Filenames for the messages are chosen in such
5915a way they are unique, even when two programs are writing the mailbox
5916over NFS, which means that no file locking is needed and corruption is
5917very unlikely. Maildir maybe slower to open without caching in Mutt, it
5918too is not very disk-space efficient depending on the environment. Since
5919no additional files are used for metadata (which is embedded in the
5920message filenames) and Maildir is locking-free, it's easy to sync across
5921different machines using file-level synchronization tools.
5922</para>
5923
5924</sect1>
5925
5926<sect1 id="shortcuts">
5927<title>Mailbox Shortcuts</title>
5928
5929<para>
5930There are a number of built in shortcuts which refer to specific
5931mailboxes. These shortcuts can be used anywhere you are prompted for a
5932file or mailbox path or in path-related configuration variables. Note
5933that these only work at the beginning of a string.
5934</para>
5935
5936<table id="tab-mailbox-shortcuts">
5937<title>Mailbox shortcuts</title>
5938<tgroup cols="2">
5939<thead>
5940<row><entry>Shortcut</entry><entry>Refers to...</entry></row>
5941</thead>
5942<tbody>
5943<row><entry><literal>!</literal></entry><entry>your <link linkend="spoolfile">$spoolfile</link> (incoming) mailbox</entry></row>
5944<row><entry><literal>></literal></entry><entry>your <link linkend="mbox">$mbox</link> file</entry></row>
5945<row><entry><literal><</literal></entry><entry>your <link linkend="record">$record</link> file</entry></row>
5946<row><entry><literal>^</literal></entry><entry>the current mailbox</entry></row>
5947<row><entry><literal>-</literal> or <literal>!!</literal></entry><entry>the file you've last visited</entry></row>
5948<row><entry><literal>~</literal></entry><entry>your home directory</entry></row>
5949<row><entry><literal>=</literal> or <literal>+</literal></entry><entry>your <link linkend="folder">$folder</link> directory</entry></row>
5950<row><entry><emphasis>@alias</emphasis></entry><entry>to the <link linkend="save-hook">default save folder</link> as determined by the address of the alias</entry></row>
5951</tbody>
5952</tgroup>
5953</table>
5954
5955<para>
5956For example, to store a copy of outgoing messages in the folder they
5957were composed in, a <link
5958linkend="folder-hook"><command>folder-hook</command></link> can be used
5959to set <link linkend="record">$record</link>:
5960</para>
5961
5962<screen>
5963folder-hook . 'set record=^'</screen>
5964
5965</sect1>
5966
5967<sect1 id="using-lists">
5968<title>Handling Mailing Lists</title>
5969
5970<para>
5971Mutt has a few configuration options that make dealing with large
5972amounts of mail easier. The first thing you must do is to let Mutt know
5973what addresses you consider to be mailing lists (technically this does
5974not have to be a mailing list, but that is what it is most often used
5975for), and what lists you are subscribed to. This is accomplished
5976through the use of the <link linkend="lists"><command>lists</command>
5977and <command>subscribe</command></link> commands in your
5978<literal>.muttrc</literal>.
5979</para>
5980
5981<para>
5982Now that Mutt knows what your mailing lists are, it can do several
5983things, the first of which is the ability to show the name of a list
5984through which you received a message (i.e., of a subscribed list) in the
5985<emphasis>index</emphasis> menu display. This is useful to distinguish
5986between personal and list mail in the same mailbox. In the <link
5987linkend="index-format">$index_format</link> variable, the expando
5988<quote>%L</quote> will print the string <quote>To <list></quote>
5989when <quote>list</quote> appears in the <quote>To</quote> field, and
5990<quote>Cc <list></quote> when it appears in the <quote>Cc</quote>
5991field (otherwise it prints the name of the author).
5992</para>
5993
5994<para>
5995Often times the <quote>To</quote> and <quote>Cc</quote> fields in
5996mailing list messages tend to get quite large. Most people do not bother
5997to remove the author of the message they reply to from the list,
5998resulting in two or more copies being sent to that person. The
5999<literal><list-reply></literal> function, which by default is
6000bound to <quote>L</quote> in the <emphasis>index</emphasis> menu and
6001<emphasis>pager</emphasis>, helps reduce the clutter by only replying to
6002the known mailing list addresses instead of all recipients (except as
6003specified by <literal>Mail-Followup-To</literal>, see below).
6004</para>
6005
6006<para>
6007Mutt also supports the <literal>Mail-Followup-To</literal> header. When
6008you send a message to a list of recipients which includes one or several
6009subscribed mailing lists, and if the <link
6010linkend="followup-to">$followup_to</link> option is set, Mutt will
6011generate a Mail-Followup-To header which contains all the recipients to
6012whom you send this message, but not your address. This indicates that
6013group-replies or list-replies (also known as <quote>followups</quote>)
6014to this message should only be sent to the original recipients of the
6015message, and not separately to you - you'll receive your copy through
6016one of the mailing lists you are subscribed to.
6017</para>
6018
6019<para>
6020Conversely, when group-replying or list-replying to a message which has
6021a <literal>Mail-Followup-To</literal> header, Mutt will respect this
6022header if the <link
6023linkend="honor-followup-to">$honor_followup_to</link> configuration
6024variable is set. Using <link linkend="list-reply">list-reply</link>
6025will in this case also make sure that the reply goes to the mailing
6026list, even if it's not specified in the list of recipients in the
6027<literal>Mail-Followup-To</literal>.
6028</para>
6029
6030<note>
6031<para>
6032When header editing is enabled, you can create a
6033<literal>Mail-Followup-To</literal> header manually. Mutt will only
6034auto-generate this header if it doesn't exist when you send the message.
6035</para>
6036</note>
6037
6038<para>
6039The other method some mailing list admins use is to generate a
6040<quote>Reply-To</quote> field which points back to the mailing list
6041address rather than the author of the message. This can create problems
6042when trying to reply directly to the author in private, since most mail
6043clients will automatically reply to the address given in the
6044<quote>Reply-To</quote> field. Mutt uses the <link
6045linkend="reply-to">$reply_to</link> variable to help decide which
6046address to use. If set to <emphasis>ask-yes</emphasis> or
6047<emphasis>ask-no</emphasis>, you will be prompted as to whether or not
6048you would like to use the address given in the <quote>Reply-To</quote>
6049field, or reply directly to the address given in the <quote>From</quote>
6050field. When set to <emphasis>yes</emphasis>, the
6051<quote>Reply-To</quote> field will be used when present.
6052</para>
6053
6054<para>
6055The <quote>X-Label:</quote> header field can be used to further identify
6056mailing lists or list subject matter (or just to annotate messages
6057individually). The <link linkend="index-format">$index_format</link>
6058variable's <quote>%y</quote> and <quote>%Y</quote> expandos can be used
6059to expand <quote>X-Label:</quote> fields in the index, and Mutt's
6060pattern-matcher can match regular expressions to <quote>X-Label:</quote>
6061fields with the <quote>~y</quote> selector. <quote>X-Label:</quote> is
6062not a standard message header field, but it can easily be inserted by
6063procmail and other mail filtering agents.
6064</para>
6065
6066<para>
6067Lastly, Mutt has the ability to <link linkend="sort">sort</link> the
6068mailbox into <link linkend="threads">threads</link>. A thread is a
6069group of messages which all relate to the same subject. This is usually
6070organized into a tree-like structure where a message and all of its
6071replies are represented graphically. If you've ever used a threaded
6072news client, this is the same concept. It makes dealing with large
6073volume mailing lists easier because you can easily delete uninteresting
6074threads and quickly find topics of value.
6075</para>
6076
6077</sect1>
6078
6079<sect1 id="new-mail">
6080<title>New Mail Detection</title>
6081
6082<para>
6083Mutt supports setups with multiple folders, allowing all of them to be
6084monitored for new mail (see <xref linkend="mailboxes"/> for details).
6085</para>
6086
6087<sect2 id="new-mail-formats">
6088<title>How New Mail Detection Works</title>
6089
6090<para>
6091For Mbox and Mmdf folders, new mail is detected by comparing access
6092and/or modification times of files: Mutt assumes a folder has new mail
6093if it wasn't accessed after it was last modified. Utilities like
6094<literal>biff</literal> or <literal>frm</literal> or any other program
6095which accesses the mailbox might cause Mutt to never detect new mail for
6096that mailbox if they do not properly reset the access time. Other
6097possible causes of Mutt not detecting new mail in these folders are
6098backup tools (updating access times) or filesystems mounted without
6099access time update support (for Linux systems, see the
6100<literal>relatime</literal> option).
6101</para>
6102
6103<note>
6104<para>
6105Contrary to older Mutt releases, it now maintains the new mail status of
6106a folder by properly resetting the access time if the folder contains at
6107least one message which is neither read, nor deleted, nor marked as old.
6108</para>
6109</note>
6110
6111<para>
6112In cases where new mail detection for Mbox or Mmdf folders appears to be
6113unreliable, the <link linkend="check-mbox-size">$check_mbox_size</link>
6114option can be used to make Mutt track and consult file sizes for new
6115mail detection instead which won't work for size-neutral changes.
6116</para>
6117
6118<para>
6119New mail for Maildir is assumed if there is one message in the
6120<literal>new/</literal> subdirectory which is not marked deleted (see
6121<link linkend="maildir-trash">$maildir_trash</link>). For MH folders, a
6122mailbox is considered having new mail if there's at least one message in
6123the <quote>unseen</quote> sequence as specified by <link
6124linkend="mh-seq-unseen">$mh_seq_unseen</link>.
6125</para>
6126
6127<para>
6128Mutt does not poll POP3 folders for new mail, it only periodically
6129checks the currently opened folder (if it's a POP3 folder).
6130</para>
6131
6132<para>
6133For IMAP, by default Mutt uses recent message counts provided by the
6134server to detect new mail. If the <link
6135linkend="imap-idle">$imap_idle</link> option is set, it'll use the IMAP
6136IDLE extension if advertised by the server.
6137</para>
6138
6139<para>
6140The <link linkend="mail-check-recent">$mail_check_recent</link>
6141option changes whether Mutt will notify you of new mail in an
6142already visited mailbox. When set (the default) it will only notify
6143you of new mail received since the last time you opened the mailbox.
6144When unset, Mutt will notify you of any new mail in the mailbox.
6145</para>
6146
6147</sect2>
6148
6149<sect2 id="new-mail-polling">
6150<title>Polling For New Mail</title>
6151
6152<para>
6153When in the index menu and being idle (also see <link
6154linkend="timeout">$timeout</link>), Mutt periodically checks for new
6155mail in all folders which have been configured via the
6156<command>mailboxes</command> command. The interval depends on the folder
6157type: for local/IMAP folders it consults <link
6158linkend="mail-check">$mail_check</link> and <link
6159linkend="pop-checkinterval">$pop_checkinterval</link> for POP folders.
6160</para>
6161
6162<para>
6163Outside the index menu the directory browser supports checking for new
6164mail using the <literal><check-new></literal> function which is
6165unbound by default. Pressing TAB will bring up a menu showing the files
6166specified by the <command>mailboxes</command> command, and indicate
6167which contain new messages. Mutt will automatically enter this mode when
6168invoked from the command line with the <literal>-y</literal> option.
6169</para>
6170
6171<para>
6172For the pager, index and directory browser menus, Mutt contains the
6173<literal><buffy-list></literal> function (bound to
6174<quote>.</quote> by default) which will print a list of folders with new
6175mail in the command line at the bottom of the screen.
6176</para>
6177
6178<para>
6179For the index, by default Mutt displays the number of mailboxes with new
6180mail in the status bar, please refer to the <link
6181linkend="status-format">$status_format</link> variable for details.
6182</para>
6183
6184<para>
6185When changing folders, Mutt fills the prompt with the first folder from
6186the mailboxes list containing new mail (if any), pressing
6187<literal><Space></literal> will cycle through folders with new
6188mail. The (by default unbound) function
6189<literal><next-unread-mailbox></literal> in the index can be used
6190to immediately open the next folder with unread mail (if any).
6191</para>
6192
6193</sect2>
6194
6195<sect2 id="calc-mailbox-counts">
6196<title>Calculating Mailbox Message Counts</title>
6197
6198<para>
6199If <link linkend="mail-check-stats">$mail_check_stats</link> is set,
6200Mutt will periodically calculate the unread, flagged, and total
6201message counts for each mailbox watched by the
6202<command>mailboxes</command> command. This calculation takes place at
6203the same time as new mail polling, but is controlled by a separate
6204timer: <link
6205linkend="mail-check-stats-interval">$mail_check_stats_interval</link>.
6206</para>
6207
6208<para>
6209The sidebar can display these message counts. See <link
6210linkend="sidebar-format">$sidebar_format</link>.
6211</para>
6212
6213</sect2>
6214
6215</sect1>
6216
6217<sect1 id="editing-threads">
6218<title>Editing Threads</title>
6219
6220<para>
6221Mutt has the ability to dynamically restructure threads that are broken
6222either by misconfigured software or bad behavior from some
6223correspondents. This allows to clean your mailboxes from these
6224annoyances which make it hard to follow a discussion.
6225</para>
6226
6227<sect2 id="link-threads">
6228<title>Linking Threads</title>
6229
6230<para>
6231Some mailers tend to <quote>forget</quote> to correctly set the
6232<quote>In-Reply-To:</quote> and <quote>References:</quote> headers when
6233replying to a message. This results in broken discussions because Mutt
6234has not enough information to guess the correct threading. You can fix
6235this by tagging the reply, then moving to the parent message and using
6236the <literal><link-threads></literal> function (bound to & by
6237default). The reply will then be connected to this parent message.
6238</para>
6239
6240<para>
6241You can also connect multiple children at once, tagging them and using
6242the <literal><tag-prefix></literal> command (<quote>;</quote>) or
6243the <link linkend="auto-tag">$auto_tag</link> option.
6244</para>
6245
6246</sect2>
6247
6248<sect2 id="break-threads">
6249<title>Breaking Threads</title>
6250
6251<para>
6252On mailing lists, some people are in the bad habit of starting a new
6253discussion by hitting <quote>reply</quote> to any message from the list
6254and changing the subject to a totally unrelated one. You can fix such
6255threads by using the <literal><break-thread></literal> function
6256(bound by default to #), which will turn the subthread starting from the
6257current message into a whole different thread.
6258</para>
6259
6260</sect2>
6261
6262</sect1>
6263
6264<sect1 id="dsn">
6265<title>Delivery Status Notification (DSN) Support</title>
6266
6267<para>
6268RFC1894 defines a set of MIME content types for relaying information
6269about the status of electronic mail messages. These can be thought of
6270as <quote>return receipts.</quote>
6271</para>
6272
6273<para>
6274To support DSN, there are two variables. <link
6275linkend="dsn-notify">$dsn_notify</link> is used to request receipts for
6276different results (such as failed message, message delivered, etc.).
6277<link linkend="dsn-return">$dsn_return</link> requests how much of your
6278message should be returned with the receipt (headers or full message).
6279</para>
6280
6281<para>
6282When using <link linkend="sendmail">$sendmail</link> for mail delivery,
6283you need to use either Berkeley sendmail 8.8.x (or greater) a MTA
6284supporting DSN command line options compatible to Sendmail: The -N and
6285-R options can be used by the mail client to make requests as to what
6286type of status messages should be returned. Please consider your MTA
6287documentation whether DSN is supported.
6288</para>
6289
6290<para>
6291For SMTP delivery using <link linkend="smtp-url">$smtp_url</link>, it
6292depends on the capabilities announced by the server whether Mutt will
6293attempt to request DSN or not.
6294</para>
6295
6296</sect1>
6297
6298<sect1 id="urlview">
6299<title>Start a WWW Browser on URLs</title>
6300
6301<para>
6302If a message contains URLs, it is efficient to get a menu with all the
6303URLs and start a WWW browser on one of them. This functionality is
6304provided by the external urlview program which can be retrieved at
6305<ulink
6306url="ftp://ftp.mutt.org/mutt/contrib/">ftp://ftp.mutt.org/mutt/contrib/</ulink>
6307and the configuration commands:
6308</para>
6309
6310<screen>
6311macro index \cb |urlview\n
6312macro pager \cb |urlview\n
6313</screen>
6314
6315</sect1>
6316
6317<sect1 id="misc-topics">
6318<title>Miscellany</title>
6319
6320<para>
6321This section documents various features that fit nowhere else.
6322</para>
6323
6324<variablelist>
6325<varlistentry>
6326<term>
6327Address normalization
6328</term>
6329<listitem>
6330<para>
6331Mutt normalizes all e-mail addresses to the simplest form possible. If
6332an address contains a realname, the form <emphasis>Joe User
6333<joe@example.com></emphasis> is used and the pure e-mail address
6334without angle brackets otherwise, i.e. just
6335<emphasis>joe@example.com</emphasis>.
6336</para>
6337<para>
6338This normalization affects all headers Mutt generates including aliases.
6339</para>
6340</listitem>
6341</varlistentry>
6342<varlistentry>
6343<term>
6344Initial folder selection
6345</term>
6346<listitem>
6347<para>
6348The folder Mutt opens at startup is determined as follows: the folder
6349specified in the <literal>$MAIL</literal> environment variable if
6350present. Otherwise, the value of <literal>$MAILDIR</literal> is taken
6351into account. If that isn't present either, Mutt takes the user's
6352mailbox in the mailspool as determined at compile-time (which may also
6353reside in the home directory). The <link
6354linkend="spoolfile">$spoolfile</link> setting overrides this
6355selection. Highest priority has the mailbox given with the
6356<literal>-f</literal> command line option.
6357</para>
6358</listitem>
6359</varlistentry>
6360</variablelist>
6361
6362</sect1>
6363
6364</chapter>
6365
6366<chapter id="mimesupport">
6367<title>Mutt's MIME Support</title>
6368
6369<para>
6370Quite a bit of effort has been made to make Mutt the premier text-mode
6371MIME MUA. Every effort has been made to provide the functionality that
6372the discerning MIME user requires, and the conformance to the standards
6373wherever possible. When configuring Mutt for MIME, there are two extra
6374types of configuration files which Mutt uses. One is the
6375<literal>mime.types</literal> file, which contains the mapping of file
6376extensions to IANA MIME types. The other is the
6377<literal>mailcap</literal> file, which specifies the external commands
6378to use for handling specific MIME types.
6379</para>
6380
6381<sect1 id="using-mime">
6382<title>Using MIME in Mutt</title>
6383
6384<sect2 id="mime-overview">
6385<title>MIME Overview</title>
6386
6387<para>
6388MIME is short for <quote>Multipurpose Internet Mail Extension</quote>
6389and describes mechanisms to internationalize and structure mail
6390messages. Before the introduction of MIME, messages had a single text
6391part and were limited to us-ascii header and content. With MIME,
6392messages can have attachments (and even attachments which itself have
6393attachments and thus form a tree structure), nearly arbitrary characters
6394can be used for sender names, recipients and subjects.
6395</para>
6396
6397<para>
6398Besides the handling of non-ascii characters in message headers, to Mutt
6399the most important aspect of MIME are so-called MIME types. These are
6400constructed using a <emphasis>major</emphasis> and
6401<emphasis>minor</emphasis> type separated by a forward slash. These
6402specify details about the content that follows. Based upon these, Mutt
6403decides how to handle this part. The most popular major type is
6404<quote><literal>text</literal></quote> with minor types for plain text,
6405HTML and various other formats. Major types also exist for images,
6406audio, video and of course general application data (e.g. to separate
6407cryptographically signed data with a signature, send office documents,
6408and in general arbitrary binary data). There's also the
6409<literal>multipart</literal> major type which represents the root of a
6410subtree of MIME parts. A list of supported MIME types can be found in
6411<xref linkend="supported-mime-types"/>.
6412</para>
6413
6414<para>
6415MIME also defines a set of encoding schemes for transporting MIME
6416content over the network: <literal>7bit</literal>,
6417<literal>8bit</literal>, <literal>quoted-printable</literal>,
6418<literal>base64</literal> and <literal>binary</literal>. There're some
6419rules when to choose what for encoding headers and/or body (if needed),
6420and Mutt will in general make a good choice.
6421</para>
6422
6423<para>
6424Mutt does most of MIME encoding/decoding behind the scenes to form
6425messages conforming to MIME on the sending side. On reception, it can be
6426flexibly configured as to how what MIME structure is displayed (and if
6427it's displayed): these decisions are based on the content's MIME type.
6428There are three areas/menus in dealing with MIME: the pager (while
6429viewing a message), the attachment menu and the compose menu.
6430</para>
6431
6432</sect2>
6433
6434<sect2 id="mime-pager">
6435<title>Viewing MIME Messages in the Pager</title>
6436
6437<para>
6438When you select a message from the index and view it in the pager, Mutt
6439decodes as much of a message as possible to a text representation. Mutt
6440internally supports a number of MIME types, including the
6441<literal>text</literal> major type (with all minor types), the
6442<literal>message/rfc822</literal> (mail messages) type and some
6443<literal>multipart</literal> types. In addition, it recognizes a variety
6444of PGP MIME types, including PGP/MIME and
6445<literal>application/pgp</literal>.
6446</para>
6447
6448<para>
6449Mutt will denote attachments with a couple lines describing them.
6450These lines are of the form:
6451</para>
6452
6453<screen>
6454[-- Attachment #1: Description --]
6455[-- Type: text/plain, Encoding: 7bit, Size: 10000 --]
6456</screen>
6457
6458<para>
6459Where the <emphasis>Description</emphasis> is the description or
6460filename given for the attachment, and the <emphasis>Encoding</emphasis>
6461is one of the already mentioned content encodings.
6462</para>
6463
6464<para>
6465If Mutt cannot deal with a MIME type, it will display a message like:
6466</para>
6467
6468<screen>
6469[-- image/gif is unsupported (use 'v' to view this part) --]
6470</screen>
6471
6472</sect2>
6473
6474<sect2 id="attach-menu">
6475<title>The Attachment Menu</title>
6476
6477<para>
6478The default binding for <literal><view-attachments></literal> is
6479<quote>v</quote>, which displays the attachment menu for a message. The
6480attachment menu displays a list of the attachments in a message. From
6481the attachment menu, you can save, print, pipe, delete, and view
6482attachments. You can apply these operations to a group of attachments
6483at once, by tagging the attachments and by using the
6484<literal><tag-prefix></literal> operator. You can also reply to
6485the current message from this menu, and only the current attachment (or
6486the attachments tagged) will be quoted in your reply. You can view
6487attachments as text, or view them using the mailcap viewer definition
6488(the mailcap mechanism is explained later in detail).
6489</para>
6490
6491<para>
6492Finally, you can apply the usual message-related functions (like <link
6493linkend="resend-message"><literal><resend-message></literal></link>,
6494and the <literal><reply></literal> and
6495<literal><forward></literal> functions) to attachments of type
6496<literal>message/rfc822</literal>.
6497</para>
6498
6499<para>
6500See table <xref linkend="tab-attachment-bindings"/> for all available
6501functions.
6502</para>
6503
6504</sect2>
6505
6506<sect2 id="compose-menu">
6507<title>The Compose Menu</title>
6508
6509<para>
6510The compose menu is the menu you see before you send a message. It
6511allows you to edit the recipient list, the subject, and other aspects of
6512your message. It also contains a list of the attachments of your
6513message, including the main body. From this menu, you can print, copy,
6514filter, pipe, edit, compose, review, and rename an attachment or a list
6515of tagged attachments. You can also modifying the attachment
6516information, notably the type, encoding and description.
6517</para>
6518
6519<para>
6520Attachments appear as follows by default:
6521</para>
6522
6523<screen>
6524- 1 [text/plain, 7bit, 1K] /tmp/mutt-euler-8082-0 <no description>
6525 2 [applica/x-gunzip, base64, 422K] ~/src/mutt-0.85.tar.gz <no description>
6526</screen>
6527
6528<para>
6529The <quote>-</quote> denotes that Mutt will delete the file after
6530sending (or postponing, or canceling) the message. It can be toggled
6531with the <literal><toggle-unlink></literal> command (default: u).
6532The next field is the MIME content-type, and can be changed with the
6533<literal><edit-type></literal> command (default: ^T). The next
6534field is the encoding for the attachment, which allows a binary message
6535to be encoded for transmission on 7bit links. It can be changed with
6536the <literal><edit-encoding></literal> command (default: ^E). The
6537next field is the size of the attachment, rounded to kilobytes or
6538megabytes. The next field is the filename, which can be changed with
6539the <literal><rename-file></literal> command (default: R). The
6540final field is the description of the attachment, and can be changed
6541with the <literal><edit-description></literal> command (default:
6542d). See <link linkend="attach-format">$attach_format</link> for a full
6543list of available expandos to format this display to your needs.
6544</para>
6545
6546</sect2>
6547
6548</sect1>
6549
6550<sect1 id="mime-types">
6551<title>MIME Type Configuration with <literal>mime.types</literal></title>
6552
6553<para>
6554To get most out of MIME, it's important that a MIME part's content type
6555matches the content as closely as possible so that the recipient's
6556client can automatically select the right viewer for the
6557content. However, there's no reliable for Mutt to know how to detect
6558every possible file type. Instead, it uses a simple plain text mapping
6559file that specifies what file extension corresponds to what MIME
6560type. This file is called <literal>mime.types</literal>.
6561</para>
6562
6563<para>
6564When you add an attachment to your mail message, Mutt searches your
6565personal <literal>mime.types</literal> file at
6566<literal>$HOME/.mime.types</literal>, and then the system
6567<literal>mime.types</literal> file at
6568<literal>/usr/local/share/mutt/mime.types</literal> or
6569<literal>/etc/mime.types</literal>
6570</para>
6571
6572<para>
6573Each line starts with the full MIME type, followed by a space and
6574space-separated list of file extensions. For example you could use:
6575</para>
6576
6577<example id="ex-mime-types">
6578<title><literal>mime.types</literal></title>
6579<screen>
6580application/postscript ps eps
6581application/pgp pgp
6582audio/x-aiff aif aifc aiff
6583</screen>
6584</example>
6585
6586<para>
6587A sample <literal>mime.types</literal> file comes with the Mutt
6588distribution, and should contain most of the MIME types you are likely
6589to use.
6590</para>
6591
6592<para>
6593If Mutt can not determine the MIME type by the extension of the file you
6594attach, it will look at the file. If the file is free of binary
6595information, Mutt will assume that the file is plain text, and mark it
6596as <literal>text/plain</literal>. If the file contains binary
6597information, then Mutt will mark it as
6598<literal>application/octet-stream</literal>. You can change the MIME
6599type that Mutt assigns to an attachment by using the
6600<literal><edit-type></literal> command from the compose menu
6601(default: ^T), see <xref linkend="supported-mime-types"/> for supported
6602major types. Mutt recognizes all of these if the appropriate entry is
6603found in the <literal>mime.types</literal> file. Non-recognized mime
6604types should only be used if the recipient of the message is likely to
6605be expecting such attachments.
6606</para>
6607
6608<table id="supported-mime-types">
6609<title>Supported MIME types</title>
6610<tgroup cols="3">
6611<thead>
6612<row><entry>MIME major type</entry><entry>Standard</entry><entry>Description</entry></row>
6613</thead>
6614<tbody>
6615<row><entry><literal>application</literal></entry><entry>yes</entry><entry>General application data</entry></row>
6616<row><entry><literal>audio</literal></entry><entry>yes</entry><entry>Audio data</entry></row>
6617<row><entry><literal>image</literal></entry><entry>yes</entry><entry>Image data</entry></row>
6618<row><entry><literal>message</literal></entry><entry>yes</entry><entry>Mail messages, message status information</entry></row>
6619<row><entry><literal>model</literal></entry><entry>yes</entry><entry>VRML and other modeling data</entry></row>
6620<row><entry><literal>multipart</literal></entry><entry>yes</entry><entry>Container for other MIME parts</entry></row>
6621<row><entry><literal>text</literal></entry><entry>yes</entry><entry>Text data</entry></row>
6622<row><entry><literal>video</literal></entry><entry>yes</entry><entry>Video data</entry></row>
6623<row><entry><literal>chemical</literal></entry><entry>no</entry><entry>Mostly molecular data</entry></row>
6624</tbody>
6625</tgroup>
6626</table>
6627
6628<para>
6629MIME types are not arbitrary, they need to be assigned by <ulink
6630url="http://www.iana.org/assignments/media-types/">IANA</ulink>.
6631</para>
6632
6633</sect1>
6634
6635<sect1 id="mailcap">
6636<title>MIME Viewer Configuration with Mailcap</title>
6637
6638<para>
6639Mutt supports RFC 1524 MIME Configuration, in particular the Unix
6640specific format specified in Appendix A of RFC 1524. This file format
6641is commonly referred to as the <quote>mailcap</quote> format. Many MIME
6642compliant programs utilize the mailcap format, allowing you to specify
6643handling for all MIME types in one place for all programs. Programs
6644known to use this format include Firefox, lynx and metamail.
6645</para>
6646
6647<para>
6648In order to handle various MIME types that Mutt doesn't have built-in
6649support for, it parses a series of external configuration files to find
6650an external handler. The default search string for these files is a
6651colon delimited list containing the following files:
6652</para>
6653
6654<orderedlist>
6655<listitem><para><literal>$HOME/.mailcap</literal></para></listitem>
6656<listitem><para><literal>$PKGDATADIR/mailcap</literal></para></listitem>
6657<listitem><para><literal>$SYSCONFDIR/mailcap</literal></para></listitem>
6658<listitem><para><literal>/etc/mailcap</literal></para></listitem>
6659<listitem><para><literal>/usr/etc/mailcap</literal></para></listitem>
6660<listitem><para><literal>/usr/local/etc/mailcap</literal></para></listitem>
6661</orderedlist>
6662
6663<para>
6664where <literal>$HOME</literal> is your home directory. The
6665<literal>$PKGDATADIR</literal> and the <literal>$SYSCONFDIR</literal>
6666directories depend on where Mutt is installed: the former is the default
6667for shared data, the latter for system configuration files.
6668</para>
6669
6670<para>
6671The default search path can be obtained by running the following
6672command:
6673</para>
6674
6675<screen>
6676mutt -nF /dev/null -Q mailcap_path
6677</screen>
6678
6679<para>
6680In particular, the metamail distribution will install a mailcap file,
6681usually as <literal>/usr/local/etc/mailcap</literal>, which contains
6682some baseline entries.
6683</para>
6684
6685<sect2 id="mailcap-basics">
6686<title>The Basics of the Mailcap File</title>
6687
6688<para>
6689A mailcap file consists of a series of lines which are comments, blank,
6690or definitions.
6691</para>
6692
6693<para>
6694A comment line consists of a # character followed by anything you want.
6695</para>
6696
6697<para>
6698A blank line is blank.
6699</para>
6700
6701<para>
6702A definition line consists of a content type, a view command, and any
6703number of optional fields. Each field of a definition line is divided
6704by a semicolon <quote>;</quote> character.
6705</para>
6706
6707<para>
6708The content type is specified in the MIME standard
6709<quote>type/subtype</quote> notation. For example,
6710<literal>text/plain</literal>, <literal>text/html</literal>,
6711<literal>image/gif</literal>, etc. In addition, the mailcap format
6712includes two formats for wildcards, one using the special
6713<quote>*</quote> subtype, the other is the implicit wild, where you only
6714include the major type. For example, <literal>image/*</literal>, or
6715<literal>video</literal> will match all image types and video types,
6716respectively.
6717</para>
6718
6719<para>
6720The view command is a Unix command for viewing the type specified. There
6721are two different types of commands supported. The default is to send
6722the body of the MIME message to the command on stdin. You can change
6723this behavior by using <literal>%s</literal> as a parameter to your view
6724command. This will cause Mutt to save the body of the MIME message to a
6725temporary file, and then call the view command with the
6726<literal>%s</literal> replaced by the name of the temporary file. In
6727both cases, Mutt will turn over the terminal to the view program until
6728the program quits, at which time Mutt will remove the temporary file if
6729it exists. This means that mailcap does <emphasis>not</emphasis> work
6730out of the box with programs which detach themselves from the terminal
6731right after starting, like <literal>open</literal> on Mac OS X. In order
6732to nevertheless use these programs with mailcap, you probably need
6733custom shell scripts.
6734</para>
6735
6736<para>
6737So, in the simplest form, you can send a <literal>text/plain</literal>
6738message to the external pager more on standard input:
6739</para>
6740
6741<screen>
6742text/plain; more
6743</screen>
6744
6745<para>
6746Or, you could send the message as a file:
6747</para>
6748
6749<screen>
6750text/plain; more %s
6751</screen>
6752
6753<para>
6754Perhaps you would like to use lynx to interactively view a
6755<literal>text/html</literal> message:
6756</para>
6757
6758<screen>
6759text/html; lynx %s
6760</screen>
6761
6762<para>
6763In this case, lynx does not support viewing a file from standard input,
6764so you must use the <literal>%s</literal> syntax.
6765</para>
6766
6767<note>
6768<para>
6769<emphasis>Some older versions of lynx contain a bug where they will
6770check the mailcap file for a viewer for <literal>text/html</literal>.
6771They will find the line which calls lynx, and run it. This causes lynx
6772to continuously spawn itself to view the object.</emphasis>
6773</para>
6774</note>
6775
6776<para>
6777On the other hand, maybe you don't want to use lynx interactively, you
6778just want to have it convert the <literal>text/html</literal> to
6779<literal>text/plain</literal>, then you can use:
6780</para>
6781
6782<screen>
6783text/html; lynx -dump %s | more
6784</screen>
6785
6786<para>
6787Perhaps you wish to use lynx to view <literal>text/html</literal> files,
6788and a pager on all other text formats, then you would use the following:
6789</para>
6790
6791<screen>
6792text/html; lynx %s
6793text/*; more
6794</screen>
6795
6796</sect2>
6797
6798<sect2 id="secure-mailcap">
6799<title>Secure Use of Mailcap</title>
6800
6801<para>
6802The interpretation of shell meta-characters embedded in MIME parameters
6803can lead to security problems in general. Mutt tries to quote
6804parameters in expansion of <literal>%s</literal> syntaxes properly, and
6805avoids risky characters by substituting them, see the <link
6806linkend="mailcap-sanitize">$mailcap_sanitize</link> variable.
6807</para>
6808
6809<para>
6810Although Mutt's procedures to invoke programs with mailcap seem to be
6811safe, there are other applications parsing mailcap, maybe taking less
6812care of it. Therefore you should pay attention to the following rules:
6813</para>
6814
6815<para>
6816<emphasis>Keep the %-expandos away from shell quoting.</emphasis> Don't
6817quote them with single or double quotes. Mutt does this for you, the
6818right way, as should any other program which interprets mailcap. Don't
6819put them into backtick expansions. Be highly careful with evil
6820statements, and avoid them if possible at all. Trying to fix broken
6821behavior with quotes introduces new leaks — there is no
6822alternative to correct quoting in the first place.
6823</para>
6824
6825<para>
6826If you have to use the %-expandos' values in context where you need
6827quoting or backtick expansions, put that value into a shell variable and
6828reference the shell variable where necessary, as in the following
6829example (using <literal>$charset</literal> inside the backtick expansion
6830is safe, since it is not itself subject to any further expansion):
6831</para>
6832
6833<screen>
6834text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \
6835 && test "`echo $charset | tr '[A-Z]' '[a-z]'`" != iso-8859-1
6836</screen>
6837
6838</sect2>
6839
6840<sect2 id="advanced-mailcap">
6841<title>Advanced Mailcap Usage</title>
6842
6843<sect3 id="optional-mailcap-fields">
6844<title>Optional Fields</title>
6845
6846<para>
6847In addition to the required content-type and view command fields, you
6848can add semi-colon <quote>;</quote> separated fields to set flags and
6849other options. Mutt recognizes the following optional fields:
6850</para>
6851
6852<variablelist>
6853
6854<varlistentry>
6855<term>copiousoutput</term>
6856<listitem>
6857<para>
6858This flag tells Mutt that the command passes possibly large amounts of
6859text on standard output. This causes Mutt to invoke a pager (either
6860the internal pager or the external pager defined by the pager variable)
6861on the output of the view command. Without this flag, Mutt assumes that
6862the command is interactive. One could use this to replace the pipe to
6863<literal>more</literal> in the <literal>lynx -dump</literal> example in
6864the Basic section:
6865</para>
6866
6867<screen>
6868text/html; lynx -dump %s ; copiousoutput
6869</screen>
6870
6871<para>
6872This will cause lynx to format the <literal>text/html</literal> output
6873as <literal>text/plain</literal> and Mutt will use your standard pager
6874to display the results.
6875</para>
6876
6877<para>
6878Mutt will set the <literal>COLUMNS</literal> environment variable to
6879the width of the pager. Some programs make use of this environment
6880variable automatically. Others provide a command line argument that
6881can use this to set the output width:
6882</para>
6883
6884<screen>
6885text/html; lynx -dump -width ${COLUMNS:-80} %s; copiousoutput
6886</screen>
6887
6888<para>
6889Note that when using the built-in pager, <emphasis>only</emphasis>
6890entries with this flag will be considered a handler for a MIME type
6891— all other entries will be ignored.
6892</para>
6893</listitem>
6894</varlistentry>
6895<varlistentry>
6896<term>needsterminal</term>
6897<listitem>
6898<para>
6899Mutt uses this flag when viewing attachments with <link
6900linkend="auto-view"><command>auto_view</command></link>, in order to
6901decide whether it should honor the setting of the <link
6902linkend="wait-key">$wait_key</link> variable or not. When an attachment
6903is viewed using an interactive program, and the corresponding mailcap
6904entry has a <emphasis>needsterminal</emphasis> flag, Mutt will use <link
6905linkend="wait-key">$wait_key</link> and the exit status of the program
6906to decide if it will ask you to press a key after the external program
6907has exited. In all other situations it will not prompt you for a key.
6908</para>
6909</listitem>
6910</varlistentry>
6911<varlistentry>
6912<term>compose=<command></term>
6913<listitem>
6914<para>
6915This flag specifies the command to use to create a new attachment of a
6916specific MIME type. Mutt supports this from the compose menu.
6917</para>
6918</listitem>
6919</varlistentry>
6920<varlistentry>
6921<term>composetyped=<command></term>
6922<listitem>
6923<para>
6924This flag specifies the command to use to create a new attachment of a
6925specific MIME type. This command differs from the compose command in
6926that Mutt will expect standard MIME headers on the data. This can be
6927used to specify parameters, filename, description, etc. for a new
6928attachment. Mutt supports this from the compose menu.
6929</para>
6930</listitem>
6931</varlistentry>
6932<varlistentry>
6933<term>print=<command></term>
6934<listitem>
6935<para>
6936This flag specifies the command to use to print a specific MIME type.
6937Mutt supports this from the attachment and compose menus.
6938</para>
6939</listitem>
6940</varlistentry>
6941<varlistentry>
6942<term>edit=<command></term>
6943<listitem>
6944<para>
6945This flag specifies the command to use to edit a specific MIME type.
6946Mutt supports this from the compose menu, and also uses it to compose
6947new attachments. Mutt will default to the defined <link
6948linkend="editor">$editor</link> for text attachments.
6949</para>
6950</listitem>
6951</varlistentry>
6952<varlistentry>
6953<term>nametemplate=<template></term>
6954<listitem>
6955<para>
6956This field specifies the format for the file denoted by
6957<literal>%s</literal> in the command fields. Certain programs will
6958require a certain file extension, for instance, to correctly view a
6959file. For instance, lynx will only interpret a file as
6960<literal>text/html</literal> if the file ends in
6961<literal>.html</literal>. So, you would specify lynx as a
6962<literal>text/html</literal> viewer with a line in the mailcap file
6963like:
6964</para>
6965
6966<screen>
6967text/html; lynx %s; nametemplate=%s.html
6968</screen>
6969
6970</listitem>
6971</varlistentry>
6972<varlistentry>
6973<term>test=<command></term>
6974<listitem>
6975<para>
6976This field specifies a command to run to test whether this mailcap entry
6977should be used. The command is defined with the command expansion rules
6978defined in the next section. If the command returns 0, then the test
6979passed, and Mutt uses this entry. If the command returns non-zero, then
6980the test failed, and Mutt continues searching for the right entry. Note
6981that the content-type must match before Mutt performs the test. For
6982example:
6983</para>
6984
6985<screen>
6986text/html; firefox -remote 'openURL(%s)' ; test=RunningX
6987text/html; lynx %s
6988</screen>
6989
6990<para>
6991In this example, Mutt will run the program <literal>RunningX</literal>
6992which will return 0 if the X Window manager is running, and non-zero if
6993it isn't. If <literal>RunningX</literal> returns 0, then Mutt will run
6994firefox to display the <literal>text/html</literal> object. If RunningX
6995doesn't return 0, then Mutt will go on to the next entry and use lynx to
6996display the <literal>text/html</literal> object.
6997</para>
6998</listitem>
6999</varlistentry>
7000</variablelist>
7001
7002</sect3>
7003
7004<sect3 id="mailcap-search-order">
7005<title>Search Order</title>
7006
7007<para>
7008When searching for an entry in the mailcap file, Mutt will search for
7009the most useful entry for its purpose. For instance, if you are
7010attempting to print an <literal>image/gif</literal>, and you have the
7011following entries in your mailcap file, Mutt will search for an entry
7012with the print command:
7013</para>
7014
7015<screen>
7016image/*; xv %s
7017image/gif; ; print= anytopnm %s | pnmtops | lpr; \
7018 nametemplate=%s.gif
7019</screen>
7020
7021<para>
7022Mutt will skip the <literal>image/*</literal> entry and use the
7023<literal>image/gif</literal> entry with the print command.
7024</para>
7025
7026<para>
7027In addition, you can use this with <link
7028linkend="auto-view"><command>auto_view</command></link> to denote two
7029commands for viewing an attachment, one to be viewed automatically, the
7030other to be viewed interactively from the attachment menu using the
7031<literal><view-mailcap></literal> function (bound to
7032<quote>m</quote> by default). In addition, you can then use the test
7033feature to determine which viewer to use interactively depending on your
7034environment.
7035</para>
7036
7037<screen>
7038text/html; firefox -remote 'openURL(%s)' ; test=RunningX
7039text/html; lynx %s; nametemplate=%s.html
7040text/html; lynx -dump %s; nametemplate=%s.html; copiousoutput
7041</screen>
7042
7043<para>
7044For <link linkend="auto-view"><command>auto_view</command></link>, Mutt
7045will choose the third entry because of the
7046<literal>copiousoutput</literal> tag. For interactive viewing, Mutt
7047will run the program <literal>RunningX</literal> to determine if it
7048should use the first entry. If the program returns non-zero, Mutt will
7049use the second entry for interactive viewing. The last entry is for
7050inline display in the pager and the
7051<literal><view-attach></literal> function in the attachment menu.
7052</para>
7053
7054<para>
7055Entries with the <literal>copiousoutput</literal> tag should always be
7056specified as the last one per type. For non-interactive use, the last
7057entry will then actually be the first matching one with the tag set.
7058For non-interactive use, only <literal>copiousoutput</literal>-tagged
7059entries are considered. For interactive use, Mutt ignores this tag and
7060treats all entries equally. Therefore, if not specified last, all
7061following entries without this tag would never be considered for
7062<literal><view-attach></literal> because the
7063<literal>copiousoutput</literal> before them matched already.
7064</para>
7065
7066</sect3>
7067
7068<sect3 id="mailcap-command-expansion">
7069<title>Command Expansion</title>
7070
7071<para>
7072The various commands defined in the mailcap files are passed to the
7073<literal>/bin/sh</literal> shell using the <literal>system(3)</literal>
7074function. Before the command is passed to <literal>/bin/sh
7075-c</literal>, it is parsed to expand various special parameters with
7076information from Mutt. The keywords Mutt expands are:
7077</para>
7078
7079<variablelist>
7080
7081<varlistentry>
7082<term>%s</term>
7083<listitem>
7084<para>
7085As seen in the basic mailcap section, this variable is expanded to a
7086filename specified by the calling program. This file contains the body
7087of the message to view/print/edit or where the composing program should
7088place the results of composition. In addition, the use of this keyword
7089causes Mutt to not pass the body of the message to the view/print/edit
7090program on stdin.
7091</para>
7092</listitem>
7093</varlistentry>
7094<varlistentry>
7095<term>%t</term>
7096<listitem>
7097<para>
7098Mutt will expand <literal>%t</literal> to the text representation of the
7099content type of the message in the same form as the first parameter of
7100the mailcap definition line, i.e. <literal>text/html</literal> or
7101<literal>image/gif</literal>.
7102</para>
7103</listitem>
7104</varlistentry>
7105<varlistentry>
7106<term>%{<parameter>}</term>
7107<listitem>
7108<para>
7109Mutt will expand this to the value of the specified parameter from the
7110Content-Type: line of the mail message. For instance, if your mail
7111message contains:
7112</para>
7113
7114<screen>
7115Content-Type: text/plain; charset=iso-8859-1
7116</screen>
7117
7118<para>
7119then Mutt will expand <literal>%{charset}</literal> to
7120<quote>iso-8859-1</quote>. The default metamail mailcap file uses this
7121feature to test the charset to spawn an xterm using the right charset to
7122view the message.
7123</para>
7124</listitem>
7125</varlistentry>
7126<varlistentry>
7127<term>\%</term>
7128<listitem>
7129<para>
7130This will be replaced by a literal <literal>%</literal>.
7131</para>
7132</listitem>
7133</varlistentry>
7134</variablelist>
7135
7136<para>
7137Mutt does not currently support the <literal>%F</literal> and
7138<literal>%n</literal> keywords specified in RFC 1524. The main purpose
7139of these parameters is for multipart messages, which is handled
7140internally by Mutt.
7141</para>
7142
7143</sect3>
7144
7145</sect2>
7146
7147<sect2 id="mailcap-example">
7148<title>Example Mailcap Files</title>
7149
7150<para>
7151This mailcap file is fairly simple and standard:
7152</para>
7153
7154<screen>
7155<emphasis role="comment"># I'm always running X :)</emphasis>
7156video/*; xanim %s > /dev/null
7157image/*; xv %s > /dev/null
7158
7159<emphasis role="comment"># I'm always running firefox (if my computer had more memory, maybe)</emphasis>
7160text/html; firefox -remote 'openURL(%s)'
7161</screen>
7162
7163<para>
7164This mailcap file shows quite a number of examples:
7165</para>
7166
7167<screen>
7168<emphasis role="comment"># Use xanim to view all videos Xanim produces a header on startup,
7169# send that to /dev/null so I don't see it</emphasis>
7170video/*; xanim %s > /dev/null
7171
7172<emphasis role="comment"># Send html to a running firefox by remote</emphasis>
7173text/html; firefox -remote 'openURL(%s)'; test=RunningFirefox
7174
7175<emphasis role="comment"># If I'm not running firefox but I am running X, start firefox on the
7176# object</emphasis>
7177text/html; firefox %s; test=RunningX
7178
7179<emphasis role="comment"># Else use lynx to view it as text</emphasis>
7180text/html; lynx %s
7181
7182<emphasis role="comment"># This version would convert the text/html to text/plain</emphasis>
7183text/html; lynx -dump %s; copiousoutput
7184
7185<emphasis role="comment"># I use enscript to print text in two columns to a page</emphasis>
7186text/*; more %s; print=enscript -2Gr %s
7187
7188<emphasis role="comment"># Firefox adds a flag to tell itself to view jpegs internally</emphasis>
7189image/jpeg;xv %s; x-mozilla-flags=internal
7190
7191<emphasis role="comment"># Use xv to view images if I'm running X</emphasis>
7192<emphasis role="comment"># In addition, this uses the \ to extend the line and set my editor</emphasis>
7193<emphasis role="comment"># for images</emphasis>
7194image/*;xv %s; test=RunningX; \
7195 edit=xpaint %s
7196
7197<emphasis role="comment"># Convert images to text using the netpbm tools</emphasis>
7198image/*; (anytopnm %s | pnmscale -xysize 80 46 | ppmtopgm | pgmtopbm |
7199pbmtoascii -1x2 ) 2>&1 ; copiousoutput
7200
7201<emphasis role="comment"># Send excel spreadsheets to my NT box</emphasis>
7202application/ms-excel; open.pl %s
7203</screen>
7204
7205</sect2>
7206
7207</sect1>
7208
7209<sect1 id="auto-view">
7210<title>MIME Autoview</title>
7211
7212<para>
7213Usage:
7214</para>
7215
7216<cmdsynopsis>
7217<command>auto_view</command>
7218<arg choice="plain">
7219<replaceable>mimetype</replaceable>
7220</arg>
7221<arg choice="opt" rep="repeat">
7222<replaceable>mimetype</replaceable>
7223</arg>
7224
7225<command>unauto_view</command>
7226<group choice="req">
7227<arg choice="plain">
7228<replaceable>*</replaceable>
7229</arg>
7230<arg choice="plain" rep="repeat">
7231<replaceable>mimetype</replaceable>
7232</arg>
7233</group>
7234</cmdsynopsis>
7235
7236<para>
7237In addition to explicitly telling Mutt to view an attachment with the
7238MIME viewer defined in the mailcap file from the attachments menu, Mutt
7239has support for automatically viewing MIME attachments while in the
7240pager.
7241</para>
7242
7243<para>
7244For this to work, you must define a viewer in the mailcap file which
7245uses the <literal>copiousoutput</literal> option to denote that it is
7246non-interactive. Usually, you also use the entry to convert the
7247attachment to a text representation which you can view in the pager.
7248</para>
7249
7250<para>
7251You then use the <command>auto_view</command> configuration command to
7252list the content-types that you wish to view automatically. For
7253instance, if you set it to:
7254</para>
7255
7256<screen>
7257auto_view text/html application/x-gunzip \
7258 application/postscript image/gif application/x-tar-gz
7259</screen>
7260
7261<para>
7262...Mutt would try to find corresponding entries for rendering
7263attachments of these types as text. A corresponding mailcap could look
7264like:
7265</para>
7266
7267<screen>
7268text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
7269image/*; anytopnm %s | pnmscale -xsize 80 -ysize 50 | ppmtopgm | \
7270 pgmtopbm | pbmtoascii ; copiousoutput
7271application/x-gunzip; gzcat; copiousoutput
7272application/x-tar-gz; gunzip -c %s | tar -tf - ; copiousoutput
7273application/postscript; ps2ascii %s; copiousoutput
7274</screen>
7275
7276<para>
7277<command>unauto_view</command> can be used to remove previous entries
7278from the <command>auto_view</command> list. This can be used with <link
7279linkend="message-hook"><command>message-hook</command></link> to
7280autoview messages based on size, etc.
7281<quote><command>unauto_view</command> *</quote> will remove all previous
7282entries.
7283</para>
7284
7285</sect1>
7286
7287<sect1 id="alternative-order">
7288<title>MIME Multipart/Alternative</title>
7289
7290<para>
7291The <literal>multipart/alternative</literal> container type only has
7292child MIME parts which represent the same content in an alternative
7293way. This is often used to send HTML messages which contain an
7294alternative plain text representation.
7295</para>
7296
7297<para>
7298Mutt has some heuristics for determining which attachment of a
7299<literal>multipart/alternative</literal> type to display:
7300</para>
7301
7302<orderedlist>
7303<listitem>
7304<para>
7305First, Mutt will check the <command>alternative_order</command> list to
7306determine if one of the available types is preferred. It consists of a
7307number of MIME types in order, including support for implicit and
7308explicit wildcards. For example:
7309</para>
7310
7311<screen>
7312alternative_order text/enriched text/plain text \
7313 application/postscript image/*
7314</screen>
7315</listitem>
7316<listitem>
7317<para>
7318Next, Mutt will check if any of the types have a defined <link
7319linkend="auto-view"><command>auto_view</command></link>, and use that.
7320</para>
7321</listitem>
7322<listitem>
7323<para>
7324Failing that, Mutt will look for any text type.
7325</para>
7326</listitem>
7327<listitem>
7328<para>
7329As a last attempt, Mutt will look for any type it knows how to handle.
7330</para>
7331</listitem>
7332</orderedlist>
7333
7334<para>
7335To remove a MIME type from the <command>alternative_order</command>
7336list, use the <command>unalternative_order</command> command.
7337</para>
7338
7339</sect1>
7340
7341<sect1 id="attachments">
7342<title>Attachment Searching and Counting</title>
7343
7344<para>
7345If you ever lose track of attachments in your mailboxes, Mutt's
7346attachment-counting and -searching support might be for you. You can
7347make your message index display the number of qualifying attachments in
7348each message, or search for messages by attachment count. You also can
7349configure what kinds of attachments qualify for this feature with the
7350<command>attachments</command> and <command>unattachments</command>
7351commands.
7352</para>
7353
7354<para>
7355In order to provide this information, Mutt needs to fully MIME-parse all
7356messages affected first. This can slow down operation especially for
7357remote mail folders such as IMAP because all messages have to be
7358downloaded first regardless whether the user really wants to view them
7359or not though using <xref linkend="body-caching"/> usually means to
7360download the message just once.
7361</para>
7362
7363<para>
7364The syntax is:
7365</para>
7366
7367<cmdsynopsis>
7368<command>attachments</command>
7369<arg choice="plain">
7370<replaceable>{ + | - }disposition</replaceable>
7371</arg>
7372<arg choice="plain">
7373<replaceable>mime-type</replaceable>
7374</arg>
7375
7376<command>unattachments</command>
7377<arg choice="plain">
7378<replaceable>{ + | - }disposition</replaceable>
7379</arg>
7380<arg choice="plain">
7381<replaceable>mime-type</replaceable>
7382</arg>
7383
7384<command>attachments</command>
7385<arg choice="plain">
7386<replaceable>?</replaceable>
7387</arg>
7388</cmdsynopsis>
7389
7390<para>
7391<emphasis>disposition</emphasis> is the attachment's Content-Disposition
7392type — either <literal>inline</literal> or
7393<literal>attachment</literal>. You can abbreviate this to
7394<literal>I</literal> or <literal>A</literal>.
7395</para>
7396
7397<para>
7398Disposition is prefixed by either a <quote>+</quote> symbol or a
7399<quote>-</quote> symbol. If it's a <quote>+</quote>, you're saying that
7400you want to allow this disposition and MIME type to qualify. If it's a
7401<quote>-</quote>, you're saying that this disposition and MIME type is
7402an exception to previous <quote>+</quote> rules. There are examples
7403below of how this is useful.
7404</para>
7405
7406<para>
7407<emphasis>mime-type</emphasis> is the MIME type of the attachment you
7408want the command to affect. A MIME type is always of the format
7409<literal>major/minor</literal>, where <literal>major</literal> describes
7410the broad category of document you're looking at, and
7411<literal>minor</literal> describes the specific type within that
7412category. The major part of mime-type must be literal text (or the
7413special token <quote><literal>*</literal></quote>), but the minor part
7414may be a regular expression. (Therefore,
7415<quote><literal>*/.*</literal></quote> matches any MIME type.)
7416</para>
7417
7418<para>
7419The MIME types you give to the <command>attachments</command> directive
7420are a kind of pattern. When you use the <command>attachments</command>
7421directive, the patterns you specify are added to a list. When you use
7422<command>unattachments</command>, the pattern is removed from the list.
7423The patterns are not expanded and matched to specific MIME types at this
7424time — they're just text in a list. They're only matched when
7425actually evaluating a message.
7426</para>
7427
7428<para>
7429Some examples might help to illustrate. The examples that are not
7430commented out define the default configuration of the lists.
7431</para>
7432
7433<example id="ex-attach-count">
7434<title>Attachment counting</title>
7435<screen>
7436<emphasis role="comment">
7437# Removing a pattern from a list removes that pattern literally. It
7438# does not remove any type matching the pattern.
7439#
7440# attachments +A */.*
7441# attachments +A image/jpeg
7442# unattachments +A */.*
7443#
7444# This leaves "attached" image/jpeg files on the allowed attachments
7445# list. It does not remove all items, as you might expect, because the
7446# second */.* is not a matching expression at this time.
7447#
7448# Remember: "unattachments" only undoes what "attachments" has done!
7449# It does not trigger any matching on actual messages.
7450
7451# Qualify any MIME part with an "attachment" disposition, EXCEPT for
7452# text/x-vcard and application/pgp parts. (PGP parts are already known
7453# to mutt, and can be searched for with ~g, ~G, and ~k.)
7454#
7455# I've added x-pkcs7 to this, since it functions (for S/MIME)
7456# analogously to PGP signature attachments. S/MIME isn't supported
7457# in a stock mutt build, but we can still treat it specially here.
7458#
7459</emphasis>
7460attachments +A */.*
7461attachments -A text/x-vcard application/pgp.*
7462attachments -A application/x-pkcs7-.*
7463
7464<emphasis role="comment">
7465# Discount all MIME parts with an "inline" disposition, unless they're
7466# text/plain. (Why inline a text/plain part unless it's external to the
7467# message flow?)
7468</emphasis>
7469attachments +I text/plain
7470
7471<emphasis role="comment">
7472# These two lines make Mutt qualify MIME containers. (So, for example,
7473# a message/rfc822 forward will count as an attachment.) The first
7474# line is unnecessary if you already have "attach-allow */.*", of
7475# course. These are off by default! The MIME elements contained
7476# within a message/* or multipart/* are still examined, even if the
7477# containers themselves don't qualify.
7478
7479#attachments +A message/.* multipart/.*
7480#attachments +I message/.* multipart/.*
7481</emphasis>
7482
7483<emphasis role="comment">## You probably don't really care to know about deleted attachments.</emphasis>
7484attachments -A message/external-body
7485attachments -I message/external-body
7486</screen>
7487</example>
7488
7489<para>
7490Entering the command <quote><command>attachments</command> ?</quote> as
7491a command will list your current settings in Muttrc format, so that it
7492can be pasted elsewhere.
7493</para>
7494
7495</sect1>
7496
7497<sect1 id="mime-lookup">
7498<title>MIME Lookup</title>
7499
7500<para>
7501Usage:
7502</para>
7503
7504<cmdsynopsis>
7505<command>mime_lookup</command>
7506<arg choice="plain">
7507<replaceable>mimetype</replaceable>
7508</arg>
7509<arg choice="opt" rep="repeat">
7510<replaceable>mimetype</replaceable>
7511</arg>
7512
7513<command>unmime_lookup</command>
7514<group choice="req">
7515<arg choice="plain">
7516<replaceable>*</replaceable>
7517</arg>
7518<arg choice="plain" rep="repeat">
7519<replaceable>mimetype</replaceable>
7520</arg>
7521</group>
7522</cmdsynopsis>
7523
7524<para>
7525Mutt's <command>mime_lookup</command> list specifies a list of MIME
7526types that should <emphasis>not</emphasis> be treated according to their
7527mailcap entry. This option is designed to deal with binary types such
7528as <literal>application/octet-stream</literal>. When an attachment's
7529MIME type is listed in <command>mime_lookup</command>, then the
7530extension of the filename will be compared to the list of extensions in
7531the <literal>mime.types</literal> file. The MIME type associated with
7532this extension will then be used to process the attachment according to
7533the rules in the mailcap file and according to any other configuration
7534options (such as <command>auto_view</command>) specified. Common usage
7535would be:
7536</para>
7537
7538<screen>
7539mime_lookup application/octet-stream application/X-Lotus-Manuscript
7540</screen>
7541
7542<para>
7543In addition, the <literal>unmime_lookup</literal> command may be used to
7544disable this feature for any particular MIME type if it had been set,
7545for example, in a global <literal>.muttrc</literal>.
7546</para>
7547
7548</sect1>
7549
7550</chapter>
7551
7552<chapter id="optionalfeatures">
7553<title>Optional Features</title>
7554
7555<sect1 id="optionalfeatures-notes">
7556<title>General Notes</title>
7557
7558<sect2 id="compile-time-features">
7559<title>Enabling/Disabling Features</title>
7560
7561<para>
7562Mutt supports several of optional features which can be enabled or
7563disabled at compile-time by giving the <emphasis>configure</emphasis>
7564script certain arguments. These are listed in the <quote>Optional
7565features</quote> section of the <emphasis>configure --help</emphasis>
7566output.
7567</para>
7568
7569<para>
7570Which features are enabled or disabled can later be determined from the
7571output of <literal>mutt -v</literal>. If a compile option starts with
7572<quote>+</quote> it is enabled and disabled if prefixed with
7573<quote>-</quote>. For example, if Mutt was compiled using GnuTLS for
7574encrypted communication instead of OpenSSL, <literal>mutt -v</literal>
7575would contain:
7576</para>
7577
7578<screen>
7579-USE_SSL_OPENSSL +USE_SSL_GNUTLS</screen>
7580
7581</sect2>
7582
7583<sect2 id="url-syntax">
7584<title>URL Syntax</title>
7585
7586<para>
7587Mutt optionally supports the IMAP, POP3 and SMTP protocols which require
7588to access servers using URLs. The canonical syntax for specifying URLs
7589in Mutt is (an item enclosed in <literal>[]</literal> means it is
7590optional and may be omitted):
7591</para>
7592
7593<screen>
7594proto[s]://[username[:password]@]server[:port][/path]
7595</screen>
7596
7597<para>
7598<emphasis>proto</emphasis> is the communication protocol:
7599<literal>imap</literal> for IMAP, <literal>pop</literal> for POP3 and
7600<literal>smtp</literal> for SMTP. If <quote>s</quote> for <quote>secure
7601communication</quote> is appended, Mutt will attempt to establish an
7602encrypted communication using SSL or TLS.
7603</para>
7604
7605<para>
7606Since all protocols supported by Mutt support/require authentication,
7607login credentials may be specified in the URL. This has the advantage
7608that multiple IMAP, POP3 or SMTP servers may be specified (which isn't
7609possible using, for example, <link
7610linkend="imap-user">$imap_user</link>). The username may contain the
7611<quote>@</quote> symbol being used by many mail systems as part of the
7612login name. The special characters <quote>/</quote>
7613(<literal>%2F</literal>), <quote>:</quote> (<literal>%3A</literal>) and
7614<quote>%</quote> (<literal>%25</literal>) have to be URL-encoded in
7615usernames using the <literal>%</literal>-notation.
7616</para>
7617
7618<para>
7619A password can be given, too but is not recommended if the URL is
7620specified in a configuration file on disk.
7621</para>
7622
7623<para>
7624If no port number is given, Mutt will use the system's default for the
7625given protocol (usually consulting <literal>/etc/services</literal>).
7626</para>
7627
7628<para>
7629The optional path is only relevant for IMAP and ignored elsewhere.
7630</para>
7631
7632<example id="ex-url">
7633<title>URLs</title>
7634<screen>
7635pops://host/
7636imaps://user@host/INBOX/Sent
7637smtp://user@host:587/
7638</screen>
7639</example>
7640
7641</sect2>
7642
7643</sect1>
7644
7645<sect1 id="ssl">
7646<title>SSL/TLS Support</title>
7647
7648<para>
7649If Mutt is compiled with IMAP, POP3 and/or SMTP support, it can also be
7650compiled with support for SSL or TLS using either OpenSSL or GnuTLS ( by
7651running the <emphasis>configure</emphasis> script with the
7652<emphasis>--enable-ssl=...</emphasis> option for OpenSSL or
7653<emphasis>--enable-gnutls=...</emphasis> for GnuTLS). Mutt can then
7654attempt to encrypt communication with remote servers if these protocols
7655are suffixed with <quote>s</quote> for <quote>secure
7656communication</quote>.
7657</para>
7658
7659</sect1>
7660
7661<sect1 id="pop">
7662<title>POP3 Support</title>
7663
7664<para>
7665If Mutt is compiled with POP3 support (by running the
7666<emphasis>configure</emphasis> script with the
7667<emphasis>--enable-pop</emphasis> flag), it has the ability to work with
7668mailboxes located on a remote POP3 server and fetch mail for local
7669browsing.
7670</para>
7671
7672<para>
7673Remote POP3 servers can be accessed using URLs with the
7674<literal>pop</literal> protocol for unencrypted and
7675<literal>pops</literal> for encrypted communication, see <xref
7676linkend="url-syntax"/> for details.
7677</para>
7678
7679<para>
7680Polling for new mail is more expensive over POP3 than locally. For this
7681reason the frequency at which Mutt will check for mail remotely can be
7682controlled by the <link
7683linkend="pop-checkinterval">$pop_checkinterval</link> variable, which
7684defaults to every 60 seconds.
7685</para>
7686
7687<para>
7688POP is read-only which doesn't allow for some features like editing
7689messages or changing flags. However, using <xref
7690linkend="header-caching"/> and <xref linkend="body-caching"/> Mutt
7691simulates the new/old/read flags as well as flagged and replied. Mutt
7692applies some logic on top of remote messages but cannot change them so
7693that modifications of flags are lost when messages are downloaded from
7694the POP server (either by Mutt or other tools).
7695</para>
7696
7697<anchor id="fetch-mail"/>
7698<para>
7699Another way to access your POP3 mail is the
7700<literal><fetch-mail></literal> function (default: G). It allows
7701to connect to <link linkend="pop-host">$pop_host</link>, fetch all your
7702new mail and place it in the local <link
7703linkend="spoolfile">$spoolfile</link>. After this point, Mutt runs
7704exactly as if the mail had always been local.
7705</para>
7706
7707<note>
7708<para>
7709If you only need to fetch all messages to a local mailbox you should
7710consider using a specialized program, such as
7711<literal>fetchmail(1)</literal>, <literal>getmail(1)</literal> or
7712similar.
7713</para>
7714</note>
7715
7716</sect1>
7717
7718<sect1 id="imap">
7719<title>IMAP Support</title>
7720
7721<para>
7722If Mutt was compiled with IMAP support (by running the
7723<emphasis>configure</emphasis> script with the
7724<emphasis>--enable-imap</emphasis> flag), it has the ability to work
7725with folders located on a remote IMAP server.
7726</para>
7727
7728<para>
7729You can access the remote inbox by selecting the folder by its URL (see
7730<xref linkend="url-syntax"/> for details) using the
7731<literal>imap</literal> or <literal>imaps</literal> protocol.
7732Alternatively, a pine-compatible notation is also supported, i.e.
7733<literal>{[username@]imapserver[:port][/ssl]}path/to/folder</literal>
7734</para>
7735
7736<para>
7737Note that not all servers use <quote>/</quote> as the hierarchy
7738separator. Mutt should correctly notice which separator is being used
7739by the server and convert paths accordingly.
7740</para>
7741
7742<para>
7743When browsing folders on an IMAP server, you can toggle whether to look
7744at only the folders you are subscribed to, or all folders with the
7745<emphasis>toggle-subscribed</emphasis> command. See also the <link
7746linkend="imap-list-subscribed">$imap_list_subscribed</link> variable.
7747</para>
7748
7749<para>
7750Polling for new mail on an IMAP server can cause noticeable delays. So,
7751you'll want to carefully tune the <link
7752linkend="mail-check">$mail_check</link> and <link
7753linkend="timeout">$timeout</link> variables. Reasonable values are:
7754</para>
7755
7756<screen>
7757set mail_check=90
7758set timeout=15
7759</screen>
7760
7761<para>
7762with relatively good results even over slow modem lines.
7763</para>
7764
7765<note>
7766<para>
7767Note that if you are using mbox as the mail store on UW servers prior to
7768v12.250, the server has been reported to disconnect a client if another
7769client selects the same folder.
7770</para>
7771</note>
7772
7773<sect2 id="imap-browser">
7774<title>The IMAP Folder Browser</title>
7775
7776<para>
7777As of version 1.2, Mutt supports browsing mailboxes on an IMAP
7778server. This is mostly the same as the local file browser, with the
7779following differences:
7780</para>
7781
7782<itemizedlist>
7783<listitem>
7784
7785<para>
7786In lieu of file permissions, Mutt displays the string
7787<quote>IMAP</quote>, possibly followed by the symbol <quote>+</quote>,
7788indicating that the entry contains both messages and subfolders. On
7789Cyrus-like servers folders will often contain both messages and
7790subfolders.
7791</para>
7792</listitem>
7793<listitem>
7794
7795<para>
7796For the case where an entry can contain both messages and subfolders,
7797the selection key (bound to <literal>enter</literal> by default) will
7798choose to descend into the subfolder view. If you wish to view the
7799messages in that folder, you must use <literal>view-file</literal>
7800instead (bound to <literal>space</literal> by default).
7801</para>
7802</listitem>
7803<listitem>
7804
7805<para>
7806You can create, delete and rename mailboxes with the
7807<literal><create-mailbox></literal>,
7808<literal><delete-mailbox></literal>, and
7809<literal><rename-mailbox></literal> commands (default bindings:
7810<literal>C</literal>, <literal>d</literal> and <literal>r</literal>,
7811respectively). You may also <literal><subscribe></literal> and
7812<literal><unsubscribe></literal> to mailboxes (normally these are
7813bound to <literal>s</literal> and <literal>u</literal>, respectively).
7814</para>
7815</listitem>
7816
7817</itemizedlist>
7818
7819</sect2>
7820
7821<sect2 id="imap-authentication">
7822<title>Authentication</title>
7823
7824<para>
7825Mutt supports four authentication methods with IMAP servers: SASL,
7826GSSAPI, CRAM-MD5, and LOGIN (there is a patch by Grant Edwards to add
7827NTLM authentication for you poor exchange users out there, but it has
7828yet to be integrated into the main tree). There is also support for the
7829pseudo-protocol ANONYMOUS, which allows you to log in to a public IMAP
7830server without having an account. To use ANONYMOUS, simply make your
7831username blank or <quote>anonymous</quote>.
7832</para>
7833
7834<para>
7835SASL is a special super-authenticator, which selects among several
7836protocols (including GSSAPI, CRAM-MD5, ANONYMOUS, and DIGEST-MD5) the
7837most secure method available on your host and the server. Using some of
7838these methods (including DIGEST-MD5 and possibly GSSAPI), your entire
7839session will be encrypted and invisible to those teeming network
7840snoops. It is the best option if you have it. To use it, you must have
7841the Cyrus SASL library installed on your system and compile Mutt with
7842the <emphasis>--with-sasl</emphasis> flag.
7843</para>
7844
7845<para>
7846Mutt will try whichever methods are compiled in and available on the
7847server, in the following order: SASL, ANONYMOUS, GSSAPI, CRAM-MD5,
7848LOGIN.
7849</para>
7850
7851<para>
7852There are a few variables which control authentication:
7853</para>
7854
7855<itemizedlist>
7856<listitem>
7857
7858<para>
7859<link linkend="imap-user">$imap_user</link> - controls the username
7860under which you request authentication on the IMAP server, for all
7861authenticators. This is overridden by an explicit username in the
7862mailbox path (i.e. by using a mailbox name of the form
7863<literal>{user@host}</literal>).
7864</para>
7865</listitem>
7866<listitem>
7867
7868<para>
7869<link linkend="imap-pass">$imap_pass</link> - a password which you may
7870preset, used by all authentication methods where a password is needed.
7871</para>
7872</listitem>
7873<listitem>
7874
7875<para>
7876<link linkend="imap-authenticators">$imap_authenticators</link> - a
7877colon-delimited list of IMAP authentication methods to try, in the order
7878you wish to try them. If specified, this overrides Mutt's default
7879(attempt everything, in the order listed above).
7880</para>
7881</listitem>
7882
7883</itemizedlist>
7884
7885</sect2>
7886
7887</sect1>
7888
7889<sect1 id="smtp">
7890<title>SMTP Support</title>
7891
7892<para>
7893Besides supporting traditional mail delivery through a
7894sendmail-compatible program, Mutt supports delivery through SMTP if it
7895was configured and built with <literal>--enable-smtp</literal>.
7896</para>
7897
7898<para>
7899If the configuration variable <link linkend="smtp-url">$smtp_url</link>
7900is set, Mutt will contact the given SMTP server to deliver messages; if
7901it is unset, Mutt will use the program specified by <link
7902linkend="sendmail">$sendmail</link>.
7903</para>
7904
7905<para>
7906For details on the URL syntax, please see <xref linkend="url-syntax"/>.
7907</para>
7908
7909<para>
7910The built-in SMTP support supports encryption (the
7911<literal>smtps</literal> protocol using SSL or TLS) as well as SMTP
7912authentication using SASL. The authentication mechanisms for SASL are
7913specified in <link
7914linkend="smtp-authenticators">$smtp_authenticators</link> defaulting to
7915an empty list which makes Mutt try all available methods from
7916most-secure to least-secure.
7917</para>
7918
7919</sect1>
7920
7921<sect1 id="account-hook">
7922<title>Managing Multiple Accounts</title>
7923
7924<para>
7925Usage:
7926</para>
7927
7928<cmdsynopsis>
7929<command>account-hook</command>
7930<arg choice="plain">
7931<replaceable class="parameter">regexp</replaceable>
7932</arg>
7933<arg choice="plain">
7934<replaceable class="parameter">command</replaceable>
7935</arg>
7936</cmdsynopsis>
7937
7938<para>
7939If you happen to have accounts on multiple IMAP, POP and/or SMTP
7940servers, you may find managing all the authentication settings
7941inconvenient and error-prone. The <link
7942linkend="account-hook"><command>account-hook</command></link> command
7943may help. This hook works like <link
7944linkend="folder-hook"><command>folder-hook</command></link> but is
7945invoked whenever Mutt needs to access a remote mailbox (including inside
7946the folder browser), not just when you open the mailbox. This includes
7947(for example) polling for new mail, storing Fcc messages and saving
7948messages to a folder. As a consequence, <link
7949linkend="account-hook"><command>account-hook</command></link> should
7950only be used to set connection-related settings such as passwords or
7951tunnel commands but not settings such as sender address or name (because
7952in general it should be considered unpredictable which <link
7953linkend="account-hook"><command>account-hook</command></link> was last
7954used).
7955</para>
7956
7957<para>
7958Some examples:
7959</para>
7960
7961<screen>
7962account-hook . 'unset imap_user; unset imap_pass; unset tunnel'
7963account-hook imap://host1/ 'set imap_user=me1 imap_pass=foo'
7964account-hook imap://host2/ 'set tunnel="ssh host2 /usr/libexec/imapd"'
7965account-hook smtp://user@host3/ 'set tunnel="ssh host3 /usr/libexec/smtpd"'
7966</screen>
7967
7968<para>
7969To manage multiple accounts with, for example, different values of <link
7970linkend="record">$record</link> or sender addresses, <link
7971linkend="folder-hook"><command>folder-hook</command></link> has to be be
7972used together with the <link
7973linkend="mailboxes"><command>mailboxes</command></link> command.
7974</para>
7975
7976<example id="ex-multiaccount">
7977<title>Managing multiple accounts</title>
7978<screen>
7979mailboxes imap://user@host1/INBOX
7980folder-hook imap://user@host1/ 'set folder=imap://host1/ ; set record=+INBOX/Sent'
7981
7982mailboxes imap://user@host2/INBOX
7983folder-hook imap://user@host2/ 'set folder=imap://host2/ ; set record=+INBOX/Sent'
7984</screen>
7985</example>
7986
7987<para>
7988In example <xref linkend="ex-multiaccount"/> the folders are defined
7989using <link linkend="mailboxes"><command>mailboxes</command></link> so
7990Mutt polls them for new mail. Each <link
7991linkend="folder-hook"><command>folder-hook</command></link> triggers
7992when one mailbox below each IMAP account is opened and sets <link
7993linkend="folder">$folder</link> to the account's root folder. Next, it
7994sets <link linkend="record">$record</link> to the
7995<emphasis>INBOX/Sent</emphasis> folder below the newly set <link
7996linkend="folder">$folder</link>. Please notice that the value the
7997<quote>+</quote> <link linkend="shortcuts">mailbox shortcut</link>
7998refers to depends on the <emphasis>current</emphasis> value of <link
7999linkend="folder">$folder</link> and therefore has to be set separately
8000per account. Setting other values like <link linkend="from">$from</link>
8001or <link linkend="signature">$signature</link> is analogous to setting
8002<link linkend="record">$record</link>.
8003</para>
8004
8005</sect1>
8006
8007<sect1 id="caching">
8008<title>Local Caching</title>
8009
8010<para>
8011Mutt contains two types of local caching: <emphasis>(1)</emphasis> the
8012so-called <quote>header caching</quote> and <emphasis>(2)</emphasis> the
8013so-called <quote>body caching</quote> which are both described in this
8014section.
8015</para>
8016
8017<para>
8018Header caching is optional as it depends on external libraries, body
8019caching is always enabled if Mutt is compiled with POP and/or IMAP
8020support as these use it (body caching requires no external library).
8021</para>
8022
8023<sect2 id="header-caching">
8024<title>Header Caching</title>
8025
8026<para>
8027Mutt provides optional support for caching message headers for the
8028following types of folders: IMAP, POP, Maildir and MH. Header caching
8029greatly speeds up opening large folders because for remote folders,
8030headers usually only need to be downloaded once. For Maildir and MH,
8031reading the headers from a single file is much faster than looking at
8032possibly thousands of single files (since Maildir and MH use one file
8033per message.)
8034</para>
8035
8036<para>
8037Header caching can be enabled via the configure script and the
8038<emphasis>--enable-hcache</emphasis> option. It's not turned on by
8039default because external database libraries are required: one of
8040tokyocabinet, qdbm, gdbm or bdb must be present.
8041</para>
8042
8043<para>
8044If enabled, <link linkend="header-cache">$header_cache</link> can be
8045used to either point to a file or a directory. If set to point to a
8046file, one database file for all folders will be used (which may result
8047in lower performance), but one file per folder if it points to a
8048directory.
8049</para>
8050
8051</sect2>
8052
8053<sect2 id="body-caching">
8054<title>Body Caching</title>
8055
8056<para>
8057Both cache methods can be combined using the same directory for storage
8058(and for IMAP/POP even provide meaningful file names) which simplifies
8059manual maintenance tasks.
8060</para>
8061
8062<para>
8063In addition to caching message headers only, Mutt can also cache whole
8064message bodies. This results in faster display of messages for POP and
8065IMAP folders because messages usually have to be downloaded only once.
8066</para>
8067
8068<para>
8069For configuration, the variable <link linkend="message-cachedir"
8070>$message_cachedir</link> must point to a directory. There, Mutt will
8071create a hierarchy of subdirectories named like the account and mailbox
8072path the cache is for.
8073</para>
8074
8075</sect2>
8076
8077<sect2 id="cache-dirs">
8078<title>Cache Directories</title>
8079
8080<para>
8081For using both, header and body caching, <link
8082linkend="header-cache">$header_cache</link> and <link
8083linkend="message-cachedir" >$message_cachedir</link> can be safely set
8084to the same value.
8085</para>
8086
8087<para>
8088In a header or body cache directory, Mutt creates a directory hierarchy
8089named like: <literal>proto:user@hostname</literal> where
8090<literal>proto</literal> is either <quote>pop</quote> or
8091<quote>imap.</quote> Within there, for each folder, Mutt stores messages
8092in single files and header caches in files with the
8093<quote>.hcache</quote> extension. All files can be removed as needed if
8094the consumed disk space becomes an issue as Mutt will silently fetch
8095missing items again. Pathnames are always stored in UTF-8 encoding.
8096</para>
8097
8098<para>
8099For Maildir and MH, the header cache files are named after the MD5
8100checksum of the path.
8101</para>
8102
8103</sect2>
8104
8105<sect2 id="maint-cache">
8106<title>Maintenance</title>
8107
8108<para>
8109Mutt does not (yet) support maintenance features for header cache
8110database files so that files have to be removed in case they grow too
8111big. It depends on the database library used for header caching whether
8112disk space freed by removing messages is re-used.
8113</para>
8114
8115<para>
8116For body caches, Mutt can keep the local cache in sync with the remote
8117mailbox if the <link
8118linkend="message-cache-clean">$message_cache_clean</link> variable is
8119set. Cleaning means to remove messages from the cache which are no
8120longer present in the mailbox which only happens when other mail clients
8121or instances of Mutt using a different body cache location delete
8122messages (Mutt itself removes deleted messages from the cache when
8123syncing a mailbox). As cleaning can take a noticeable amount of time, it
8124should not be set in general but only occasionally.
8125</para>
8126
8127</sect2>
8128
8129</sect1>
8130
8131<sect1 id="exact-address">
8132<title>Exact Address Generation</title>
8133
8134<para>
8135Mutt supports the <quote>Name <user@host></quote> address syntax
8136for reading and writing messages, the older <quote>user@host
8137(Name)</quote> syntax is only supported when reading messages. The
8138<emphasis>--enable-exact-address</emphasis> switch can be given to
8139configure to build it with write-support for the latter
8140syntax. <literal>EXACT_ADDRESS</literal> in the output of <literal>mutt
8141-v</literal> indicates whether it's supported.
8142</para>
8143
8144</sect1>
8145
8146<sect1 id="sending-mixmaster">
8147<title>Sending Anonymous Messages via Mixmaster</title>
8148
8149<para>
8150You may also have compiled Mutt to co-operate with Mixmaster, an
8151anonymous remailer. Mixmaster permits you to send your messages
8152anonymously using a chain of remailers. Mixmaster support in Mutt is for
8153mixmaster version 2.04 or later.
8154</para>
8155
8156<para>
8157To use it, you'll have to obey certain restrictions. Most important,
8158you cannot use the <literal>Cc</literal> and <literal>Bcc</literal>
8159headers. To tell Mutt to use mixmaster, you have to select a remailer
8160chain, using the mix function on the compose menu.
8161</para>
8162
8163<para>
8164The chain selection screen is divided into two parts. In the (larger)
8165upper part, you get a list of remailers you may use. In the lower part,
8166you see the currently selected chain of remailers.
8167</para>
8168
8169<para>
8170You can navigate in the chain using the
8171<literal><chain-prev></literal> and
8172<literal><chain-next></literal> functions, which are by default
8173bound to the left and right arrows and to the <literal>h</literal> and
8174<literal>l</literal> keys (think vi keyboard bindings). To insert a
8175remailer at the current chain position, use the
8176<literal><insert></literal> function. To append a remailer behind
8177the current chain position, use <literal><select-entry></literal>
8178or <literal><append></literal>. You can also delete entries from
8179the chain, using the corresponding function. Finally, to abandon your
8180changes, leave the menu, or <literal><accept></literal> them
8181pressing (by default) the <literal>Return</literal> key.
8182</para>
8183
8184<para>
8185Note that different remailers do have different capabilities, indicated
8186in the %c entry of the remailer menu lines (see <link
8187linkend="mix-entry-format">$mix_entry_format</link>). Most important is
8188the <quote>middleman</quote> capability, indicated by a capital
8189<quote>M</quote>: This means that the remailer in question cannot be
8190used as the final element of a chain, but will only forward messages to
8191other mixmaster remailers. For details on the other capabilities,
8192please have a look at the mixmaster documentation.
8193</para>
8194
8195</sect1>
8196
8197<sect1 id="sidebar">
8198 <title>Sidebar</title>
8199 <subtitle>Overview of mailboxes</subtitle>
8200
8201 <sect2 id="sidebar-intro">
8202 <title>Introduction</title>
8203
8204 <para>
8205 The Sidebar shows a list of all your mailboxes. The list can be
8206 turned on and off, it can be themed and the list style can be
8207 configured.
8208 </para>
8209 </sect2>
8210
8211 <sect2 id="sidebar-variables">
8212 <title>Variables</title>
8213
8214 <table id="table-sidebar-variables">
8215 <title>Sidebar Variables</title>
8216 <tgroup cols="3">
8217 <thead>
8218 <row>
8219 <entry>Name</entry>
8220 <entry>Type</entry>
8221 <entry>Default</entry>
8222 </row>
8223 </thead>
8224 <tbody>
8225 <row>
8226 <entry><literal>sidebar_delim_chars</literal></entry>
8227 <entry>string</entry>
8228 <entry><literal>/.</literal></entry>
8229 </row>
8230 <row>
8231 <entry><literal>sidebar_divider_char</literal></entry>
8232 <entry>string</entry>
8233 <entry><literal>|</literal></entry>
8234 </row>
8235 <row>
8236 <entry><literal>sidebar_folder_indent</literal></entry>
8237 <entry>boolean</entry>
8238 <entry><literal>no</literal></entry>
8239 </row>
8240 <row>
8241 <entry><literal>sidebar_format</literal></entry>
8242 <entry>string</entry>
8243 <entry><literal>%B%* %n</literal></entry>
8244 </row>
8245 <row>
8246 <entry><literal>sidebar_indent_string</literal></entry>
8247 <entry>string</entry>
8248 <entry><literal> </literal> (two spaces)</entry>
8249 </row>
8250 <row>
8251 <entry><literal>sidebar_new_mail_only</literal></entry>
8252 <entry>boolean</entry>
8253 <entry><literal>no</literal></entry>
8254 </row>
8255 <row>
8256 <entry><literal>sidebar_next_new_wrap</literal></entry>
8257 <entry>boolean</entry>
8258 <entry><literal>no</literal></entry>
8259 </row>
8260 <row>
8261 <entry><literal>sidebar_short_path</literal></entry>
8262 <entry>boolean</entry>
8263 <entry><literal>no</literal></entry>
8264 </row>
8265 <row>
8266 <entry><literal>sidebar_sort_method</literal></entry>
8267 <entry>enum</entry>
8268 <entry><literal>unsorted</literal></entry>
8269 </row>
8270 <row>
8271 <entry><literal>sidebar_visible</literal></entry>
8272 <entry>boolean</entry>
8273 <entry><literal>no</literal></entry>
8274 </row>
8275 <row>
8276 <entry><literal>sidebar_width</literal></entry>
8277 <entry>number</entry>
8278 <entry><literal>20</literal></entry>
8279 </row>
8280 </tbody>
8281 </tgroup>
8282 </table>
8283 </sect2>
8284
8285 <sect2 id="sidebar-functions">
8286 <title>Functions</title>
8287
8288 <para>
8289 Sidebar adds the following functions to Mutt.
8290 By default, none of them are bound to keys.
8291 </para>
8292
8293 <table id="table-sidebar-functions">
8294 <title>Sidebar Functions</title>
8295 <tgroup cols="3">
8296 <thead>
8297 <row>
8298 <entry>Menus</entry>
8299 <entry>Function</entry>
8300 <entry>Description</entry>
8301 </row>
8302 </thead>
8303 <tbody>
8304 <row>
8305 <entry>index,pager</entry>
8306 <entry><literal><sidebar-next></literal></entry>
8307 <entry>Move the highlight to next mailbox</entry>
8308 </row>
8309 <row>
8310 <entry>index,pager</entry>
8311 <entry><literal><sidebar-next-new></literal></entry>
8312 <entry>Move the highlight to next mailbox with new mail</entry>
8313 </row>
8314 <row>
8315 <entry>index,pager</entry>
8316 <entry><literal><sidebar-open></literal></entry>
8317 <entry>Open highlighted mailbox</entry>
8318 </row>
8319 <row>
8320 <entry>index,pager</entry>
8321 <entry><literal><sidebar-page-down></literal></entry>
8322 <entry>Scroll the Sidebar down 1 page</entry>
8323 </row>
8324 <row>
8325 <entry>index,pager</entry>
8326 <entry><literal><sidebar-page-up></literal></entry>
8327 <entry>Scroll the Sidebar up 1 page</entry>
8328 </row>
8329 <row>
8330 <entry>index,pager</entry>
8331 <entry><literal><sidebar-prev></literal></entry>
8332 <entry>Move the highlight to previous mailbox</entry>
8333 </row>
8334 <row>
8335 <entry>index,pager</entry>
8336 <entry><literal><sidebar-prev-new></literal></entry>
8337 <entry>Move the highlight to previous mailbox with new mail</entry>
8338 </row>
8339 <row>
8340 <entry>index,pager</entry>
8341 <entry><literal><sidebar-toggle-visible></literal></entry>
8342 <entry>Make the Sidebar (in)visible</entry>
8343 </row>
8344 </tbody>
8345 </tgroup>
8346 </table>
8347 </sect2>
8348
8349 <sect2 id="sidebar-commands">
8350 <title>Commands</title>
8351 <cmdsynopsis>
8352 <command>sidebar_whitelist<anchor id="sidebar-whitelist"/></command>
8353 <arg choice="plain">
8354 <replaceable class="parameter">mailbox</replaceable>
8355 </arg>
8356 <arg choice="opt" rep="repeat">
8357 <replaceable class="parameter">mailbox</replaceable>
8358 </arg>
8359
8360 <command>unsidebar_whitelist<anchor id="unsidebar-whitelist"/></command>
8361 <arg choice="plain">
8362 <replaceable class="parameter">*</replaceable>
8363 </arg>
8364 <arg choice="plain" rep="repeat">
8365 <replaceable class="parameter">mailbox</replaceable>
8366 </arg>
8367 </cmdsynopsis>
8368
8369 <para>
8370 This command specifies mailboxes that will always be displayed
8371 in the sidebar, even if <link
8372 linkend="sidebar-new-mail-only">$sidebar_new_mail_only</link>
8373 is set and the mailbox does not contain new mail.
8374 </para>
8375
8376 <para>
8377 The <quote>unsidebar_whitelist</quote> command is used to remove a mailbox from
8378 the list of whitelisted mailboxes. Use <quote>unsidebar_whitelist *</quote>
8379 to remove all mailboxes.
8380 </para>
8381 </sect2>
8382
8383 <sect2 id="sidebar-colors">
8384 <title>Colors</title>
8385
8386 <table id="table-sidebar-colors">
8387 <title>Sidebar Colors</title>
8388 <tgroup cols="3">
8389 <thead>
8390 <row>
8391 <entry>Name</entry>
8392 <entry>Default Color</entry>
8393 <entry>Description</entry>
8394 </row>
8395 </thead>
8396 <tbody>
8397 <row>
8398 <entry><literal>sidebar_divider</literal></entry>
8399 <entry>default</entry>
8400 <entry>The dividing line between the Sidebar and the Index/Pager panels</entry>
8401 </row>
8402 <row>
8403 <entry><literal>sidebar_flagged</literal></entry>
8404 <entry>default</entry>
8405 <entry>Mailboxes containing flagged mail</entry>
8406 </row>
8407 <row>
8408 <entry><literal>sidebar_highlight</literal></entry>
8409 <entry>underline</entry>
8410 <entry>Cursor to select a mailbox</entry>
8411 </row>
8412 <row>
8413 <entry><literal>sidebar_indicator</literal></entry>
8414 <entry>mutt <literal>indicator</literal></entry>
8415 <entry>The mailbox open in the Index panel</entry>
8416 </row>
8417 <row>
8418 <entry><literal>sidebar_new</literal></entry>
8419 <entry>default</entry>
8420 <entry>Mailboxes containing new mail</entry>
8421 </row>
8422 <row>
8423 <entry><literal>sidebar_spoolfile</literal></entry>
8424 <entry>default</entry>
8425 <entry>Mailbox that receives incoming mail</entry>
8426 </row>
8427 </tbody>
8428 </tgroup>
8429 </table>
8430
8431 <para>
8432 If the <literal>sidebar_indicator</literal> color isn't set, then the default Mutt
8433 indicator color will be used (the color used in the index panel).
8434 </para>
8435 </sect2>
8436
8437 <sect2 id="sidebar-sort">
8438 <title>Sort</title>
8439
8440 <table id="table-sidebar-sort">
8441 <title>Sidebar Sort</title>
8442 <tgroup cols="2">
8443 <thead>
8444 <row>
8445 <entry>Sort</entry>
8446 <entry>Description</entry>
8447 </row>
8448 </thead>
8449 <tbody>
8450 <row>
8451 <entry><literal>alpha</literal></entry>
8452 <entry>Alphabetically by path</entry>
8453 </row>
8454 <row>
8455 <entry><literal>count</literal></entry>
8456 <entry>Total number of messages</entry>
8457 </row>
8458 <row>
8459 <entry><literal>flagged</literal></entry>
8460 <entry>Number of flagged messages</entry>
8461 </row>
8462 <row>
8463 <entry><literal>name</literal></entry>
8464 <entry>Alphabetically by path</entry>
8465 </row>
8466 <row>
8467 <entry><literal>new</literal></entry>
8468 <entry>Number of new messages</entry>
8469 </row>
8470 <row>
8471 <entry><literal>path</literal></entry>
8472 <entry>Alphabetically by path</entry>
8473 </row>
8474 <row>
8475 <entry><literal>unsorted</literal></entry>
8476 <entry>Do not resort the paths</entry>
8477 </row>
8478 </tbody>
8479 </tgroup>
8480 </table>
8481 </sect2>
8482
8483
8484 <sect2 id="sidebar-see-also">
8485 <title>See Also</title>
8486
8487 <itemizedlist>
8488 <listitem><para><link linkend="regexp">Regular Expressions</link></para></listitem>
8489 <listitem><para><link linkend="patterns">Patterns</link></para></listitem>
8490 <listitem><para><link linkend="color">Color command</link></para></listitem>
8491 </itemizedlist>
8492 </sect2>
8493</sect1>
8494
8495<sect1 id="compress">
8496 <title>Compressed Folders Feature</title>
8497 <subtitle>Read from/write to compressed mailboxes</subtitle>
8498
8499 <sect2 id="compress-intro">
8500 <title>Introduction</title>
8501
8502 <para>
8503 The Compressed Folder patch allows Mutt to read mailbox files that are
8504 compressed. But it isn't limited to compressed files. It works well
8505 with encrypted files, too. In fact, if you can create a program/script
8506 to convert to and from your format, then Mutt can read it.
8507 </para>
8508
8509 <para>
8510 The patch adds three hooks to Mutt: <literal>open-hook</literal>,
8511 <literal>close-hook</literal> and <literal>append-hook</literal>. They
8512 define commands to: uncompress a file; compress a file; append
8513 messages to an already compressed file.
8514 </para>
8515
8516 <para>
8517 There are some examples of both compressed and encrypted files,
8518 later. For now, the documentation will just concentrate on
8519 compressed files.
8520 </para>
8521
8522 </sect2>
8523
8524 <sect2 id="compress-commands">
8525 <title>Commands</title>
8526 <cmdsynopsis>
8527 <command>open-hook</command>
8528 <arg choice="plain">
8529 <replaceable class="parameter">pattern</replaceable>
8530 </arg>
8531 <arg choice="plain">
8532 <replaceable class="parameter">shell-command</replaceable>
8533 </arg>
8534 <command>close-hook</command>
8535 <arg choice="plain">
8536 <replaceable class="parameter">pattern</replaceable>
8537 </arg>
8538 <arg choice="plain">
8539 <replaceable class="parameter">shell-command</replaceable>
8540 </arg>
8541 <command>append-hook</command>
8542 <arg choice="plain">
8543 <replaceable class="parameter">pattern</replaceable>
8544 </arg>
8545 <arg choice="plain">
8546 <replaceable class="parameter">shell-command</replaceable>
8547 </arg>
8548 </cmdsynopsis>
8549
8550 <para>
8551 The shell-command must contain two placeholders for filenames:
8552 <literal>%f</literal> and <literal>%t</literal>. These represent
8553 <quote>from</quote> and <quote>to</quote> filenames. These placeholders
8554 should be placed inside single-quotes to prevent unintended shell
8555 expansions.
8556 </para>
8557
8558 <para>
8559 If you need the exact string <quote>%f</quote> or <quote>%t</quote> in your
8560 command, simply double up the <quote>%</quote> character, e.g.
8561 <quote>%%f</quote> or <quote>%%t</quote>.
8562 </para>
8563
8564 <table id="table-compress-optional">
8565 <title>Not all Hooks are Required</title>
8566 <tgroup cols="5">
8567 <thead>
8568 <row>
8569 <entry>Open</entry>
8570 <entry>Close</entry>
8571 <entry>Append</entry>
8572 <entry>Effect</entry>
8573 <entry>Useful if</entry>
8574 </row>
8575 </thead>
8576 <tbody>
8577 <row>
8578 <entry>Open</entry>
8579 <entry>-</entry>
8580 <entry>-</entry>
8581 <entry>Folder is readonly</entry>
8582 <entry>The folder is just a backup</entry>
8583 </row>
8584 <row>
8585 <entry>Open</entry>
8586 <entry>Close</entry>
8587 <entry>-</entry>
8588 <entry>Folder is read/write, but the entire folder must be
8589 written if anything is changed</entry>
8590 <entry>Your compression format doesn't support appending</entry>
8591 </row>
8592 <row>
8593 <entry>Open</entry>
8594 <entry>Close</entry>
8595 <entry>Append</entry>
8596 <entry>Folder is read/write and emails can be efficiently added
8597 to the end</entry>
8598 <entry>Your compression format supports appending</entry>
8599 </row>
8600 <row>
8601 <entry>Open</entry>
8602 <entry>-</entry>
8603 <entry>Append</entry>
8604 <entry>Folder is readonly, but can be appended to</entry>
8605 <entry>You want to store emails, but never change them</entry>
8606 </row>
8607 </tbody>
8608 </tgroup>
8609 </table>
8610
8611 <note>
8612 <para>The command:</para>
8613 <itemizedlist>
8614 <listitem><para>should return a non-zero exit status on failure</para></listitem>
8615 <listitem><para>should not delete any files</para></listitem>
8616 </itemizedlist>
8617 </note>
8618
8619 <sect3 id="open-hook">
8620 <title>Read from compressed mailbox</title>
8621
8622 <screen>open-hook regexp shell-command</screen>
8623
8624 <para>
8625 If Mutt is unable to open a file, it then looks for
8626 <literal>open-hook</literal> that matches the filename.
8627 </para>
8628
8629 <para>
8630 If your compression program doesn't have a well-defined extension,
8631 then you can use <literal>.</literal> as the regexp.
8632 </para>
8633
8634 <sect4 id="compress-open-hook-example">
8635 <title>Example of open-hook</title>
8636
8637 <screen>open-hook '\.gz$' "gzip -cd '%f' > '%t'"</screen>
8638
8639 <itemizedlist>
8640 <listitem><para>Mutt finds a file, <quote>example.gz</quote>,
8641 that it can't read</para></listitem>
8642 <listitem><para>Mutt has an <literal>open-hook</literal>
8643 whose regexp matches the filename:
8644 <literal>\.gz$</literal></para></listitem>
8645 <listitem><para>Mutt uses the command <literal>gzip -cd</literal>
8646 to create a temporary file that it <emphasis>can</emphasis>
8647 read</para></listitem>
8648 </itemizedlist>
8649 </sect4>
8650 </sect3>
8651
8652 <sect3 id="close-hook">
8653 <title>Write to a compressed mailbox</title>
8654
8655 <screen>close-hook regexp shell-command</screen>
8656
8657 <para>
8658 When Mutt has finished with a compressed mail folder, it will look
8659 for a matching <literal>close-hook</literal> to recompress the file.
8660 This hook is <link linkend="table-compress-optional">optional</link>.
8661 </para>
8662
8663 <note>
8664 <para>
8665 If the folder has not been modified, the
8666 <literal>close-hook</literal> will not be called.
8667 </para>
8668 </note>
8669
8670 <sect4 id="compress-close-hook-example">
8671 <title>Example of close-hook</title>
8672
8673 <screen>close-hook '\.gz$' "gzip -c '%t' > '%f'"</screen>
8674
8675 <itemizedlist>
8676 <listitem><para>Mutt has finished with a folder, <quote>example.gz</quote>,
8677 that it opened with <literal>open-hook</literal></para></listitem>
8678 <listitem><para>The folder has been modified</para></listitem>
8679 <listitem><para>Mutt has a <literal>close-hook</literal> whose regexp
8680 matches the filename: <literal>\.gz$</literal></para></listitem>
8681 <listitem><para>Mutt uses the command <literal>gzip -c</literal>
8682 to create a new compressed file</para></listitem>
8683 </itemizedlist>
8684 </sect4>
8685 </sect3>
8686
8687 <sect3 id="append-hook">
8688 <title>Append to a compressed mailbox</title>
8689
8690 <screen>append-hook regexp shell-command</screen>
8691
8692 <para>
8693 When Mutt wants to append an email to a compressed mail folder, it
8694 will look for a matching <literal>append-hook</literal>.
8695 This hook is <link linkend="table-compress-optional">optional</link>.
8696 </para>
8697
8698 <para>
8699 Using the <literal>append-hook</literal> will save time, but
8700 Mutt won't be able to determine the type of the mail folder
8701 inside the compressed file.
8702 </para>
8703
8704 <para>
8705 Mutt will <emphasis>assume</emphasis> the type to be that of
8706 the <literal>$mbox_type</literal> variable. Mutt also uses
8707 this type for temporary files.
8708 </para>
8709
8710 <para>
8711 Mutt will only use the <literal>append-hook</literal> for existing files.
8712 The <literal>close-hook</literal> will be used for empty, or missing files.
8713 </para>
8714
8715 <note>
8716 <para>
8717 If your command writes to stdout, it is vital that you use
8718 <literal>>></literal> in the <quote>append-hook</quote>.
8719 If not, data will be lost.
8720 </para>
8721 </note>
8722
8723 <sect4 id="compress-append-hook-example">
8724 <title>Example of append-hook</title>
8725
8726 <screen>append-hook '\.gz$' "gzip -c '%t' >> '%f'"</screen>
8727
8728 <itemizedlist>
8729 <listitem><para>Mutt wants to append an email to a folder, <quote>example.gz</quote>,
8730 that it opened with <literal>open-hook</literal></para></listitem>
8731 <listitem><para>Mutt has an <literal>append-hook</literal> whose regexp matches
8732 the filename: <literal>\.gz$</literal></para></listitem>
8733 <listitem><para>Mutt knows the mailbox type from the <literal>$mbox</literal>
8734 variable</para></listitem>
8735 <listitem><para>Mutt uses the command <literal>gzip -c</literal>
8736 to append to an existing compressed file</para></listitem>
8737 </itemizedlist>
8738 </sect4>
8739
8740 </sect3>
8741
8742 <sect3 id="compress-empty">
8743 <title>Empty Files</title>
8744
8745 <para>
8746 Mutt assumes that an empty file is not compressed. In this
8747 situation, unset <link linkend="save-empty">$save_empty</link>, so
8748 that the compressed file will be removed if you delete all of the
8749 messages.
8750 </para>
8751 </sect3>
8752
8753 <sect3 id="compress-security">
8754 <title>Security</title>
8755
8756 <para>
8757 Encrypted files are decrypted into temporary files which are
8758 stored in the <link linkend="tmpdir">$tmpdir</link> directory.
8759 This could be a security risk.
8760 </para>
8761 </sect3>
8762 </sect2>
8763</sect1>
8764</chapter>
8765
8766<chapter id="security">
8767<title>Security Considerations</title>
8768
8769<para>
8770First of all, Mutt contains no security holes included by intention but
8771may contain unknown security holes. As a consequence, please run Mutt
8772only with as few permissions as possible. Especially, do not run Mutt as
8773the super user.
8774</para>
8775
8776<para>
8777When configuring Mutt, there're some points to note about secure setups
8778so please read this chapter carefully.
8779</para>
8780
8781<sect1 id="security-passwords">
8782<title>Passwords</title>
8783
8784<para>
8785Although Mutt can be told the various passwords for accounts, please
8786never store passwords in configuration files. Besides the fact that the
8787system's operator can always read them, you could forget to mask it out
8788when reporting a bug or asking for help via a mailing list. Even worse,
8789your mail including your password could be archived by internet search
8790engines, mail-to-news gateways etc. It may already be too late before
8791you notice your mistake.
8792</para>
8793
8794</sect1>
8795
8796<sect1 id="security-tempfiles">
8797<title>Temporary Files</title>
8798
8799<para>
8800Mutt uses many temporary files for viewing messages, verifying digital
8801signatures, etc. As long as being used, these files are visible by other
8802users and maybe even readable in case of misconfiguration. Also, a
8803different location for these files may be desired which can be changed
8804via the <link linkend="tmpdir">$tmpdir</link> variable.
8805</para>
8806
8807</sect1>
8808
8809<sect1 id="security-leaks">
8810<title>Information Leaks</title>
8811
8812<sect2 id="security-leaks-mid">
8813<title>Message-Id: headers</title>
8814
8815<para>
8816Message-Id: headers contain a local part that is to be created in a
8817unique fashion. In order to do so, Mutt will <quote>leak</quote> some
8818information to the outside world when sending messages: the generation
8819of this header includes a step counter which is increased (and rotated)
8820with every message sent. In a longer running mutt session, others can
8821make assumptions about your mailing habits depending on the number of
8822messages sent. If this is not desired, the header can be manually
8823provided using <link linkend="edit-headers">$edit_headers</link> (though
8824not recommended).
8825</para>
8826
8827</sect2>
8828
8829<sect2 id="security-leaks-mailto">
8830<title><literal>mailto:</literal>-style Links</title>
8831
8832<para>
8833As Mutt be can be set up to be the mail client to handle
8834<literal>mailto:</literal> style links in websites, there're security
8835considerations, too. Arbitrary header fields can be embedded in these
8836links which could override existing header fields or attach arbitrary
8837files using <link linkend="attach-header">the Attach:
8838pseudoheader</link>. This may be problematic if the <link
8839linkend="edit-headers">$edit-headers</link> variable is
8840<emphasis>unset</emphasis>, i.e. the user doesn't want to see header
8841fields while editing the message and doesn't pay enough attention to the
8842compose menu's listing of attachments.
8843</para>
8844
8845<para>
8846For example, following a link like
8847</para>
8848
8849<screen>
8850mailto:joe@host?Attach=~/.gnupg/secring.gpg</screen>
8851
8852<para>
8853will send out the user's private gnupg keyring to
8854<literal>joe@host</literal> if the user doesn't follow the information
8855on screen carefully enough.
8856</para>
8857
8858<para>
8859To prevent these issues, Mutt by default only accepts the
8860<literal>Subject</literal> and <literal>Body</literal> headers.
8861Allowed headers can be adjusted with the
8862<link linkend="mailto-allow"><command>mailto_allow</command></link> and
8863<link linkend="mailto-allow"><command>unmailto_allow</command></link> commands.
8864</para>
8865
8866</sect2>
8867
8868</sect1>
8869
8870<sect1 id="security-external">
8871<title>External Applications</title>
8872
8873<para>
8874Mutt in many places has to rely on external applications or for
8875convenience supports mechanisms involving external applications.
8876</para>
8877
8878<para>
8879One of these is the <literal>mailcap</literal> mechanism as defined by
8880RfC1524. Details about a secure use of the mailcap mechanisms is given
8881in <xref linkend="secure-mailcap"/>.
8882</para>
8883
8884<para>
8885Besides the mailcap mechanism, Mutt uses a number of other external
8886utilities for operation, for example to provide crypto support, in
8887backtick expansion in configuration files or format string filters. The
8888same security considerations apply for these as for tools involved via
8889mailcap.
8890</para>
8891
8892</sect1>
8893
8894</chapter>
8895
8896
8897<chapter id="tuning">
8898<title>Performance Tuning</title>
8899
8900<sect1 id="tuning-mailboxes">
8901<title>Reading and Writing Mailboxes</title>
8902
8903<para>
8904Mutt's performance when reading mailboxes can be improved in two ways:
8905</para>
8906
8907<orderedlist>
8908
8909<listitem>
8910<para>
8911For remote folders (IMAP and POP) as well as folders using one-file-per
8912message storage (Maildir and MH), Mutt's performance can be greatly
8913improved using <link linkend="header-caching">header caching</link>.
8914using a single database per folder.
8915</para>
8916</listitem>
8917
8918<listitem>
8919<para>
8920Mutt provides the <link linkend="read-inc">$read_inc</link> and <link
8921linkend="write-inc">$write_inc</link> variables to specify at which rate
8922to update progress counters. If these values are too low, Mutt may spend
8923more time on updating the progress counter than it spends on actually
8924reading/writing folders.
8925</para>
8926
8927<para>
8928For example, when opening a maildir folder with a few thousand messages,
8929the default value for <link linkend="read-inc">$read_inc</link> may be
8930too low. It can be tuned on on a folder-basis using <link
8931linkend="folder-hook"><command>folder-hook</command>s</link>:
8932</para>
8933
8934<screen>
8935<emphasis role="comment"># use very high $read_inc to speed up reading hcache'd maildirs</emphasis>
8936folder-hook . 'set read_inc=1000'
8937<emphasis role="comment"># use lower value for reading slower remote IMAP folders</emphasis>
8938folder-hook ^imap 'set read_inc=100'
8939<emphasis role="comment"># use even lower value for reading even slower remote POP folders</emphasis>
8940folder-hook ^pop 'set read_inc=1'</screen>
8941
8942</listitem>
8943</orderedlist>
8944
8945<para>
8946These settings work on a per-message basis. However, as messages may
8947greatly differ in size and certain operations are much faster than
8948others, even per-folder settings of the increment variables may not be
8949desirable as they produce either too few or too much progress updates.
8950Thus, Mutt allows to limit the number of progress updates per second
8951it'll actually send to the terminal using the <link
8952linkend="time-inc">$time_inc</link> variable.
8953</para>
8954
8955</sect1>
8956
8957<sect1 id="tuning-messages">
8958<title>Reading Messages from Remote Folders</title>
8959
8960<para>
8961Reading messages from remote folders such as IMAP an POP can be slow
8962especially for large mailboxes since Mutt only caches a very limited
8963number of recently viewed messages (usually 10) per session (so that it
8964will be gone for the next session.)
8965</para>
8966
8967<para>
8968To improve performance and permanently cache whole messages, please
8969refer to Mutt's so-called <link linkend="body-caching">body
8970caching</link> for details.
8971</para>
8972
8973</sect1>
8974
8975<sect1 id="tuning-search">
8976<title>Searching and Limiting</title>
8977
8978<para>
8979When searching mailboxes either via a search or a limit action, for some
8980patterns Mutt distinguishes between regular expression and string
8981searches. For regular expressions, patterns are prefixed with
8982<quote>~</quote> and with <quote>=</quote> for string searches.
8983</para>
8984
8985<para>
8986Even though a regular expression search is fast, it's several times
8987slower than a pure string search which is noticeable especially on large
8988folders. As a consequence, a string search should be used instead of a
8989regular expression search if the user already knows enough about the
8990search pattern.
8991</para>
8992
8993<para>
8994For example, when limiting a large folder to all messages sent to or by
8995an author, it's much faster to search for the initial part of an e-mail
8996address via <literal>=Luser@</literal> instead of
8997<literal>~Luser@</literal>. This is especially true for searching
8998message bodies since a larger amount of input has to be searched.
8999</para>
9000
9001<para>
9002As for regular expressions, a lower case string search pattern makes
9003Mutt perform a case-insensitive search except for IMAP (because for IMAP
9004Mutt performs server-side searches which don't support
9005case-insensitivity).
9006</para>
9007
9008</sect1>
9009
9010</chapter>
9011
9012<chapter id="reference">
9013<title>Reference</title>
9014
9015<sect1 id="commandline">
9016<title>Command-Line Options</title>
9017
9018<para>
9019Running <literal>mutt</literal> with no arguments will make Mutt attempt
9020to read your spool mailbox. However, it is possible to read other
9021mailboxes and to send messages from the command line as well.
9022</para>
9023
9024<table id="tab-commandline-options">
9025<title>Command line options</title>
9026<tgroup cols="2">
9027<thead>
9028<row><entry>Option</entry><entry>Description</entry></row>
9029</thead>
9030<tbody>
9031<row><entry>-A</entry><entry>expand an alias</entry></row>
9032<row><entry>-a</entry><entry>attach a file to a message</entry></row>
9033<row><entry>-b</entry><entry>specify a blind carbon-copy (BCC) address</entry></row>
9034<row><entry>-c</entry><entry>specify a carbon-copy (Cc) address</entry></row>
9035<row><entry>-d</entry><entry>log debugging output to ~/.muttdebug0 if mutt was compiled with +DEBUG; it can range from 1-5 and affects verbosity (a value of 2 is recommended)</entry></row>
9036<row><entry>-D</entry><entry>print the value of all Mutt variables to stdout</entry></row>
9037<row><entry>-E</entry><entry>edit the draft (-H) or include (-i) file</entry></row>
9038<row><entry>-e</entry><entry>specify a config command to be run after initialization files are read</entry></row>
9039<row><entry>-f</entry><entry>specify a mailbox to load</entry></row>
9040<row><entry>-F</entry><entry>specify an alternate file to read initialization commands</entry></row>
9041<row><entry>-h</entry><entry>print help on command line options</entry></row>
9042<row><entry>-H</entry><entry>specify a draft file from which to read a header and body</entry></row>
9043<row><entry>-i</entry><entry>specify a file to include in a message composition</entry></row>
9044<row><entry>-m</entry><entry>specify a default mailbox type</entry></row>
9045<row><entry>-n</entry><entry>do not read the system Muttrc</entry></row>
9046<row><entry>-p</entry><entry>recall a postponed message</entry></row>
9047<row><entry>-Q</entry><entry>query a configuration variable</entry></row>
9048<row><entry>-R</entry><entry>open mailbox in read-only mode</entry></row>
9049<row><entry>-s</entry><entry>specify a subject (enclose in quotes if it contains spaces)</entry></row>
9050<row><entry>-v</entry><entry>show version number and compile-time definitions</entry></row>
9051<row><entry>-x</entry><entry>simulate the mailx(1) compose mode</entry></row>
9052<row><entry>-y</entry><entry>show a menu containing the files specified by the <command>mailboxes</command> command</entry></row>
9053<row><entry>-z</entry><entry>exit immediately if there are no messages in the mailbox</entry></row>
9054<row><entry>-Z</entry><entry>open the first folder with new message, exit immediately if none</entry></row>
9055</tbody>
9056</tgroup>
9057</table>
9058
9059<para>
9060To read messages in a mailbox
9061</para>
9062
9063<cmdsynopsis>
9064<command>mutt</command>
9065<arg choice="opt"><option>-nz</option></arg>
9066<arg choice="opt"><option>-F</option>
9067<replaceable>muttrc</replaceable>
9068</arg>
9069<arg choice="opt"><option>-m</option>
9070<replaceable>type</replaceable>
9071</arg>
9072<arg choice="opt"><option>-f</option>
9073<replaceable>mailbox</replaceable>
9074</arg>
9075</cmdsynopsis>
9076
9077<para>
9078To compose a new message
9079</para>
9080
9081<cmdsynopsis>
9082<command>mutt</command>
9083<arg choice="opt"><option>-En</option></arg>
9084<arg choice="opt"><option>-F</option>
9085<replaceable>muttrc</replaceable>
9086</arg>
9087<arg choice="opt"><option>-c</option>
9088<replaceable>address</replaceable>
9089</arg>
9090<arg choice="opt"><option>-Hi</option>
9091<replaceable>filename</replaceable>
9092</arg>
9093<arg choice="opt"><option>-s</option>
9094<replaceable>subject</replaceable>
9095</arg>
9096<arg choice="opt">
9097<option>-a</option>
9098<replaceable>file</replaceable>
9099<arg choice="opt" rep="repeat"/>
9100--
9101</arg>
9102<group choice="plain" rep="repeat">
9103<arg choice="plain">
9104<replaceable>address</replaceable>
9105</arg>
9106<arg choice="plain">
9107<replaceable>mailto_url</replaceable>
9108</arg>
9109</group>
9110</cmdsynopsis>
9111
9112<para>
9113Mutt also supports a <quote>batch</quote> mode to send prepared
9114messages. Simply redirect input from the file you wish to send. For
9115example,
9116</para>
9117
9118<screen>
9119mutt -s "data set for run #2" professor@bigschool.edu < ~/run2.dat</screen>
9120
9121<para>
9122will send a message to
9123<literal><professor@bigschool.edu></literal> with a subject of
9124<quote>data set for run #2</quote>. In the body of the message will be
9125the contents of the file <quote>~/run2.dat</quote>.
9126</para>
9127
9128<para>
9129An include file passed with <literal>-i</literal> will be used as the
9130body of the message. When combined with <literal>-E</literal>, the
9131include file will be directly edited during message composition. The
9132file will be modified regardless of whether the message is sent or
9133aborted.
9134</para>
9135
9136<para>
9137A draft file passed with <literal>-H</literal> will be used as the
9138initial header and body for the message. Multipart messages can be
9139used as a draft file. When combined with <literal>-E</literal>, the
9140draft file will be updated to the final state of the message after
9141composition, regardless of whether the message is sent, aborted, or
9142even postponed. Note that if the message is sent encrypted or signed,
9143the draft file will be saved that way too.
9144</para>
9145
9146<para>
9147All files passed with <literal>-a</literal> <emphasis>file</emphasis>
9148will be attached as a MIME part to the message. To attach a single or
9149several files, use <quote>--</quote> to separate files and recipient
9150addresses:
9151</para>
9152
9153<screen>
9154mutt -a image.png -- some@one.org</screen>
9155
9156<para>
9157or
9158</para>
9159
9160<screen>
9161mutt -a *.png -- some@one.org</screen>
9162
9163<note>
9164<para>
9165The <literal>-a</literal> option must be last in the option list.
9166</para>
9167</note>
9168
9169<para>
9170In addition to accepting a list of email addresses, Mutt also accepts a URL with
9171the <literal>mailto:</literal> schema as specified in RFC2368. This is useful
9172when configuring a web browser to launch Mutt when clicking on mailto links.
9173</para>
9174
9175<screen>
9176mutt mailto:some@one.org?subject=test&cc=other@one.org</screen>
9177
9178</sect1>
9179
9180<sect1 id="commands">
9181<title>Configuration Commands</title>
9182
9183<para>
9184The following are the commands understood by Mutt:
9185</para>
9186
9187<itemizedlist>
9188
9189<listitem>
9190<cmdsynopsis>
9191<command><link linkend="account-hook">account-hook</link></command>
9192<arg choice="plain">
9193<replaceable>regexp</replaceable>
9194<replaceable>command</replaceable>
9195</arg>
9196</cmdsynopsis>
9197</listitem>
9198
9199<listitem>
9200<cmdsynopsis>
9201<command><link linkend="alias">alias</link></command>
9202<arg choice="opt" rep="repeat">
9203<option>-group</option>
9204<replaceable class="parameter">name</replaceable>
9205</arg>
9206<arg choice="plain">
9207<replaceable class="parameter">key</replaceable>
9208</arg>
9209<arg choice="plain">
9210<replaceable class="parameter">address</replaceable>
9211</arg>
9212<arg choice="opt" rep="repeat">
9213<replaceable class="parameter">address</replaceable>
9214</arg>
9215
9216<command><link linkend="alias">unalias</link></command>
9217<arg choice="opt" rep="repeat">
9218<option>-group</option>
9219<replaceable>name</replaceable>
9220</arg>
9221<group choice="req">
9222<arg choice="plain">
9223<replaceable class="parameter">*</replaceable>
9224</arg>
9225<arg choice="plain" rep="repeat">
9226<replaceable class="parameter">key</replaceable>
9227</arg>
9228</group>
9229</cmdsynopsis>
9230</listitem>
9231
9232<listitem>
9233<cmdsynopsis>
9234<command><link linkend="alternates">alternates</link></command>
9235<arg choice="opt" rep="repeat">
9236<option>-group</option>
9237<replaceable>name</replaceable>
9238</arg>
9239<arg choice="plain">
9240<replaceable>regexp</replaceable>
9241</arg>
9242<arg choice="opt" rep="repeat">
9243<replaceable>regexp</replaceable>
9244</arg>
9245
9246<command><link linkend="alternates">unalternates</link></command>
9247<arg choice="opt" rep="repeat">
9248<option>-group</option>
9249<replaceable>name</replaceable>
9250</arg>
9251<group choice="req">
9252<arg choice="plain">
9253<replaceable>*</replaceable>
9254</arg>
9255<arg choice="plain" rep="repeat">
9256<replaceable>regexp</replaceable>
9257</arg>
9258</group>
9259</cmdsynopsis>
9260</listitem>
9261
9262<listitem>
9263<cmdsynopsis>
9264<command><link linkend="alternative-order">alternative_order</link></command>
9265<arg choice="plain">
9266<replaceable>mimetype</replaceable>
9267</arg>
9268<arg choice="opt" rep="repeat">
9269<replaceable>mimetype</replaceable>
9270</arg>
9271
9272<command><link linkend="alternative-order">unalternative_order</link></command>
9273<group choice="req">
9274<arg choice="plain">
9275<replaceable>*</replaceable>
9276</arg>
9277<arg choice="plain" rep="repeat">
9278<replaceable>mimetype</replaceable>
9279</arg>
9280</group>
9281</cmdsynopsis>
9282</listitem>
9283
9284<listitem>
9285<cmdsynopsis>
9286<command><link linkend="attachments">attachments</link></command>
9287<arg choice="plain">
9288<replaceable>{ + | - }disposition</replaceable>
9289</arg>
9290<arg choice="plain">
9291<replaceable>mime-type</replaceable>
9292</arg>
9293
9294<command><link linkend="attachments">unattachments</link></command>
9295<arg choice="plain">
9296<replaceable>{ + | - }disposition</replaceable>
9297</arg>
9298<arg choice="plain">
9299<replaceable>mime-type</replaceable>
9300</arg>
9301</cmdsynopsis>
9302</listitem>
9303
9304<listitem>
9305<cmdsynopsis>
9306<command><link linkend="auto-view">auto_view</link></command>
9307<arg choice="plain">
9308<replaceable>mimetype</replaceable>
9309</arg>
9310<arg choice="opt" rep="repeat">
9311<replaceable>mimetype</replaceable>
9312</arg>
9313
9314<command><link linkend="auto-view">unauto_view</link></command>
9315<group choice="req">
9316<arg choice="plain">
9317<replaceable>*</replaceable>
9318</arg>
9319<arg choice="plain" rep="repeat">
9320<replaceable>mimetype</replaceable>
9321</arg>
9322</group>
9323</cmdsynopsis>
9324</listitem>
9325
9326<listitem>
9327<cmdsynopsis>
9328<command><link linkend="bind">bind</link></command>
9329<arg choice="plain">
9330<replaceable class="parameter">map</replaceable>
9331</arg>
9332<arg choice="plain">
9333<replaceable class="parameter">key</replaceable>
9334</arg>
9335<arg choice="plain">
9336<replaceable class="parameter">function</replaceable>
9337</arg>
9338</cmdsynopsis>
9339</listitem>
9340
9341<listitem>
9342<cmdsynopsis>
9343<command><link linkend="charset-hook">charset-hook</link></command>
9344<arg choice="plain">
9345<replaceable class="parameter">alias</replaceable>
9346</arg>
9347<arg choice="plain">
9348<replaceable class="parameter">charset</replaceable>
9349</arg>
9350</cmdsynopsis>
9351</listitem>
9352
9353<listitem>
9354<cmdsynopsis>
9355<command><link linkend="iconv-hook">iconv-hook</link></command>
9356<arg choice="plain">
9357<replaceable class="parameter">charset</replaceable>
9358</arg>
9359<arg choice="plain">
9360<replaceable class="parameter">local-charset</replaceable>
9361</arg>
9362</cmdsynopsis>
9363</listitem>
9364
9365<listitem>
9366<cmdsynopsis>
9367<command><link linkend="color">color</link></command>
9368<arg choice="plain">
9369<replaceable class="parameter">object</replaceable>
9370</arg>
9371<arg choice="plain">
9372<replaceable class="parameter">foreground</replaceable>
9373</arg>
9374<arg choice="plain">
9375<replaceable class="parameter">background</replaceable>
9376</arg>
9377
9378<command><link linkend="color">color</link></command>
9379<group choice="req">
9380<arg choice="plain">
9381<option>header</option>
9382</arg>
9383<arg choice="plain">
9384<option>body</option>
9385</arg>
9386</group>
9387<arg choice="plain">
9388<replaceable class="parameter">foreground</replaceable>
9389</arg>
9390<arg choice="plain">
9391<replaceable class="parameter">background</replaceable>
9392</arg>
9393<arg choice="plain">
9394<replaceable class="parameter">regexp</replaceable>
9395</arg>
9396
9397<command><link linkend="color">color</link></command>
9398<arg choice="plain">
9399<option>index</option>
9400</arg>
9401<arg choice="plain">
9402<replaceable class="parameter">foreground</replaceable>
9403</arg>
9404<arg choice="plain">
9405<replaceable class="parameter">background</replaceable>
9406</arg>
9407<arg choice="plain">
9408<replaceable class="parameter">pattern</replaceable>
9409</arg>
9410
9411<command><link linkend="color">uncolor</link></command>
9412<group choice="req">
9413<arg choice="plain">
9414<option>index</option>
9415</arg>
9416<arg choice="plain">
9417<option>header</option>
9418</arg>
9419<arg choice="plain">
9420<option>body</option>
9421</arg>
9422</group>
9423<group choice="req">
9424<arg choice="plain">
9425<replaceable>*</replaceable>
9426</arg>
9427<arg choice="plain" rep="repeat">
9428<replaceable>pattern</replaceable>
9429</arg>
9430</group>
9431</cmdsynopsis>
9432</listitem>
9433
9434<listitem>
9435<cmdsynopsis>
9436<command><link linkend="crypt-hook">crypt-hook</link></command>
9437<arg choice="plain">
9438<replaceable class="parameter">regexp</replaceable>
9439</arg>
9440<arg choice="plain">
9441<replaceable class="parameter">keyid</replaceable>
9442</arg>
9443</cmdsynopsis>
9444</listitem>
9445
9446<listitem>
9447<cmdsynopsis>
9448<command><link linkend="exec">exec</link></command>
9449<arg choice="plain">
9450<replaceable class="parameter">function</replaceable>
9451</arg>
9452<arg choice="opt" rep="repeat">
9453<replaceable class="parameter">function</replaceable>
9454</arg>
9455</cmdsynopsis>
9456</listitem>
9457
9458<listitem>
9459<cmdsynopsis>
9460<command><link linkend="fcc-hook">fcc-hook</link></command>
9461<arg choice="plain">
9462<replaceable class="parameter">[!]pattern</replaceable>
9463</arg>
9464<arg choice="plain">
9465<replaceable class="parameter">mailbox</replaceable>
9466</arg>
9467</cmdsynopsis>
9468</listitem>
9469
9470<listitem>
9471<cmdsynopsis>
9472<command><link linkend="fcc-save-hook">fcc-save-hook</link></command>
9473<arg choice="plain">
9474<replaceable class="parameter">[!]pattern</replaceable>
9475</arg>
9476<arg choice="plain">
9477<replaceable class="parameter">mailbox</replaceable>
9478</arg>
9479</cmdsynopsis>
9480</listitem>
9481
9482<listitem>
9483<cmdsynopsis>
9484<command><link linkend="folder-hook">folder-hook</link></command>
9485<arg choice="plain">
9486<replaceable class="parameter">[!]regexp</replaceable>
9487</arg>
9488<arg choice="plain">
9489<replaceable class="parameter">command</replaceable>
9490</arg>
9491</cmdsynopsis>
9492</listitem>
9493
9494<listitem>
9495<cmdsynopsis>
9496<command><link linkend="addrgroup">group</link></command>
9497<arg choice="opt" rep="repeat">
9498<option>-group</option>
9499<replaceable class="parameter">name</replaceable>
9500</arg>
9501<group choice="req">
9502<arg choice="plain" rep="repeat">
9503<option>-rx</option>
9504<replaceable class="parameter">expr</replaceable>
9505</arg>
9506<arg choice="plain" rep="repeat">
9507<option>-addr</option>
9508<replaceable class="parameter">expr</replaceable>
9509</arg>
9510</group>
9511
9512<command><link linkend="addrgroup">ungroup</link></command>
9513<arg choice="opt" rep="repeat">
9514<option>-group</option>
9515<replaceable class="parameter">name</replaceable>
9516</arg>
9517<group choice="req">
9518<arg choice="plain">
9519<replaceable class="parameter">*</replaceable>
9520</arg>
9521<arg choice="plain" rep="repeat">
9522<option>-rx</option>
9523<replaceable class="parameter">expr</replaceable>
9524</arg>
9525<arg choice="plain" rep="repeat">
9526<option>-addr</option>
9527<replaceable class="parameter">expr</replaceable>
9528</arg>
9529</group>
9530</cmdsynopsis>
9531</listitem>
9532
9533<listitem>
9534<cmdsynopsis>
9535<command><link linkend="hdr-order">hdr_order</link></command>
9536<arg choice="plain">
9537<replaceable class="parameter">header</replaceable>
9538</arg>
9539<arg choice="opt" rep="repeat">
9540<replaceable class="parameter">header</replaceable>
9541</arg>
9542
9543<command><link linkend="hdr-order">unhdr_order</link></command>
9544<group choice="req">
9545<arg choice="plain">
9546<replaceable>*</replaceable>
9547</arg>
9548<arg choice="plain" rep="repeat">
9549<replaceable>header</replaceable>
9550</arg>
9551</group>
9552</cmdsynopsis>
9553</listitem>
9554
9555<listitem>
9556<cmdsynopsis>
9557<command><link linkend="ignore">ignore</link></command>
9558<arg choice="plain">
9559<replaceable class="parameter">pattern</replaceable>
9560</arg>
9561<arg choice="opt" rep="repeat">
9562<replaceable class="parameter">pattern</replaceable>
9563</arg>
9564
9565<command><link linkend="ignore">unignore</link></command>
9566<group choice="req">
9567<arg choice="plain">
9568<replaceable>*</replaceable>
9569</arg>
9570<arg choice="plain" rep="repeat">
9571<replaceable>pattern</replaceable>
9572</arg>
9573</group>
9574</cmdsynopsis>
9575</listitem>
9576
9577<listitem>
9578<cmdsynopsis>
9579<command><link linkend="lists">lists</link></command>
9580<arg>
9581<option>-group</option>
9582<replaceable class="parameter">name</replaceable>
9583</arg>
9584<arg choice="plain">
9585<replaceable class="parameter">regexp</replaceable>
9586</arg>
9587<arg choice="opt" rep="repeat">
9588<replaceable class="parameter">regexp</replaceable>
9589</arg>
9590
9591<command><link linkend="lists">unlists</link></command>
9592<arg choice="opt" rep="repeat">
9593<option>-group</option>
9594<replaceable>name</replaceable>
9595</arg>
9596<group choice="req">
9597<arg choice="plain">
9598<replaceable>*</replaceable>
9599</arg>
9600<arg choice="plain" rep="repeat">
9601<replaceable>regexp</replaceable>
9602</arg>
9603</group>
9604</cmdsynopsis>
9605</listitem>
9606
9607<listitem>
9608<cmdsynopsis>
9609<command><link linkend="macro">macro</link></command>
9610<arg choice="plain">
9611<replaceable class="parameter">menu</replaceable>
9612</arg>
9613<arg choice="plain">
9614<replaceable class="parameter">key</replaceable>
9615</arg>
9616<arg choice="plain">
9617<replaceable class="parameter">sequence</replaceable>
9618</arg>
9619<arg choice="opt">
9620<replaceable class="parameter">description</replaceable>
9621</arg>
9622</cmdsynopsis>
9623</listitem>
9624
9625<listitem>
9626<cmdsynopsis>
9627<command><link linkend="mailboxes">mailboxes</link></command>
9628<arg choice="plain">
9629<replaceable class="parameter">mailbox</replaceable>
9630</arg>
9631<arg choice="opt" rep="repeat">
9632<replaceable class="parameter">mailbox</replaceable>
9633</arg>
9634
9635<command><link linkend="mailboxes">unmailboxes</link></command>
9636<group choice="req">
9637<arg choice="plain">
9638<replaceable class="parameter">*</replaceable>
9639</arg>
9640<arg choice="plain" rep="repeat">
9641<replaceable class="parameter">mailbox</replaceable>
9642</arg>
9643</group>
9644</cmdsynopsis>
9645</listitem>
9646
9647<listitem>
9648<cmdsynopsis>
9649<command><link linkend="mailto-allow">mailto_allow</link></command>
9650<group choice="req">
9651<arg choice="plain">
9652<replaceable class="parameter">*</replaceable>
9653</arg>
9654<arg choice="plain" rep="repeat">
9655<replaceable class="parameter">header-field</replaceable>
9656</arg>
9657</group>
9658
9659<command><link linkend="mailto-allow">unmailto_allow</link></command>
9660<group choice="req">
9661<arg choice="plain">
9662<replaceable class="parameter">*</replaceable>
9663</arg>
9664<arg choice="plain" rep="repeat">
9665<replaceable class="parameter">header-field</replaceable>
9666</arg>
9667</group>
9668</cmdsynopsis>
9669</listitem>
9670
9671<listitem>
9672<cmdsynopsis>
9673<command><link linkend="mbox-hook">mbox-hook</link></command>
9674<arg choice="plain">
9675<replaceable class="parameter">[!]regexp</replaceable>
9676</arg>
9677<arg choice="plain">
9678<replaceable class="parameter">mailbox</replaceable>
9679</arg>
9680</cmdsynopsis>
9681</listitem>
9682
9683<listitem>
9684<cmdsynopsis>
9685<command><link linkend="message-hook">message-hook</link></command>
9686<arg choice="plain">
9687<replaceable class="parameter">[!]pattern</replaceable>
9688</arg>
9689<arg choice="plain">
9690<replaceable class="parameter">command</replaceable>
9691</arg>
9692</cmdsynopsis>
9693</listitem>
9694
9695<listitem>
9696<cmdsynopsis>
9697<command><link linkend="mime-lookup">mime_lookup</link></command>
9698<arg choice="plain">
9699<replaceable>mimetype</replaceable>
9700</arg>
9701<arg choice="opt" rep="repeat">
9702<replaceable>mimetype</replaceable>
9703</arg>
9704
9705<command><link linkend="mime-lookup">unmime_lookup</link></command>
9706<group choice="req">
9707<arg choice="plain">
9708<replaceable>*</replaceable>
9709</arg>
9710<arg choice="plain" rep="repeat">
9711<replaceable>mimetype</replaceable>
9712</arg>
9713</group>
9714</cmdsynopsis>
9715</listitem>
9716
9717<listitem>
9718<cmdsynopsis>
9719<command><link linkend="mono">mono</link></command>
9720<arg choice="plain">
9721<replaceable class="parameter">object</replaceable>
9722</arg>
9723<arg choice="plain">
9724<replaceable class="parameter">attribute</replaceable>
9725</arg>
9726
9727<command><link linkend="mono">mono</link></command>
9728<group choice="req">
9729<arg choice="plain">
9730<option>header</option>
9731</arg>
9732<arg choice="plain">
9733<option>body</option>
9734</arg>
9735</group>
9736<arg choice="plain">
9737<replaceable class="parameter">attribute</replaceable>
9738</arg>
9739<arg choice="plain">
9740<replaceable class="parameter">regexp</replaceable>
9741</arg>
9742
9743<command><link linkend="mono">mono</link></command>
9744<arg choice="plain">
9745<option>index</option>
9746</arg>
9747<arg choice="plain">
9748<replaceable class="parameter">attribute</replaceable>
9749</arg>
9750<arg choice="plain">
9751<replaceable class="parameter">pattern</replaceable>
9752</arg>
9753
9754<command><link linkend="mono">unmono</link></command>
9755<group choice="req">
9756<arg choice="plain">
9757<option>index</option>
9758</arg>
9759<arg choice="plain">
9760<option>header</option>
9761</arg>
9762<arg choice="plain">
9763<option>body</option>
9764</arg>
9765</group>
9766<group choice="req">
9767<arg choice="plain">
9768<replaceable class="parameter">*</replaceable>
9769</arg>
9770<arg choice="plain" rep="repeat">
9771<replaceable class="parameter">pattern</replaceable>
9772</arg>
9773</group>
9774</cmdsynopsis>
9775</listitem>
9776
9777<listitem>
9778<cmdsynopsis>
9779<command><link linkend="my-hdr">my_hdr</link></command>
9780<arg choice="plain">
9781<replaceable class="parameter">string</replaceable>
9782</arg>
9783
9784<command><link linkend="my-hdr">unmy_hdr</link></command>
9785<group choice="req">
9786<arg choice="plain">
9787<replaceable class="parameter">*</replaceable>
9788</arg>
9789<arg choice="plain" rep="repeat">
9790<replaceable class="parameter">field</replaceable>
9791</arg>
9792</group>
9793</cmdsynopsis>
9794</listitem>
9795
9796<listitem>
9797<cmdsynopsis>
9798<command><link linkend="push">push</link></command>
9799<arg choice="plain">
9800<replaceable class="parameter">string</replaceable>
9801</arg>
9802</cmdsynopsis>
9803</listitem>
9804
9805<listitem>
9806<cmdsynopsis>
9807<command><link linkend="save-hook">save-hook</link></command>
9808<arg choice="plain">
9809<replaceable class="parameter">[!]pattern</replaceable>
9810</arg>
9811<arg choice="plain">
9812<replaceable class="parameter">mailbox</replaceable>
9813</arg>
9814</cmdsynopsis>
9815</listitem>
9816
9817<listitem>
9818<cmdsynopsis>
9819<command><link linkend="score">score</link></command>
9820<arg choice="plain">
9821<replaceable class="parameter">pattern</replaceable>
9822</arg>
9823<arg choice="plain">
9824<replaceable class="parameter">value</replaceable>
9825</arg>
9826
9827<command><link linkend="score">unscore</link></command>
9828<group choice="req">
9829<arg choice="plain">
9830<replaceable class="parameter">*</replaceable>
9831</arg>
9832<arg choice="plain" rep="repeat">
9833<replaceable class="parameter">pattern</replaceable>
9834</arg>
9835</group>
9836</cmdsynopsis>
9837</listitem>
9838
9839<listitem>
9840<cmdsynopsis>
9841<command><link linkend="reply-hook">reply-hook</link></command>
9842<arg choice="plain">
9843<replaceable class="parameter">[!]pattern</replaceable>
9844</arg>
9845<arg choice="plain">
9846<replaceable class="parameter">command</replaceable>
9847</arg>
9848</cmdsynopsis>
9849</listitem>
9850
9851<listitem>
9852<cmdsynopsis>
9853<command><link linkend="send-hook">send-hook</link></command>
9854<arg choice="plain">
9855<replaceable class="parameter">[!]pattern</replaceable>
9856</arg>
9857<arg choice="plain">
9858<replaceable class="parameter">command</replaceable>
9859</arg>
9860</cmdsynopsis>
9861</listitem>
9862
9863<listitem>
9864<cmdsynopsis>
9865<command><link linkend="send2-hook">send2-hook</link></command>
9866<arg choice="plain">
9867<replaceable class="parameter">[!]pattern</replaceable>
9868</arg>
9869<arg choice="plain">
9870<replaceable class="parameter">command</replaceable>
9871</arg>
9872</cmdsynopsis>
9873</listitem>
9874
9875<listitem>
9876<cmdsynopsis>
9877<command><link linkend="set">set</link></command>
9878<group choice="req">
9879<arg choice="plain">
9880<group choice="opt">
9881<arg choice="plain"><option>no</option></arg>
9882<arg choice="plain"><option>inv</option></arg>
9883</group>
9884<replaceable class="parameter">variable</replaceable>
9885</arg>
9886<arg choice="plain">
9887<replaceable class="parameter">variable=value</replaceable>
9888</arg>
9889</group>
9890<arg choice="opt" rep="repeat"></arg>
9891
9892<command><link linkend="set">toggle</link></command>
9893<arg choice="plain">
9894<replaceable class="parameter">variable</replaceable>
9895</arg>
9896<arg choice="opt" rep="repeat">
9897<replaceable class="parameter">variable</replaceable>
9898</arg>
9899
9900<command><link linkend="set">unset</link></command>
9901<arg choice="plain">
9902<replaceable class="parameter">variable</replaceable>
9903</arg>
9904<arg choice="opt" rep="repeat">
9905<replaceable class="parameter">variable</replaceable>
9906</arg>
9907
9908<command><link linkend="set">reset</link></command>
9909<arg choice="plain">
9910<replaceable class="parameter">variable</replaceable>
9911</arg>
9912<arg choice="opt" rep="repeat">
9913<replaceable class="parameter">variable</replaceable>
9914</arg>
9915</cmdsynopsis>
9916</listitem>
9917
9918<listitem>
9919 <cmdsynopsis>
9920 <command><link linkend="setenv">setenv</link></command>
9921 <arg choice="plain">
9922 <replaceable class="parameter">[?]variable</replaceable>
9923 </arg>
9924 <arg choice="opt">
9925 <replaceable class="parameter">value</replaceable>
9926 </arg>
9927
9928 <command><link linkend="setenv">unsetenv</link></command>
9929 <arg choice="plain">
9930 <replaceable class="parameter">variable</replaceable>
9931 </arg>
9932 </cmdsynopsis>
9933</listitem>
9934
9935<listitem>
9936<cmdsynopsis>
9937<command><link linkend="sidebar-whitelist">sidebar_whitelist</link></command>
9938<arg choice="plain">
9939<replaceable class="parameter">mailbox</replaceable>
9940</arg>
9941<arg choice="opt" rep="repeat">
9942<replaceable class="parameter">mailbox</replaceable>
9943</arg>
9944
9945<command><link linkend="unsidebar-whitelist">unsidebar_whitelist</link></command>
9946<group choice="req">
9947<arg choice="plain">
9948<replaceable class="parameter">*</replaceable>
9949</arg>
9950<arg choice="plain" rep="repeat">
9951<replaceable class="parameter">mailbox</replaceable>
9952</arg>
9953</group>
9954</cmdsynopsis>
9955</listitem>
9956
9957<listitem>
9958<cmdsynopsis>
9959<command><link linkend="source">source</link></command>
9960<arg choice="plain">
9961<replaceable class="parameter">filename</replaceable>
9962</arg>
9963</cmdsynopsis>
9964</listitem>
9965
9966<listitem>
9967<cmdsynopsis>
9968<command><link linkend="spam">spam</link></command>
9969<arg choice="plain">
9970<replaceable class="parameter">pattern</replaceable>
9971</arg>
9972<arg choice="plain">
9973<replaceable class="parameter">format</replaceable>
9974</arg>
9975
9976<command><link linkend="spam">nospam</link></command>
9977<group choice="req">
9978<arg choice="plain">
9979<replaceable class="parameter">*</replaceable>
9980</arg>
9981<arg choice="plain">
9982<replaceable class="parameter">pattern</replaceable>
9983</arg>
9984</group>
9985</cmdsynopsis>
9986</listitem>
9987
9988<listitem>
9989<cmdsynopsis>
9990<command><link linkend="subscribe">subscribe</link></command>
9991<arg choice="opt" rep="repeat">
9992<option>-group</option>
9993<replaceable class="parameter">name</replaceable>
9994</arg>
9995<arg choice="plain">
9996<replaceable class="parameter">regexp</replaceable>
9997</arg>
9998<arg choice="opt" rep="repeat">
9999<replaceable class="parameter">regexp</replaceable>
10000</arg>
10001
10002<command><link linkend="subscribe">unsubscribe</link></command>
10003<arg choice="opt" rep="repeat">
10004<option>-group</option>
10005<replaceable>name</replaceable>
10006</arg>
10007<group choice="req">
10008<arg choice="plain">
10009<replaceable class="parameter">*</replaceable>
10010</arg>
10011<arg choice="plain" rep="repeat">
10012<replaceable class="parameter">regexp</replaceable>
10013</arg>
10014</group>
10015</cmdsynopsis>
10016</listitem>
10017
10018<listitem>
10019<cmdsynopsis>
10020<command><link linkend="unhook">unhook</link></command>
10021<group choice="req">
10022<arg choice="plain">
10023<replaceable class="parameter">*</replaceable>
10024</arg>
10025<arg choice="plain">
10026<replaceable class="parameter">hook-type</replaceable>
10027</arg>
10028</group>
10029</cmdsynopsis>
10030</listitem>
10031
10032</itemizedlist>
10033
10034</sect1>
10035
10036<sect1 id="variables">
10037<title>Configuration Variables</title>