1
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Configuration</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="gettingstarted.html" title="Chapter 2. Getting Started" /><link rel="next" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><style xmlns="" type="text/css">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Configuration</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="gettingstarted.html" title="Chapter 2. Getting Started" /><link rel="next" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><style xmlns="" type="text/css">
4
4
body { margin-left:2%; margin-right:2%; font-family:serif; }
5
5
.toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
6
6
h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
7
em.replaceable code { font-family:sans-serif; }
8
7
p { text-align:justify; }
9
8
div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
10
9
.email, .email a { font-family:monospace; }
11
div.table-contents table { border-collapse:collapse; border:1px solid #c0c0c0; }
12
div.table-contents table td, div.table-contents table th { padding:5px; text-align:left; }
13
div.table-contents table th {
10
div.table-contents table, div.informaltable table { border-collapse:collapse; border:1px solid #c0c0c0; }
11
div.table-contents table td, div.informaltable td, div.table-contents table th, div.informaltable table th { padding:5px; text-align:left; }
12
div.table-contents table th, div.informaltable table th {
14
13
font-family:sans-serif;
15
14
background:#d0d0d0;
16
15
font-weight:normal;
17
16
vertical-align:top;
19
pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; }
18
div.cmdsynopsis { border-left:1px solid #707070; padding-left:5px; }
19
li div.cmdsynopsis { border-left:none; padding-left:0px; }
20
pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; margin-left:2%; margin-right:2%; }
21
div.example p.title { margin-left:2%; }
20
22
div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
21
23
div.note h3:after { content: ":" }
22
24
div.note { margin-bottom: 5px; }
25
strong.command { font-family: monospace; font-weight: normal; }
26
tr { vertical-align: top; }
24
</style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Configuration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="configuration"></a>Chapter 3. Configuration</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="configuration.html#configuration-files">1. Location of initialization files</a></span></dt><dt><span class="sect1"><a href="configuration.html#muttrc-syntax">2. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">3. Address groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">4. Defining/Using aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">5. Changing the default key bindings</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">6. Defining aliases for character sets </a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">7. Setting variables based upon mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">8. Keyboard macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">9. Using color and mono video attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#ignore">10. Message header display</a></span></dt><dt><span class="sect1"><a href="configuration.html#alternates">11. Alternative addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">12. Mailing lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">13. Using Multiple spool mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">14. Monitoring incoming mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">15. User defined headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">16. Specify default save mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">17. Specify default Fcc: mailbox when composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">18. Specify default save filename and default Fcc: mailbox at once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">19. Change settings based upon message recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">20. Change settings before formatting a message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">21. Choosing the cryptographic key of the recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">22. Adding key sequences to the keyboard buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">23. Executing functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">24. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">25. Spam detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">26. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#set-commands">26.1. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">26.2. User-defined variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">27. Reading initialization commands from another file</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">28. Removing hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">29. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">29.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">29.2. Filters</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="configuration-files"></a>1. Location of initialization files</h2></div></div></div><p>
28
</style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Configuration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="configuration"></a>Chapter 3. Configuration</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="configuration.html#configuration-files">1. Location of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#muttrc-syntax">2. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">3. Address Groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">4. Defining/Using Aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">5. Changing the Default Key Bindings</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">6. Defining Aliases for Character Sets</a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">7. Setting Variables Based Upon Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">8. Keyboard Macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">9. Using Color and Mono Video Attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#msg-hdr-display">10. Message Header Display</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#ignore">10.1. Selecting Headers</a></span></dt><dt><span class="sect2"><a href="configuration.html#hdr-order">10.2. Ordering Displayed Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#alternates">11. Alternative Addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">12. Mailing Lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">13. Using Multiple Spool Mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">14. Monitoring Incoming Mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">15. User-Defined Headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">16. Specify Default Save Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">17. Specify Default Fcc: Mailbox When Composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">18. Specify Default Save Filename and Default Fcc: Mailbox at Once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">19. Change Settings Based Upon Message Recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">20. Change Settings Before Formatting a Message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">21. Choosing the Cryptographic Key of the Recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">22. Adding Key Sequences to the Keyboard Buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">23. Executing Functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">24. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">25. Spam Detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">26. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#var-types">26.1. Variable Types</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-commands">26.2. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">26.3. User-Defined Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">27. Reading Initialization Commands From Another File</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">28. Removing Hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">29. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">29.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-conditionals">29.2. Conditionals</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">29.3. Filters</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-padding">29.4. Padding</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="configuration-files"></a>1. Location of Initialization Files</h2></div></div></div><p>
25
29
While the default configuration (or “<span class="quote">preferences</span>”) make Mutt
26
30
usable right out of the box, it is often desirable to tailor Mutt to
27
31
suit your own tastes. When Mutt is first invoked, it will attempt to
28
32
read the “<span class="quote">system</span>” configuration file (defaults set by your local
29
system administrator), unless the “<span class="quote">-n</span>” <a class="link" href="reference.html#commandline" title="1. Command line options">command line</a> option is specified. This file is typically
33
system administrator), unless the “<span class="quote">-n</span>” <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> option is specified. This file is typically
30
34
<code class="literal">/usr/local/share/mutt/Muttrc</code> or <code class="literal">/etc/Muttrc</code>. Mutt
31
35
will next look for a file named <code class="literal">.muttrc</code> in your home
32
36
directory. If this file does not exist and your home directory has
33
a subdirectory named <code class="literal">.mutt</code>, mutt try to load a file named
37
a subdirectory named <code class="literal">.mutt</code>, Mutt tries to load a file named
34
38
<code class="literal">.mutt/muttrc</code>.
36
40
<code class="literal">.muttrc</code> is the file where you will usually place your <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a> to configure Mutt.
38
In addition, mutt supports version specific configuration files that are
42
In addition, Mutt supports version specific configuration files that are
39
43
parsed instead of the default files as explained above. For instance, if
40
44
your system has a <code class="literal">Muttrc-0.88</code> file in the system configuration
41
directory, and you are running version 0.88 of mutt, this file will be
45
directory, and you are running version 0.88 of Mutt, this file will be
42
46
sourced instead of the <code class="literal">Muttrc</code> file. The same is true of the user
43
47
configuration file, if you have a file <code class="literal">.muttrc-0.88.6</code> in your home
44
directory, when you run mutt version 0.88.6, it will source this file
48
directory, when you run Mutt version 0.88.6, it will source this file
45
49
instead of the default <code class="literal">.muttrc</code> file. The version number is the
46
same which is visible using the “<span class="quote">-v</span>” <a class="link" href="reference.html#commandline" title="1. Command line options">command line</a> switch or using the <code class="literal">show-version</code> key (default:
50
same which is visible using the “<span class="quote">-v</span>” <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> switch or using the <code class="literal">show-version</code> key (default:
47
51
V) from the index menu.
48
52
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="muttrc-syntax"></a>2. Syntax of Initialization Files</h2></div></div></div><p>
49
53
An initialization file consists of a series of <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a>. Each line of the file may contain one or more commands.
50
54
When multiple commands are used, they must be separated by a semicolon
55
(“<span class="quote">;</span>”).
52
56
</p><div class="example"><a id="ex-rc-multiple-cmds"></a><p class="title"><b>Example 3.1. Multiple configuration commands per line</b></p><div class="example-contents"><pre class="screen">
53
57
set realname='Mutt user' ; ignore x-
54
58
</pre></div></div><br class="example-break" /><p>
55
59
The hash mark, or pound sign
56
60
(“<span class="quote">#</span>”), is used as a “<span class="quote">comment</span>” character. You can use it to
57
61
annotate your initialization file. All text after the comment character
58
to the end of the line is ignored. For example,
62
to the end of the line is ignored.
59
63
</p><div class="example"><a id="ex-ec-comment"></a><p class="title"><b>Example 3.2. Commenting configuration files</b></p><div class="example-contents"><pre class="screen">
60
64
my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
61
65
</pre></div></div><br class="example-break" /><p>
62
Single quotes (') and double quotes (") can be used to quote strings
66
Single quotes (“<span class="quote">'</span>”) and double quotes (“<span class="quote">"</span>”) can be used to quote strings
63
67
which contain spaces or other special characters. The difference between
64
68
the two types of quotes is similar to that of many popular shell programs,
65
69
namely that a single quote is used to specify a literal string (one that is
66
70
not interpreted for shell variables or quoting with a backslash [see
67
71
next paragraph]), while double quotes indicate a string for which
68
72
should be evaluated. For example, backticks are evaluated inside of double
69
quotes, but <span class="bold"><strong>not</strong></span> for single quotes.
73
quotes, but <span class="emphasis"><em>not</em></span> for single quotes.
71
\ quotes the next character, just as in shells such as bash and zsh.
75
“<span class="quote">\</span>” quotes the next character, just as in shells such as bash and zsh.
72
76
For example, if want to put quotes “<span class="quote">"</span>” inside of a string, you can use
73
77
“<span class="quote">\</span>” to force the next character to be a literal instead of interpreted
79
83
“<span class="quote">\n</span>” and “<span class="quote">\r</span>” have their usual C meanings of linefeed and
80
84
carriage-return, respectively.
82
A \ at the end of a line can be used to split commands over
83
multiple lines, provided that the split points don't appear in the
84
middle of command names.
86
A “<span class="quote">\</span>” at the end of a line can be used to split commands over
87
multiple lines as it “<span class="quote">escapes</span>” the line end, provided that the split points don't appear in the
88
middle of command names. Lines are first concatenated before
89
interpretation so that a multi-line can be commented by commenting out
91
</p><div class="example"><a id="ex-rc-split"></a><p class="title"><b>Example 3.4. Splitting long configuration commands over several lines</b></p><div class="example-contents"><pre class="screen">
92
set status_format="some very \
95
</pre></div></div><br class="example-break" /><p>
86
96
It is also possible to substitute the output of a Unix command in an
87
97
initialization file. This is accomplished by enclosing the command in
88
backticks (``). For example,
89
</p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><b>Example 3.4. Using external command's output in configuration files</b></p><div class="example-contents"><pre class="screen">
90
my_hdr X-Operating-System: `uname -a`
91
</pre></div></div><br class="example-break" /><p>
92
The output of the Unix command “<span class="quote">uname -a</span>” will be substituted before the
98
backticks (``). In <a class="xref" href="configuration.html#ex-rc-backtick" title="Example 3.5. Using external command's output in configuration files">Example 3.5, “Using external command's output in configuration files”</a>, the output of the
99
Unix command “<span class="quote">uname -a</span>” will be substituted before the
94
</p><div class="note"><h3 class="title">Note</h3><p>
95
101
Since initialization files are line oriented, only
96
102
the first line of output from the Unix command will be substituted.
98
Both environment variables and mutt variables can be accessed by
103
</p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><b>Example 3.5. Using external command's output in configuration files</b></p><div class="example-contents"><pre class="screen">
104
my_hdr X-Operating-System: `uname -a`
105
</pre></div></div><br class="example-break" /><p>
106
Both environment variables and Mutt variables can be accessed by
99
107
prepending “<span class="quote">$</span>” to the name of the variable. For example,
100
</p><div class="example"><a id="ex-rc-env"></a><p class="title"><b>Example 3.5. Using environment variables in configuration files</b></p><div class="example-contents"><pre class="screen">
108
</p><div class="example"><a id="ex-rc-env"></a><p class="title"><b>Example 3.6. Using environment variables in configuration files</b></p><div class="example-contents"><pre class="screen">
101
109
set record=+sent_on_$HOSTNAME
102
110
</pre></div></div><br class="example-break" /><p>
103
will cause mutt to save outgoing messages to a folder named
104
“<span class="quote">sent_on_kremvax</span>” if the environment variable HOSTNAME is set to
105
“<span class="quote">kremvax.</span>” (See <a class="link" href="reference.html#record" title="3.240. record">$record</a> for
111
will cause Mutt to save outgoing messages to a folder named
112
“<span class="quote">sent_on_kremvax</span>” if the environment variable <code class="literal">$HOSTNAME</code> is set to
113
“<span class="quote">kremvax.</span>” (See <a class="link" href="reference.html#record" title="3.211. record">$record</a> for
108
116
Mutt expands the variable when it is assigned, not when it is used. If
152
162
<code class="option">-addr</code>
153
163
<em class="replaceable"><code>expr</code></em>
154
164
... }</p></div><p>
155
<code class="literal">group</code> is used to directly add either addresses or
165
<span class="command"><strong>group</strong></span> is used to directly add either addresses or
156
166
regular expressions to the specified group or groups. The different
157
categories of arguments to the <code class="literal">group</code> command can be
167
categories of arguments to the <span class="command"><strong>group</strong></span> command can be
158
168
in any order. The flags <code class="literal">-rx</code> and
159
169
<code class="literal">-addr</code> specify what the following strings (that cannot
160
170
begin with a hyphen) should be interpreted as: either a regular
161
171
expression or an email address, respectively.
163
173
These address groups can also be created implicitly by the
164
<a class="link" href="configuration.html#alias" title="4. Defining/Using aliases">alias</a>, <a class="link" href="configuration.html#lists" title="12. Mailing lists">lists</a>,
165
<a class="link" href="configuration.html#lists" title="12. Mailing lists">subscribe</a> and
166
<a class="link" href="configuration.html#alternates" title="11. Alternative addresses">alternates</a> commands by specifying the
174
<a class="link" href="configuration.html#alias" title="4. Defining/Using Aliases"><span class="command"><strong>alias</strong></span></a>, <a class="link" href="configuration.html#lists" title="12. Mailing Lists">lists</a>,
175
<a class="link" href="configuration.html#lists" title="12. Mailing Lists">subscribe</a> and
176
<a class="link" href="configuration.html#alternates" title="11. Alternative Addresses"><span class="command"><strong>alternates</strong></span></a> commands by specifying the
167
177
optional <code class="literal">-group</code> option.
169
179
Once defined, these address groups can be used in
170
180
<a class="link" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">patterns</a> to search for and limit the
171
181
display to messages matching a group.
173
<code class="literal">ungroup</code> is used to remove addresses or regular
183
<span class="command"><strong>ungroup</strong></span> is used to remove addresses or regular
174
184
expressions from the specified group or groups. The syntax is similar to
175
the <code class="literal">group</code> command, however the special character
185
the <span class="command"><strong>group</strong></span> command, however the special character
176
186
<code class="literal">*</code> can be used to empty a group of all of its
178
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>4. Defining/Using aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
188
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>4. Defining/Using Aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
179
189
<code class="option">-group</code>
180
190
<em class="replaceable"><code>name</code></em>
184
194
<em class="replaceable"><code>address</code></em>
186
196
<em class="replaceable"><code>address</code></em>
197
...]<br /><code class="command">unalias</code> [
198
<code class="option">-group</code>
199
<em class="replaceable"><code>name</code></em>
201
<em class="replaceable"><code>*</code></em>
203
<em class="replaceable"><code>key</code></em>
188
205
It's usually very cumbersome to remember or type out the address of someone
189
206
you are communicating with. Mutt allows you to create “<span class="quote">aliases</span>” which map
190
207
a short string to a full address.
191
208
</p><div class="note"><h3 class="title">Note</h3><p>
192
209
If you want to create an alias for more than
193
one address, you <span class="bold"><strong>must</strong></span> separate the addresses with a comma (“<span class="quote">,</span>”).
210
one address, you <span class="emphasis"><em>must</em></span> separate the addresses with a comma (“<span class="quote">,</span>”).
195
212
The optional <code class="literal">-group</code> argument to
196
<code class="literal">alias</code> causes the aliased address(es) to be added to
213
<span class="command"><strong>alias</strong></span> causes the aliased address(es) to be added to
197
214
the named <span class="emphasis"><em>group</em></span>.
199
216
To remove an alias or aliases (“<span class="quote">*</span>” means all aliases):
200
</p><div class="cmdsynopsis"><p><code class="command">unalias</code> [
201
<code class="option">-group</code>
202
<em class="replaceable"><code>name</code></em>
204
<em class="replaceable"><code>*</code></em>
206
<em class="replaceable"><code>key</code></em>
207
... }</p></div><pre class="screen">
217
</p><pre class="screen">
208
218
alias muttdude me@cs.hmc.edu (Michael Elkins)
209
219
alias theguys manny, moe, jack
211
221
Unlike other mailers, Mutt doesn't require aliases to be defined
212
in a special file. The <code class="literal">alias</code> command can appear anywhere in
213
a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="27. Reading initialization commands from another file">sourced</a>. Consequently, you can have multiple alias files, or
214
you can have all aliases defined in your muttrc.
222
in a special file. The <span class="command"><strong>alias</strong></span> command can appear anywhere in
223
a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span>d</a>. Consequently, you can have multiple alias files, or
224
you can have all aliases defined in your <code class="literal">.muttrc</code>.
216
226
On the other hand, the <a class="link" href="gettingstarted.html#create-alias"><code class="literal"><create-alias></code></a>
217
227
function can use only one file, the one pointed to by the <a class="link" href="reference.html#alias-file" title="3.3. alias_file">$alias_file</a> variable (which is
218
228
<code class="literal">˜/.muttrc</code> by default). This file is not special either,
219
229
in the sense that Mutt will happily append aliases to any file, but in
220
order for the new aliases to take effect you need to explicitly <a class="link" href="configuration.html#source" title="27. Reading initialization commands from another file">source</a> this file too.
223
</p><div class="example"><a id="ex-alias-external"></a><p class="title"><b>Example 3.6. Configuring external alias files</b></p><div class="example-contents"><pre class="screen">
230
order for the new aliases to take effect you need to explicitly <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> this file too.
231
</p><div class="example"><a id="ex-alias-external"></a><p class="title"><b>Example 3.7. Configuring external alias files</b></p><div class="example-contents"><pre class="screen">
224
232
source /usr/local/share/Mutt.aliases
225
233
source ~/.mail_aliases
226
234
set alias_file=~/.mail_aliases
227
235
</pre></div></div><br class="example-break" /><p>
228
To use aliases, you merely use the alias at any place in mutt where mutt
236
To use aliases, you merely use the alias at any place in Mutt where Mutt
229
237
prompts for addresses, such as the <span class="emphasis"><em>To:</em></span> or <span class="emphasis"><em>Cc:</em></span> prompt. You can
230
238
also enter aliases in your editor at the appropriate headers if you have the
231
<a class="link" href="reference.html#edit-headers" title="3.50. edit_headers">$edit_headers</a> variable set.
239
<a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> variable set.
233
241
In addition, at the various address prompts, you can use the tab character
234
242
to expand a partial alias to the full alias. If there are multiple matches,
235
mutt will bring up a menu with the matching aliases. In order to be
236
presented with the full list of aliases, you must hit tab with out a partial
243
Mutt will bring up a menu with the matching aliases. In order to be
244
presented with the full list of aliases, you must hit tab without a partial
237
245
alias, such as at the beginning of the prompt or after a comma denoting
238
246
multiple addresses.
240
248
In the alias menu, you can select as many aliases as you want with the
241
249
<code class="literal">select-entry</code> key (default: <Return>), and use the
242
250
<span class="emphasis"><em>exit</em></span> key (default: q) to return to the address prompt.
243
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>5. Changing the default key bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
251
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>5. Changing the Default Key Bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
244
252
<em class="replaceable"><code>map</code></em>
246
254
<em class="replaceable"><code>key</code></em>
309
317
<span class="emphasis"><em>function</em></span> specifies which action to take when <span class="emphasis"><em>key</em></span> is pressed.
310
318
For a complete list of functions, see the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>. The special function <code class="literal"><noop></code> unbinds the specified key
312
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>6. Defining aliases for character sets </h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
320
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>6. Defining Aliases for Character Sets</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
313
321
<em class="replaceable"><code>alias</code></em>
315
323
<em class="replaceable"><code>charset</code></em>
316
</p></div><div class="cmdsynopsis"><p><code class="command">iconv-hook</code>
324
<br /><code class="command">iconv-hook<a id="iconv-hook"></a></code>
317
325
<em class="replaceable"><code>charset</code></em>
319
327
<em class="replaceable"><code>local-charset</code></em>
321
The <code class="literal">charset-hook</code> command defines an alias for a character set.
329
The <span class="command"><strong>charset-hook</strong></span> command defines an alias for a character set.
322
330
This is useful to properly display messages which are tagged with a
323
character set name not known to mutt.
331
character set name not known to Mutt.
325
The <code class="literal">iconv-hook</code> command defines a system-specific name for a
333
The <span class="command"><strong>iconv-hook</strong></span> command defines a system-specific name for a
326
334
character set. This is helpful when your systems character
327
335
conversion library insists on using strange, system-specific names
328
336
for character sets.
329
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>7. Setting variables based upon mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
337
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>7. Setting Variables Based Upon Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
330
338
<em class="replaceable"><code>[!]regexp</code></em>
332
340
<em class="replaceable"><code>command</code></em>
334
342
It is often desirable to change settings based on which mailbox you are
335
reading. The folder-hook command provides a method by which you can execute
343
reading. The <span class="command"><strong>folder-hook</strong></span> command provides a method by which you can execute
336
344
any configuration command. <span class="emphasis"><em>regexp</em></span> is a regular expression specifying
337
345
in which mailboxes to execute <span class="emphasis"><em>command</em></span> before loading. If a mailbox
338
matches multiple folder-hook's, they are executed in the order given in the
346
matches multiple <span class="command"><strong>folder-hook</strong></span>s, they are executed in the order given in the
347
<code class="literal">.muttrc</code>.
340
348
</p><div class="note"><h3 class="title">Note</h3><p>
341
If you use the “<span class="quote">!</span>” shortcut for <a class="link" href="reference.html#spoolfile" title="3.277. spoolfile">$spoolfile</a> at the beginning of the pattern, you must place it
349
If you use the “<span class="quote">!</span>” shortcut for <a class="link" href="reference.html#spoolfile" title="3.269. spoolfile">$spoolfile</a> at the beginning of the pattern, you must place it
342
350
inside of double or single quotes in order to distinguish it from the
343
351
logical <span class="emphasis"><em>not</em></span> operator for the expression.
344
352
</p></div><div class="note"><h3 class="title">Note</h3><p>
345
353
Settings are <span class="emphasis"><em>not</em></span> restored when you leave the mailbox.
346
354
For example, a command action to perform is to change the sorting method
347
355
based upon the mailbox being read:
348
</p></div><pre class="screen">
349
folder-hook mutt set sort=threads
357
</p><pre class="screen">
358
folder-hook mutt "set sort=threads"</pre><p>
351
360
However, the sorting method is not restored to its previous value when
352
361
reading a different mailbox. To specify a <span class="emphasis"><em>default</em></span> command, use the
353
pattern “<span class="quote">.</span>” before other folder-hooks adjusting a value on a per-folder basis
354
because folder-hooks are evaluated in the order given in the configuration file.
355
The following example will set the <a class="link" href="reference.html#sort" title="3.271. sort">sort</a> variable
362
pattern “<span class="quote">.</span>” before other <span class="command"><strong>folder-hook</strong></span>s adjusting a value on a per-folder basis
363
because <span class="command"><strong>folder-hook</strong></span>s are evaluated in the order given in the
366
The following example will set the <a class="link" href="reference.html#sort" title="3.263. sort">sort</a> variable
356
367
to <code class="literal">date-sent</code> for all folders but to <code class="literal">threads</code>
357
368
for all folders containing “<span class="quote">mutt</span>” in their name.
358
</p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><b>Example 3.7. Setting sort method based on mailbox name</b></p><div class="example-contents"><pre class="screen">
359
folder-hook . set sort=date-sent
360
folder-hook mutt set sort=threads
361
</pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>8. Keyboard macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
369
</p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><b>Example 3.8. Setting sort method based on mailbox name</b></p><div class="example-contents"><pre class="screen">
370
folder-hook . "set sort=date-sent"
371
folder-hook mutt "set sort=threads"
372
</pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>8. Keyboard Macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
362
373
<em class="replaceable"><code>menu</code></em>
364
375
<em class="replaceable"><code>key</code></em>
521
540
For example, if you do “<span class="quote">ignore x-</span>” it is possible to “<span class="quote">unignore x-mailer</span>”.
523
542
“<span class="quote">unignore *</span>” will remove all tokens from the ignore list.
526
</p><div class="example"><a id="ex-header-weeding"></a><p class="title"><b>Example 3.8. Header weeding</b></p><div class="example-contents"><pre class="screen">
543
</p><div class="example"><a id="ex-header-weeding"></a><p class="title"><b>Example 3.9. Header weeding</b></p><div class="example-contents"><pre class="screen">
527
544
# Sven's draconian header weeding
529
546
unignore from date subject to cc
530
547
unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
531
548
unignore posted-to:
532
</pre></div></div><br class="example-break" /><a id="hdr-order"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
549
</pre></div></div><br class="example-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-order"></a>10.2. Ordering Displayed Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
533
550
<em class="replaceable"><code>header</code></em>
535
552
<em class="replaceable"><code>header</code></em>
536
...]</p></div><div class="cmdsynopsis"><p><code class="command">unhdr_order</code> {
553
...]<br /><code class="command">unhdr_order</code> {
537
554
<em class="replaceable"><code>*</code></em>
539
556
<em class="replaceable"><code>header</code></em>
540
557
... }</p></div><p>
541
With the <code class="literal">hdr_order</code> command you can specify an order in
542
which mutt will attempt to present these headers to you when viewing messages.
558
With the <span class="command"><strong>hdr_order</strong></span> command you can specify an order in
559
which Mutt will attempt to present these headers to you when viewing messages.
544
“<span class="quote">unhdr_order *</span>” will clear all previous headers from the order list,
561
“<span class="quote"><span class="command"><strong>unhdr_order</strong></span> *</span>” will clear all previous headers from the order list,
545
562
thus removing the header order effects set by the system-wide startup file.
546
</p><div class="example"><a id="ex-hdr-order"></a><p class="title"><b>Example 3.9. Configuring header display order</b></p><div class="example-contents"><pre class="screen">
563
</p><div class="example"><a id="ex-hdr-order"></a><p class="title"><b>Example 3.10. Configuring header display order</b></p><div class="example-contents"><pre class="screen">
547
564
hdr_order From Date: From: To: Cc: Subject:
548
</pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>11. Alternative addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
565
</pre></div></div><br class="example-break" /></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>11. Alternative Addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
549
566
<code class="option">-group</code>
550
567
<em class="replaceable"><code>name</code></em>
552
569
<em class="replaceable"><code>regexp</code></em>
554
571
<em class="replaceable"><code>regexp</code></em>
555
...]</p></div><div class="cmdsynopsis"><p><code class="command">unalternates</code> [
572
...]<br /><code class="command">unalternates</code> [
556
573
<code class="option">-group</code>
557
574
<em class="replaceable"><code>name</code></em>
589
606
The <code class="literal">-group</code> flag causes all of the subsequent regular expressions
590
607
to be added to the named group.
592
The <code class="literal">unalternates</code> command can be used to write exceptions to
593
<code class="literal">alternates</code> patterns. If an address matches something in an
594
<code class="literal">alternates</code> command, but you nonetheless do not think it is
595
from you, you can list a more precise pattern under an <code class="literal">unalternates</code>
609
The <span class="command"><strong>unalternates</strong></span> command can be used to write exceptions to
610
<span class="command"><strong>alternates</strong></span> patterns. If an address matches something in an
611
<span class="command"><strong>alternates</strong></span> command, but you nonetheless do not think it is
612
from you, you can list a more precise pattern under an <span class="command"><strong>unalternates</strong></span>
598
To remove a regular expression from the <code class="literal">alternates</code> list, use the
599
<code class="literal">unalternates</code> command with exactly the same <span class="emphasis"><em>regexp</em></span>.
600
Likewise, if the <span class="emphasis"><em>regexp</em></span> for an <code class="literal">alternates</code> command matches
601
an entry on the <code class="literal">unalternates</code> list, that <code class="literal">unalternates</code>
602
entry will be removed. If the <span class="emphasis"><em>regexp</em></span> for <code class="literal">unalternates</code>
603
is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries</em></span> on <code class="literal">alternates</code> will be removed.
604
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>12. Mailing lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
615
To remove a regular expression from the <span class="command"><strong>alternates</strong></span> list, use the
616
<span class="command"><strong>unalternates</strong></span> command with exactly the same <span class="emphasis"><em>regexp</em></span>.
617
Likewise, if the <span class="emphasis"><em>regexp</em></span> for an <span class="command"><strong>alternates</strong></span> command matches
618
an entry on the <span class="command"><strong>unalternates</strong></span> list, that <span class="command"><strong>unalternates</strong></span>
619
entry will be removed. If the <span class="emphasis"><em>regexp</em></span> for <span class="command"><strong>unalternates</strong></span>
620
is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries</em></span> on <span class="command"><strong>alternates</strong></span> will be removed.
621
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>12. Mailing Lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
605
622
<code class="option">-group</code>
606
623
<em class="replaceable"><code>name</code></em>
608
625
<em class="replaceable"><code>regexp</code></em>
610
627
<em class="replaceable"><code>regexp</code></em>
611
...]</p></div><div class="cmdsynopsis"><p><code class="command">unlists</code> [
628
...]<br /><code class="command">unlists</code> [
612
629
<code class="option">-group</code>
613
630
<em class="replaceable"><code>name</code></em>
615
632
<em class="replaceable"><code>*</code></em>
617
634
<em class="replaceable"><code>regexp</code></em>
618
... }</p></div><div class="cmdsynopsis"><p><code class="command">subscribe</code> [
635
... }<br /><code class="command">subscribe</code> [
619
636
<code class="option">-group</code>
620
637
<em class="replaceable"><code>name</code></em>
622
639
<em class="replaceable"><code>regexp</code></em>
624
641
<em class="replaceable"><code>regexp</code></em>
625
...]</p></div><div class="cmdsynopsis"><p><code class="command">unsubscribe</code> [
642
...]<br /><code class="command">unsubscribe</code> [
626
643
<code class="option">-group</code>
627
644
<em class="replaceable"><code>name</code></em>
641
665
supported by all mail user agents. Adding it is not bullet-proof against
642
666
receiving personal CCs of list messages. Also note that the generation
643
667
of the Mail-Followup-To header is controlled by the
644
<a class="link" href="reference.html#followup-to" title="3.60. followup_to">$followup_to</a>
645
configuration variable.
668
<a class="link" href="reference.html#followup-to" title="3.68. followup_to">$followup_to</a>
669
configuration variable since it's common practice on some mailing lists
670
to send Cc upons replies (which is more a group- than a list-reply).
647
672
More precisely, Mutt maintains lists of patterns for the addresses
648
673
of known and subscribed mailing lists. Every subscribed mailing
649
list is known. To mark a mailing list as known, use the “<span class="quote">lists</span>”
650
command. To mark it as subscribed, use “<span class="quote">subscribe</span>”.
674
list is known. To mark a mailing list as known, use the <span class="command"><strong>list</strong></span>
675
command. To mark it as subscribed, use <span class="command"><strong>subscribe</strong></span>.
652
You can use regular expressions with both commands. To mark all
653
messages sent to a specific bug report's address on mutt's bug
677
You can use regular expressions with both commands. To mark all
678
messages sent to a specific bug report's address on Debian's bug
654
679
tracking system as list mail, for instance, you could say
655
“<span class="quote">subscribe [0-9]*@bugs.guug.de</span>”. Often, it's sufficient to just
656
give a portion of the list's e-mail address.
680
</p><pre class="screen">
681
subscribe [0-9]*.*@bugs.debian.org</pre><p>
682
as it's often, it's sufficient to just give a portion of the list's e-mail address.
658
684
Specify as much of the address as you need to to remove ambiguity. For
659
685
example, if you've subscribed to the Mutt mailing list, you will receive mail
660
addressed to <span class="emphasis"><em>mutt-users@mutt.org</em></span>. So, to tell Mutt
661
that this is a mailing list, you could add “<span class="quote">lists mutt-users@</span>” to your
662
initialization file. To tell mutt that you are subscribed to it,
663
add “<span class="quote">subscribe mutt-users</span>” to your initialization file instead.
686
addressed to <code class="literal">mutt-users@mutt.org</code>. So, to tell Mutt
687
that this is a mailing list, you could add <code class="literal">lists mutt-users@</code> to your
688
initialization file. To tell Mutt that you are subscribed to it,
689
add <code class="literal"><span class="command"><strong>subscribe</strong></span> mutt-users</code> to your initialization file instead.
664
690
If you also happen to get mail from someone whose address is
665
<span class="emphasis"><em>mutt-users@example.com</em></span>, you could use
666
“<span class="quote">lists ^mutt-users@mutt\\.org$</span>”
667
or “<span class="quote">subscribe ^mutt-users@mutt\\.org$</span>” to
691
<code class="literal">mutt-users@example.com</code>, you could use
692
<code class="literal"><span class="command"><strong>lists</strong></span> ^mutt-users@mutt\\.org$</code>
693
or <code class="literal"><span class="command"><strong>subscribe</strong></span> ^mutt-users@mutt\\.org$</code> to
668
694
match only mail from the actual list.
670
696
The <code class="literal">-group</code> flag adds all of the subsequent regular expressions
738
764
In cases where new mail detection for Mbox or Mmdf folders appears to be
740
<a class="link" href="reference.html#check-mbox-size" title="3.24. check_mbox_size">$check_mbox_size</a>
766
<a class="link" href="reference.html#check-mbox-size" title="3.26. check_mbox_size">$check_mbox_size</a>
741
767
option can be used to make Mutt track and consult file sizes for new
742
mail detection instead.
743
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>15. User defined headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
768
mail detection instead which won't work for size-neutral changes.
769
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>15. User-Defined Headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
744
770
<em class="replaceable"><code>string</code></em>
745
</p></div><div class="cmdsynopsis"><p><code class="command">unmy_hdr</code> {
771
<br /><code class="command">unmy_hdr</code> {
746
772
<em class="replaceable"><code>*</code></em>
748
774
<em class="replaceable"><code>field</code></em>
749
775
... }</p></div><p>
750
The <code class="literal">my_hdr</code> command allows you to create your own header
751
fields which will be added to every message you send.
776
The <span class="command"><strong>my_hdr</strong></span> command allows you to create your own header
777
fields which will be added to every message you send and appear in the
778
editor if <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> is set.
753
780
For example, if you would like to add an “<span class="quote">Organization:</span>” header field to
754
all of your outgoing messages, you can put the command
755
</p><div class="example"><a id="ex-my-hdr"></a><p class="title"><b>Example 3.10. Defining custom headers</b></p><div class="example-contents"><pre class="screen">
781
all of your outgoing messages, you can put the command something like
782
shown in <a class="xref" href="configuration.html#ex-my-hdr" title="Example 3.11. Defining custom headers">Example 3.11, “Defining custom headers”</a> in your <code class="literal">.muttrc</code>.
783
</p><div class="example"><a id="ex-my-hdr"></a><p class="title"><b>Example 3.11. Defining custom headers</b></p><div class="example-contents"><pre class="screen">
756
784
my_hdr Organization: A Really Big Company, Anytown, USA
757
</pre></div></div><br class="example-break" /><p>
758
in your <code class="literal">.muttrc</code>.
759
</p><div class="note"><h3 class="title">Note</h3><p>
785
</pre></div></div><br class="example-break" /><div class="note"><h3 class="title">Note</h3><p>
760
786
Space characters are <span class="emphasis"><em>not</em></span> allowed between the keyword and
761
787
the colon (“<span class="quote">:</span>”). The standard for electronic mail (RFC2822) says that
762
788
space is illegal there, so Mutt enforces the rule.
764
790
If you would like to add a header field to a single message, you should
765
either set the <a class="link" href="reference.html#edit-headers" title="3.50. edit_headers">$edit_headers</a> variable,
791
either set the <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> variable,
766
792
or use the <code class="literal"><edit-headers></code> function (default: “<span class="quote">E</span>”) in the compose menu so
767
793
that you can edit the header of your message along with the body.
769
To remove user defined header fields, use the <code class="literal">unmy_hdr</code>
795
To remove user defined header fields, use the <span class="command"><strong>unmy_hdr</strong></span>
770
796
command. You may specify an asterisk (“<span class="quote">*</span>”) to remove all header
771
797
fields, or the fields to remove. For example, to remove all “<span class="quote">To</span>” and
772
798
“<span class="quote">Cc</span>” header fields, you could use:
773
799
</p><pre class="screen">
775
</pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>16. Specify default save mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
801
</pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>16. Specify Default Save Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
776
802
<em class="replaceable"><code>[!]pattern</code></em>
778
804
<em class="replaceable"><code>mailbox</code></em>
797
821
# save from aol.com to $folder/spam
798
822
save-hook aol\\.com$ +spam
799
823
</pre></div></div><br class="example-break" /><p>
800
Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify default save filename and default Fcc: mailbox at once">fcc-save-hook</a> command.
801
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>17. Specify default Fcc: mailbox when composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
824
Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
825
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>17. Specify Default Fcc: Mailbox When Composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
802
826
<em class="replaceable"><code>[!]pattern</code></em>
804
828
<em class="replaceable"><code>mailbox</code></em>
806
830
This command is used to save outgoing mail in a mailbox other than
807
<a class="link" href="reference.html#record" title="3.240. record">$record</a>. Mutt searches the initial list of
831
<a class="link" href="reference.html#record" title="3.211. record">$record</a>. Mutt searches the initial list of
808
832
message recipients for the first matching <span class="emphasis"><em>regexp</em></span> and uses <span class="emphasis"><em>mailbox</em></span>
809
833
as the default Fcc: mailbox. If no match is found the message will be saved
810
to <a class="link" href="reference.html#record" title="3.240. record">$record</a> mailbox.
834
to <a class="link" href="reference.html#record" title="3.211. record">$record</a> mailbox.
812
836
To provide more flexibility and good defaults, Mutt applies the
813
expandos of <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> to
837
expandos of <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> to
814
838
<span class="emphasis"><em>mailbox</em></span> after it was expanded.
816
840
See <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format of <span class="emphasis"><em>pattern</em></span>.
818
Example: <code class="literal">fcc-hook [@.]aol\\.com$ +spammers</code>
820
The above will save a copy of all messages going to the aol.com domain to
821
the `+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify default save filename and default Fcc: mailbox at once">fcc-save-hook</a> command.
822
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>18. Specify default save filename and default Fcc: mailbox at once</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-save-hook</code>
841
</p><pre class="screen">fcc-hook [@.]aol\\.com$ +spammers</pre><p>
842
...will save a copy of all messages going to the aol.com domain to
843
the `+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
844
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>18. Specify Default Save Filename and Default Fcc: Mailbox at Once</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-save-hook</code>
823
845
<em class="replaceable"><code>[!]pattern</code></em>
825
847
<em class="replaceable"><code>mailbox</code></em>
827
This command is a shortcut, equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="17. Specify default Fcc: mailbox when composing">fcc-hook</a>
828
and a <a class="link" href="configuration.html#save-hook" title="16. Specify default save mailbox">save-hook</a> with its arguments,
849
This command is a shortcut, equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="17. Specify Default Fcc: Mailbox When Composing"><span class="command"><strong>fcc-hook</strong></span></a>
850
and a <a class="link" href="configuration.html#save-hook" title="16. Specify Default Save Mailbox"><span class="command"><strong>save-hook</strong></span></a> with its arguments,
829
851
including %-expansion on <span class="emphasis"><em>mailbox</em></span> according
830
to <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a>.
831
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>19. Change settings based upon message recipients</h2></div></div></div><a id="reply-hook"></a><a id="send2-hook"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">reply-hook</code>
832
<em class="replaceable"><code>[!]pattern</code></em>
834
<em class="replaceable"><code>command</code></em>
835
</p></div><div class="cmdsynopsis"><p><code class="command">send-hook</code>
836
<em class="replaceable"><code>[!]pattern</code></em>
838
<em class="replaceable"><code>command</code></em>
839
</p></div><div class="cmdsynopsis"><p><code class="command">send2-hook</code>
852
to <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>.
853
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>19. Change Settings Based Upon Message Recipients</h2></div></div></div><a id="reply-hook"></a><a id="send2-hook"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">reply-hook</code>
854
<em class="replaceable"><code>[!]pattern</code></em>
856
<em class="replaceable"><code>command</code></em>
857
<br /><code class="command">send-hook</code>
858
<em class="replaceable"><code>[!]pattern</code></em>
860
<em class="replaceable"><code>command</code></em>
861
<br /><code class="command">send2-hook</code>
840
862
<em class="replaceable"><code>[!]pattern</code></em>
842
864
<em class="replaceable"><code>command</code></em>
846
868
the message, see <a class="xref" href="advancedusage.html#pattern-hook" title="4.1. Message Matching in Hooks">Message Matching in Hooks</a> for details. <span class="emphasis"><em>command</em></span>
847
869
is executed when <span class="emphasis"><em>pattern</em></span> matches.
849
<code class="literal">reply-hook</code> is matched against the message you are <span class="emphasis"><em>replying to</em></span>,
850
instead of the message you are <span class="emphasis"><em>sending</em></span>. <code class="literal">send-hook</code> is
871
<span class="command"><strong>reply-hook</strong></span> is matched against the message you are <span class="emphasis"><em>replying to</em></span>,
872
instead of the message you are <span class="emphasis"><em>sending</em></span>. <span class="command"><strong>send-hook</strong></span> is
851
873
matched against all messages, both <span class="emphasis"><em>new</em></span>
852
874
and <span class="emphasis"><em>replies</em></span>.
853
875
</p><div class="note"><h3 class="title">Note</h3><p>
854
<code class="literal">reply-hook</code>s are matched <span class="bold"><strong>before</strong></span> the <code class="literal">send-hook</code>, <span class="bold"><strong>regardless</strong></span>
876
<span class="command"><strong>reply-hook</strong></span>s are matched <span class="emphasis"><em>before</em></span> the <span class="command"><strong>send-hook</strong></span>, <span class="emphasis"><em>regardless</em></span>
855
877
of the order specified in the user's configuration file.
857
<code class="literal">send2-hook</code> is matched every time a message is changed, either
879
<span class="command"><strong>send2-hook</strong></span> is matched every time a message is changed, either
858
880
by editing it, or by using the compose menu to change its recipients
859
or subject. <code class="literal">send2-hook</code> is executed after <code class="literal">send-hook</code>, and
860
can, e.g., be used to set parameters such as the <a class="link" href="reference.html#sendmail" title="3.258. sendmail">$sendmail</a> variable depending on the message's sender
881
or subject. <span class="command"><strong>send2-hook</strong></span> is executed after <span class="command"><strong>send-hook</strong></span>, and
882
can, e.g., be used to set parameters such as the <a class="link" href="reference.html#sendmail" title="3.230. sendmail">$sendmail</a> variable depending on the message's sender
863
For each type of <code class="literal">send-hook</code> or <code class="literal">reply-hook</code>, when multiple matches
864
occur, commands are executed in the order they are specified in the muttrc
885
For each type of <span class="command"><strong>send-hook</strong></span> or <span class="command"><strong>reply-hook</strong></span>, when multiple matches
886
occur, commands are executed in the order they are specified in the <code class="literal">.muttrc</code>
865
887
(for that type of hook).
867
Example: <code class="literal">send-hook mutt "set mime_forward signature=''"</code>
889
Example: <code class="literal"><span class="command"><strong>send-hook</strong></span> mutt "<span class="command"><strong>set</strong></span> mime_forward signature=''"</code>
869
891
Another typical use for this command is to change the values of the
870
<a class="link" href="reference.html#attribution" title="3.16. attribution">$attribution</a>, <a class="link" href="reference.html#signature" title="3.263. signature">$signature</a> and <a class="link" href="reference.html#locale" title="3.104. locale">$locale</a>
892
<a class="link" href="reference.html#attribution" title="3.16. attribution">$attribution</a>, <a class="link" href="reference.html#signature" title="3.235. signature">$signature</a> and <a class="link" href="reference.html#locale" title="3.117. locale">$locale</a>
871
893
variables in order to change the language of the attributions and
872
894
signatures based upon the recipients.
873
895
</p><div class="note"><h3 class="title">Note</h3><p>
874
send-hook's are only executed once after getting the initial
875
list of recipients. Adding a recipient after replying or editing the
876
message will not cause any send-hook to be executed. Also note that
877
<code class="literal">my_hdr</code> commands which modify recipient headers, or the message's
878
subject, don't have any effect on the current message when executed
880
</p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>20. Change settings before formatting a message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
896
<span class="command"><strong>send-hook</strong></span>'s are only executed once after getting the
897
initial list of recipients. Adding a recipient after replying or
898
editing the message will not cause any <span class="command"><strong>send-hook</strong></span> to be executed,
899
similarily if <a class="link" href="reference.html#autoedit" title="3.18. autoedit">$autoedit</a> is set
900
(as then the initial list of recipients is empty). Also note that <a class="link" href="configuration.html#my-hdr" title="15. User-Defined Headers"><span class="command"><strong>my_hdr</strong></span></a> commands which
901
modify recipient headers, or the message's subject, don't have any
902
effect on the current message when executed from a
903
<span class="command"><strong>send-hook</strong></span>.
904
</p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>20. Change Settings Before Formatting a Message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
881
905
<em class="replaceable"><code>[!]pattern</code></em>
883
907
<em class="replaceable"><code>command</code></em>
904
928
key with a given e-mail address automatically, either because the
905
929
recipient's public key can't be deduced from the destination address,
906
930
or because, for some reasons, you need to override the key Mutt would
907
normally use. The <code class="literal">crypt-hook</code> command provides a
931
normally use. The <span class="command"><strong>crypt-hook</strong></span> command provides a
908
932
method by which you can specify the ID of the public key to be used
909
933
when encrypting messages to a certain recipient.
911
935
The meaning of <span class="emphasis"><em>keyid</em></span> is to be taken broadly in this context: You
912
936
can either put a numerical key ID here, an e-mail address, or even
913
937
just a real name.
914
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>22. Adding key sequences to the keyboard buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
938
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>22. Adding Key Sequences to the Keyboard Buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
915
939
<em class="replaceable"><code>string</code></em>
917
941
This command adds the named string to the keyboard buffer. The string may
918
942
contain control characters, key names and function names like the sequence
919
string in the <a class="link" href="configuration.html#macro" title="8. Keyboard macros">macro</a> command. You may use it to
943
string in the <a class="link" href="configuration.html#macro" title="8. Keyboard Macros">macro</a> command. You may use it to
920
944
automatically run a sequence of commands at startup, or when entering
921
certain folders. For example, the following command will automatically
922
collapse all threads when entering a folder:
923
</p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><b>Example 3.12. Embedding <code class="literal">push</code> in <code class="literal">folder-hook</code></b></p><div class="example-contents"><pre class="screen">
945
certain folders. For example, <a class="xref" href="configuration.html#ex-folder-hook-push" title="Example 3.13. Embedding push in folder-hook">Example 3.13, “Embedding push in folder-hook”</a>
946
shows how to automatically collapse all threads when entering a folder.
947
</p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><b>Example 3.13. Embedding <span class="command">push</span> in <span class="command">folder-hook</span></b></p><div class="example-contents"><pre class="screen">
924
948
folder-hook . 'push <collapse-all>'
925
</pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>23. Executing functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
949
</pre></div></div><br class="example-break" /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>23. Executing Functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
926
950
<em class="replaceable"><code>function</code></em>
928
952
<em class="replaceable"><code>function</code></em>
929
953
...]</p></div><p>
930
954
This command can be used to execute any function. Functions are
931
955
listed in the <a class="link" href="reference.html#functions" title="4. Functions">function reference</a>.
932
“<span class="quote">exec function</span>” is equivalent to “<span class="quote">push <function></span>”.
956
“<span class="quote"><span class="command"><strong>exec</strong></span><code class="literal">function</code></span>” is equivalent to
957
“<span class="quote"><code class="literal">push <function></code></span>”.
933
958
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="score-command"></a>24. Message Scoring</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">score</code>
934
959
<em class="replaceable"><code>pattern</code></em>
936
961
<em class="replaceable"><code>value</code></em>
937
</p></div><div class="cmdsynopsis"><p><code class="command">unscore</code> {
962
<br /><code class="command">unscore</code> {
938
963
<em class="replaceable"><code>*</code></em>
940
965
<em class="replaceable"><code>pattern</code></em>
941
966
... }</p></div><p>
942
The <code class="literal">score</code> commands adds <span class="emphasis"><em>value</em></span> to a message's score if <span class="emphasis"><em>pattern</em></span>
967
The <span class="command"><strong>score</strong></span> commands adds <span class="emphasis"><em>value</em></span> to a message's score if <span class="emphasis"><em>pattern</em></span>
943
968
matches it. <span class="emphasis"><em>pattern</em></span> is a string in the format described in the <a class="link" href="advancedusage.html#patterns" title="2. Patterns: Searching, Limiting and Tagging">patterns</a> section (note: For efficiency reasons, patterns
944
969
which scan information not available in the index, such as <code class="literal">˜b</code>,
945
970
<code class="literal">˜B</code> or <code class="literal">˜h</code>, may not be used). <span class="emphasis"><em>value</em></span> is a
946
971
positive or negative integer. A message's final score is the sum total of all
947
matching <code class="literal">score</code> entries. However, you may optionally prefix <span class="emphasis"><em>value</em></span> with
948
an equal sign (=) to cause evaluation to stop at a particular entry if there is
972
matching <span class="command"><strong>score</strong></span> entries. However, you may optionally prefix <span class="emphasis"><em>value</em></span> with
973
an equal sign (“<span class="quote">=</span>”) to cause evaluation to stop at a particular entry if there is
949
974
a match. Negative final scores are rounded up to 0.
951
The <code class="literal">unscore</code> command removes score entries from the list. You <span class="bold"><strong>must</strong></span>
952
specify the same pattern specified in the <code class="literal">score</code> command for it to be
976
The <span class="command"><strong>unscore</strong></span> command removes score entries from the list. You <span class="emphasis"><em>must</em></span>
977
specify the same pattern specified in the <span class="command"><strong>score</strong></span> command for it to be
953
978
removed. The pattern “<span class="quote">*</span>” is a special token which means to clear the list
954
979
of all score entries.
955
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>25. Spam detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
980
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>25. Spam Detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
956
981
<em class="replaceable"><code>pattern</code></em>
958
983
<em class="replaceable"><code>format</code></em>
959
</p></div><div class="cmdsynopsis"><p><code class="command">nospam</code> {
984
<br /><code class="command">nospam</code> {
960
985
<em class="replaceable"><code>*</code></em>
962
987
<em class="replaceable"><code>pattern</code></em>
964
989
Mutt has generalized support for external spam-scoring filters.
965
By defining your spam patterns with the <code class="literal">spam</code> and <code class="literal">nospam</code>
990
By defining your spam patterns with the <span class="command"><strong>spam</strong></span> and <code class="literal">nospam</code>
966
991
commands, you can <span class="emphasis"><em>limit</em></span>, <span class="emphasis"><em>search</em></span>, and <span class="emphasis"><em>sort</em></span> your
967
992
mail based on its spam attributes, as determined by the external
968
993
filter. You also can display the spam attributes in your index
969
display using the <code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> variable. (Tip: try <code class="literal">%?H?[%H] ?</code>
994
display using the <code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. (Tip: try <code class="literal">%?H?[%H] ?</code>
970
995
to display spam tags only when they are defined for a given message.)
972
997
Your first step is to define your external filter's spam patterns using
973
the <code class="literal">spam</code> command. <span class="emphasis"><em>pattern</em></span> should be a regular expression
998
the <span class="command"><strong>spam</strong></span> command. <span class="emphasis"><em>pattern</em></span> should be a regular expression
974
999
that matches a header in a mail message. If any message in the mailbox
975
1000
matches this regular expression, it will receive a “<span class="quote">spam tag</span>” or
976
“<span class="quote">spam attribute</span>” (unless it also matches a <code class="literal">nospam</code> pattern -- see
1001
“<span class="quote">spam attribute</span>” (unless it also matches a <span class="command"><strong>nospam</strong></span> pattern — see
977
1002
below.) The appearance of this attribute is entirely up to you, and is
978
1003
governed by the <span class="emphasis"><em>format</em></span> parameter. <span class="emphasis"><em>format</em></span> can be any static
979
1004
text, but it also can include back-references from the <span class="emphasis"><em>pattern</em></span>
981
1006
sub-expression contained within parentheses.) <code class="literal">%1</code> is replaced with
982
1007
the first back-reference in the regex, <code class="literal">%2</code> with the second, etc.
1009
To match spam tags, mutt needs the corresponding header information
1010
which is always the case for local and POP folders but not for IMAP in
1011
the default configuration. Depending on the spam header to be analyzed,
1012
<a class="link" href="reference.html#imap-headers" title="3.99. imap_headers">$imap_headers</a> may need
984
1015
If you're using multiple spam filters, a message can have more than
985
one spam-related header. You can define <code class="literal">spam</code> patterns for each
1016
one spam-related header. You can define <span class="command"><strong>spam</strong></span> patterns for each
986
1017
filter you use. If a message matches two or more of these patterns, and
987
the $spam_separator variable is set to a string, then the
1018
the <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> variable is set to a string, then the
988
1019
message's spam tag will consist of all the <span class="emphasis"><em>format</em></span> strings joined
989
together, with the value of $spam_separator separating
1020
together, with the value of <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> separating
992
For example, suppose I use DCC, SpamAssassin, and PureMessage. I might
993
define these spam settings:
994
</p><div class="example"><a id="ex-spam"></a><p class="title"><b>Example 3.13. Configuring spam detection</b></p><div class="example-contents"><pre class="screen">
1023
For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
1024
the configuration might look like in <a class="xref" href="configuration.html#ex-spam" title="Example 3.14. Configuring spam detection">Example 3.14, “Configuring spam detection”</a>.
1025
</p><div class="example"><a id="ex-spam"></a><p class="title"><b>Example 3.14. Configuring spam detection</b></p><div class="example-contents"><pre class="screen">
995
1026
spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
996
1027
spam "X-Spam-Status: Yes" "90+/SA"
997
1028
spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
998
1029
set spam_separator=", "
999
1030
</pre></div></div><br class="example-break" /><p>
1000
If I then received a message that DCC registered with “<span class="quote">many</span>” hits
1031
If then a message is received that DCC registered with “<span class="quote">many</span>” hits
1001
1032
under the “<span class="quote">Fuz2</span>” checksum, and that PureMessage registered with a
1002
1033
97% probability of being spam, that message's spam tag would read
1003
1034
<code class="literal">90+/DCC-Fuz2, 97/PM</code>. (The four characters before “<span class="quote">=many</span>” in a
1004
DCC report indicate the checksum used -- in this case, “<span class="quote">Fuz2</span>”.)
1035
DCC report indicate the checksum used — in this case, “<span class="quote">Fuz2</span>”.)
1006
If the $spam_separator variable is unset, then each
1037
If the <a class="link" href="reference.html#spam-separator" title="3.268. spam_separator">$spam_separator</a> variable is unset, then each
1007
1038
spam pattern match supersedes the previous one. Instead of getting
1008
1039
joined <span class="emphasis"><em>format</em></span> strings, you'll get only the last one to match.
1010
1041
The spam tag is what will be displayed in the index when you use
1011
<code class="literal">%H</code> in the <code class="literal">$index_format</code> variable. It's also the
1042
<code class="literal">%H</code> in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. It's also the
1012
1043
string that the <code class="literal">˜H</code> pattern-matching expression matches against for
1013
1044
<code class="literal"><search></code> and <code class="literal"><limit></code> functions. And it's what sorting by spam
1014
1045
attribute will use as a sort key.
1016
1047
That's a pretty complicated example, and most people's actual
1017
1048
environments will have only one spam filter. The simpler your
1018
configuration, the more effective mutt can be, especially when it comes
1049
configuration, the more effective Mutt can be, especially when it comes
1021
Generally, when you sort by spam tag, mutt will sort <span class="emphasis"><em>lexically</em></span> --
1052
Generally, when you sort by spam tag, Mutt will sort <span class="emphasis"><em>lexically</em></span> —
1022
1053
that is, by ordering strings alphanumerically. However, if a spam tag
1023
begins with a number, mutt will sort numerically first, and lexically
1054
begins with a number, Mutt will sort numerically first, and lexically
1024
1055
only when two numbers are equal in value. (This is like UNIX's
1025
<code class="literal">sort -n</code>.) A message with no spam attributes at all -- that is, one
1026
that didn't match <span class="emphasis"><em>any</em></span> of your <code class="literal">spam</code> patterns -- is sorted at
1056
<code class="literal">sort -n</code>.) A message with no spam attributes at all — that is, one
1057
that didn't match <span class="emphasis"><em>any</em></span> of your <span class="command"><strong>spam</strong></span> patterns — is sorted at
1027
1058
lowest priority. Numbers are sorted next, beginning with 0 and ranging
1028
1059
upward. Finally, non-numeric strings are sorted, with “<span class="quote">a</span>” taking lower
1029
1060
priority than “<span class="quote">z</span>”. Clearly, in general, sorting by spam tags is most
1030
1061
effective when you can coerce your filter to give you a raw number. But
1031
in case you can't, mutt can still do something useful.
1062
in case you can't, Mutt can still do something useful.
1033
The <code class="literal">nospam</code> command can be used to write exceptions to <code class="literal">spam</code>
1034
patterns. If a header pattern matches something in a <code class="literal">spam</code> command,
1064
The <span class="command"><strong>nospam</strong></span> command can be used to write exceptions to <span class="command"><strong>spam</strong></span>
1065
patterns. If a header pattern matches something in a <span class="command"><strong>spam</strong></span> command,
1035
1066
but you nonetheless do not want it to receive a spam tag, you can list a
1036
more precise pattern under a <code class="literal">nospam</code> command.
1067
more precise pattern under a <span class="command"><strong>nospam</strong></span> command.
1038
If the <span class="emphasis"><em>pattern</em></span> given to <code class="literal">nospam</code> is exactly the same as the
1039
<span class="emphasis"><em>pattern</em></span> on an existing <code class="literal">spam</code> list entry, the effect will be to
1069
If the <span class="emphasis"><em>pattern</em></span> given to <span class="command"><strong>nospam</strong></span> is exactly the same as the
1070
<span class="emphasis"><em>pattern</em></span> on an existing <span class="command"><strong>spam</strong></span> list entry, the effect will be to
1040
1071
remove the entry from the spam list, instead of adding an exception.
1041
Likewise, if the <span class="emphasis"><em>pattern</em></span> for a <code class="literal">spam</code> command matches an entry
1042
on the <code class="literal">nospam</code> list, that <code class="literal">nospam</code> entry will be removed. If the
1043
<span class="emphasis"><em>pattern</em></span> for <code class="literal">nospam</code> is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries on both lists</em></span>
1044
will be removed. This might be the default action if you use <code class="literal">spam</code>
1045
and <code class="literal">nospam</code> in conjunction with a <code class="literal">folder-hook</code>.
1072
Likewise, if the <span class="emphasis"><em>pattern</em></span> for a <span class="command"><strong>spam</strong></span> command matches an entry
1073
on the <span class="command"><strong>nospam</strong></span> list, that nospam entry will be removed. If the
1074
<span class="emphasis"><em>pattern</em></span> for <span class="command"><strong>nospam</strong></span> is “<span class="quote">*</span>”, <span class="emphasis"><em>all entries on both lists</em></span>
1075
will be removed. This might be the default action if you use <span class="command"><strong>spam</strong></span>
1076
and <span class="command"><strong>nospam</strong></span> in conjunction with a <span class="command"><strong>folder-hook</strong></span>.
1047
You can have as many <code class="literal">spam</code> or <code class="literal">nospam</code> commands as you like.
1048
You can even do your own primitive spam detection within mutt -- for
1078
You can have as many <span class="command"><strong>spam</strong></span> or <span class="command"><strong>nospam</strong></span> commands as you like.
1079
You can even do your own primitive <span class="command"><strong>spam</strong></span> detection within Mutt — for
1049
1080
example, if you consider all mail from <code class="literal">MAILER-DAEMON</code> to be spam,
1050
you can use a <code class="literal">spam</code> command like this:
1081
you can use a <span class="command"><strong>spam</strong></span> command like this:
1051
1082
</p><pre class="screen">
1052
1083
spam "^From: .*MAILER-DAEMON" "999"
1053
</pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>26. Setting and Querying Variables</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>26.1. Commands</h3></div></div></div><p>
1084
</pre></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>26. Setting and Querying Variables</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="var-types"></a>26.1. Variable Types</h3></div></div></div><p>
1085
Mutt supports these types of configuration variables:
1086
</p><div class="variablelist"><dl><dt><span class="term">boolean</span></dt><dd><p>
1087
A boolean expression, either “<span class="quote">yes</span>” or “<span class="quote">no</span>”.
1088
</p></dd><dt><span class="term">number</span></dt><dd><p>
1089
A signed integer number in the range -32768 to 32767.
1090
</p></dd><dt><span class="term">string</span></dt><dd><p>
1092
</p></dd><dt><span class="term">path</span></dt><dd><p>
1093
A specialized string for representing paths including support for
1094
mailbox shortcuts (see <a class="xref" href="advancedusage.html#shortcuts" title="7. Mailbox Shortcuts">Section 7, “Mailbox Shortcuts”</a>) as well as tilde
1095
(“<span class="quote">˜</span>”) for a user's home directory and more.
1096
</p></dd><dt><span class="term">quadoption</span></dt><dd><p>
1097
Like a boolean but triggers a prompt when set to “<span class="quote">ask-yes</span>”
1098
or “<span class="quote">ask-no</span>” with “<span class="quote">yes</span>” and “<span class="quote">no</span>”
1099
preselected respectively.
1100
</p></dd><dt><span class="term">sort order</span></dt><dd><p>
1101
A specialized string allowing only particular words as values depending
1103
</p></dd><dt><span class="term">regular expression</span></dt><dd><p>
1104
A regular expression, see <a class="xref" href="advancedusage.html#regexp" title="1. Regular Expressions">Section 1, “Regular Expressions”</a> for an introduction.
1105
</p></dd><dt><span class="term">folder magic</span></dt><dd><p>
1106
Specifies the type of folder to use: <span class="emphasis"><em>mbox</em></span>,
1107
<span class="emphasis"><em>mmdf</em></span>, <span class="emphasis"><em>mh</em></span>
1108
or <span class="emphasis"><em>maildir</em></span>.
1109
Currently only used to determine the type for newly created folders.
1110
</p></dd><dt><span class="term">e-mail address</span></dt><dd><p>
1111
An e-mail address either with or without
1112
realname. The older “<span class="quote"><code class="literal">user@example.org (Joe User)</code></span>”
1113
form is supported but strongly deprecated.
1114
</p></dd><dt><span class="term">user-defined</span></dt><dd><p>
1115
Arbitrary text, see <a class="xref" href="configuration.html#set-myvar" title="26.3. User-Defined Variables">Section 26.3, “User-Defined Variables”</a> for details.
1116
</p></dd></dl></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>26.2. Commands</h3></div></div></div><p>
1054
1117
The following commands are available to manipulate and query variables:
1055
1118
</p><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">set</code> {
1056
1119
[ <code class="option">no</code> | <code class="option">inv</code> ]
1057
1120
<em class="replaceable"><code>variable</code></em>
1059
1122
<em class="replaceable"><code>variable=value</code></em>
1060
} [...]</p></div><div class="cmdsynopsis"><p><code class="command">toggle</code>
1061
<em class="replaceable"><code>variable</code></em>
1063
<em class="replaceable"><code>variable</code></em>
1064
...]</p></div><div class="cmdsynopsis"><p><code class="command">unset</code>
1065
<em class="replaceable"><code>variable</code></em>
1067
<em class="replaceable"><code>variable</code></em>
1068
...]</p></div><div class="cmdsynopsis"><p><code class="command">reset</code>
1123
} [...]<br /><code class="command">toggle</code>
1124
<em class="replaceable"><code>variable</code></em>
1126
<em class="replaceable"><code>variable</code></em>
1127
...]<br /><code class="command">unset</code>
1128
<em class="replaceable"><code>variable</code></em>
1130
<em class="replaceable"><code>variable</code></em>
1131
...]<br /><code class="command">reset</code>
1069
1132
<em class="replaceable"><code>variable</code></em>
1071
1134
<em class="replaceable"><code>variable</code></em>
1072
1135
...]</p></div><p>
1073
This command is used to set (and unset) <a class="link" href="reference.html#variables" title="3. Configuration variables">configuration variables</a>. There are four basic types of variables:
1136
This command is used to set (and unset) <a class="link" href="reference.html#variables" title="3. Configuration Variables">configuration variables</a>. There are four basic types of variables:
1074
1137
boolean, number, string and quadoption. <span class="emphasis"><em>boolean</em></span> variables can be
1075
1138
<span class="emphasis"><em>set</em></span> (true) or <span class="emphasis"><em>unset</em></span> (false). <span class="emphasis"><em>number</em></span> variables can be
1076
1139
assigned a positive integer value.
1194
1257
This command permits you to flush hooks you have previously defined.
1195
1258
You can either remove all hooks by giving the “<span class="quote">*</span>” character as an
1196
1259
argument, or you can remove all hooks of a specific type by saying
1197
something like <code class="literal">unhook send-hook</code>.
1260
something like <code class="literal"><span class="command"><strong>unhook</strong></span> send-hook</code>.
1198
1261
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="formatstrings"></a>29. Format Strings</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-basics"></a>29.1. Basic usage</h3></div></div></div><p>
1199
1262
Format strings are a general concept you'll find in several locations
1200
through the mutt configuration, especially in the
1201
<a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a>,
1202
<a class="link" href="reference.html#pager-format" title="3.140. pager_format">$pager_format</a>,
1203
<a class="link" href="reference.html#status-format" title="3.279. status_format">$status_format</a>,
1204
and other “<span class="quote">*_format</span>” variables. These can be very straightforward,
1263
through the Mutt configuration, especially in the
1264
<a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>,
1265
<a class="link" href="reference.html#pager-format" title="3.150. pager_format">$pager_format</a>,
1266
<a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a>,
1267
and other related variables. These can be very straightforward,
1205
1268
and it's quite possible you already know how to use them.
1207
1270
The most basic format string element is a percent symbol followed
1208
1271
by another character. For example, <code class="literal">%s</code>
1209
represents a message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.101. index_format">$index_format</a> variable. The
1272
represents a message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. The
1210
1273
“<span class="quote">expandos</span>” available are documented with each format variable, but
1211
1274
there are general modifiers available with all formatting expandos,
1212
1275
too. Those are our concern here.
1214
1277
Some of the modifiers are borrowed right out of C (though you might
1215
1278
know them from Perl, Python, shell, or another language). These are
1216
the [-]m.n modifiers, as in <code class="literal">%-12.12s</code>. As with
1279
the <code class="literal">[-]m.n</code> modifiers, as in <code class="literal">%-12.12s</code>. As with
1217
1280
such programming languages, these modifiers allow you to specify the
1218
1281
minimum and maximum size of the resulting string, as well as its
1219
1282
justification. If the “<span class="quote">-</span>” sign follows the percent, the string will
1220
1283
be left-justified instead of right-justified. If there's a number
1221
1284
immediately following that, it's the minimum amount of space the
1222
formatted string will occupy -- if it's naturally smaller than that, it
1285
formatted string will occupy — if it's naturally smaller than that, it
1223
1286
will be padded out with spaces. If a decimal point and another number
1224
follow, that's the maximum space allowable -- the string will not be
1287
follow, that's the maximum space allowable — the string will not be
1225
1288
permitted to exceed that width, no matter its natural size. Each of
1226
1289
these three elements is optional, so that all these are legal format
1228
<code class="literal">%-12s</code>
1229
<code class="literal">%4c</code>
1230
<code class="literal">%.15F</code>
1231
<code class="literal">%-12.15L</code>
1290
strings: <code class="literal">%-12s</code>, <code class="literal">%4c</code>,
1291
<code class="literal">%.15F</code> and <code class="literal">%-12.15L</code>.
1233
1293
Mutt adds some other modifiers to format strings. If you use an equals
1234
1294
symbol (<code class="literal">=</code>) as a numeric prefix (like the minus
1235
1295
above), it will force the string to be centered within its minimum
1236
1296
space range. For example, <code class="literal">%=14y</code> will reserve 14
1237
characters for the %y expansion -- that's the X-Label: header, in
1238
<code class="literal">$index_format</code>. If the expansion
1297
characters for the %y expansion — that's the X-Label: header, in
1298
<a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>. If the expansion
1239
1299
results in a string less than 14 characters, it will be centered in a
1240
14-character space. If the X-Label for a message were "test", that
1241
expansion would look like “<span class="quote"> test </span>”.
1300
14-character space. If the X-Label for a message were “<span class="quote">test</span>”, that
1301
expansion would look like “<span class="quote"> test </span>”.
1243
1303
There are two very little-known modifiers that affect the way that an
1244
1304
expando is replaced. If there is an underline (“<span class="quote">_</span>”) character
1245
1305
between any format modifiers (as above) and the expando letter, it will
1246
1306
expands in all lower case. And if you use a colon (“<span class="quote">:</span>”), it will
1247
1307
replace all decimal points with underlines.
1248
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>29.2. Filters</h3></div></div></div><p>
1308
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-conditionals"></a>29.2. Conditionals</h3></div></div></div><p>
1309
Depending on the format string variable, some of its sequences can be
1310
used to optionally print a string if their value is nonzero. For
1311
example, you may only want to see the number of flagged messages if such
1312
messages exist, since zero is not particularly meaningful. To optionally
1313
print a string based upon one of the above sequences, the following
1315
</p><pre class="screen">
1316
%?<sequence_char>?<optional_string>?</pre><p>
1317
where <span class="emphasis"><em>sequence_char</em></span> is an expando, and
1318
<span class="emphasis"><em>optional_string</em></span> is the string you would like printed if
1319
<span class="emphasis"><em>sequence_char</em></span> is nonzero.
1320
<span class="emphasis"><em>optional_string</em></span> may contain other
1321
sequences as well as normal text, but you may not nest optional
1324
Here is an example illustrating how to optionally print the number of
1325
new messages in a mailbox in
1326
<a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a>:
1327
</p><pre class="screen">
1328
%?n?%n new messages.?</pre><p>
1329
You can also switch between two strings using the following construct:
1330
</p><pre class="screen">
1331
%?<sequence_char>?<if_string>&<else_string>?</pre><p>
1332
If the value of <span class="emphasis"><em>sequence_char</em></span> is
1333
non-zero, <span class="emphasis"><em>if_string</em></span> will be expanded,
1334
otherwise <span class="emphasis"><em>else_string</em></span> will be expanded.
1335
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>29.3. Filters</h3></div></div></div><p>
1249
1336
Any format string ending in a vertical bar (“<span class="quote">|</span>”) will be
1250
1337
expanded and piped through the first word in the string, using spaces
1251
1338
as separator. The string returned will be used for display.
1267
1354
A practical example is the <code class="literal">mutt_xtitle</code>
1268
1355
script installed in the <code class="literal">samples</code>
1269
subdirectory of the mutt documentation: it can be used as filter for
1270
<code class="literal">$status_format</code> to set the current
1356
subdirectory of the Mutt documentation: it can be used as filter for
1357
<a class="link" href="reference.html#status-format" title="3.282. status_format">$status_format</a> to set the current
1271
1358
terminal's title, if supported.
1272
</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting Started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Advanced Usage</td></tr></table></div></body></html>
1359
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-padding"></a>29.4. Padding</h3></div></div></div><p>
1360
In most format strings, Mutt supports different types of padding using
1362
</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">%|X</code></span></dt><dd><p>
1363
When this occurs, Mutt will fill the rest of the
1364
line with the character <code class="literal">X</code>. For
1365
example, filling the rest of the line with dashes is
1367
</p><pre class="screen">
1368
set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"</pre></dd><dt><span class="term">
1369
<code class="literal">%>X</code>
1371
Since the previous expando stops at the end of line, there must be a way
1372
to fill the gap between two items via the <code class="literal">%>X</code>
1373
expando: it puts as many characters <code class="literal">X</code> in between two
1374
items so that the rest of the line will be right-justified. For example,
1375
to not put the version string and hostname the above example on the left
1376
but on the right and fill the gap with spaces, one might use (note the
1377
space after <code class="literal">%></code>):
1378
</p><pre class="screen">
1379
set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"</pre></dd><dt><span class="term"><code class="literal">%*X</code>
1381
Normal right-justification will print everything to the left of the
1382
<code class="literal">%></code>, displaying padding and whatever lies to the
1383
right only if there's room. By contrast, “<span class="quote">soft-fill</span>” gives
1384
priority to the right-hand side, guaranteeing space to display it and
1385
showing padding only if there's still room. If necessary, soft-fill will
1386
eat text leftwards to make room for rightward text. For example, to
1387
right-justify the subject making sure as much as possible of it fits on
1388
screen, one might use (note two spaces after <code class="literal">%*
1389
</code>: the second ensures there's a space between the truncated
1390
right-hand side and the subject):
1391
</p><pre class="screen">
1392
set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%* %s"</pre></dd></dl></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting Started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Advanced Usage</td></tr></table></div></body></html>