3280
<sect1 id="formatstrings">
3281
<title>Format Strings</title>
3284
<title>Basic usage</title>
3287
Format strings are a general concept you'll find in several locations
3288
through the mutt configuration, especially in the
3289
<link linkend="index-format">$index_format"</link>,
3290
<link linkend="pager-format">$pager_format"</link>,
3291
<link linkend="status-format">$status_format"</link>,
3292
and other ``*_format'' variables. These can be very straightforward,
3293
and it's quite possible you already know how to use them.
3297
The most basic format string element is a percent symbol followed
3298
by another character. For example, <literal>%s</literal>
3299
represents a message's Subject: header in the <link
3300
linkend="index-format">$index_format"</link> variable. The
3301
``expandos'' available are documented with each format variable, but
3302
there are general modifiers available with all formatting expandos,
3303
too. Those are our concern here.
3307
Some of the modifers are borrowed right out of C (though you might
3308
know them from Perl, Python, shell, or another langugage). These are
3309
the [-]m.n modifiers, as in <literal>%-12.12s</literal>. As with
3310
such programming languages, these modifiers allow you to specify the
3311
minumum and maximum size of the resulting string, as well as its
3312
justification. If the ``-'' sign follows the percent, the string will
3313
be left-justified instead of right-justified. If there's a number
3314
immediately following that, it's the minimum amount of space the
3315
formatted string will occupy -- if it's naturally smaller than that, it
3316
will be padded out with spaces. If a decimal point and another number
3317
follow, that's the maximum space allowable -- the string will not be
3318
permitted to exceed that width, no matter its natural size. Each of
3319
these three elements is optional, so that all these are legal format
3321
<literal>%-12s</literal>
3322
<literal>%4c</literal>
3323
<literal>%.15F</literal>
3324
<literal>%-12.15L</literal>
3328
Mutt adds some other modifiers to format strings. If you use an equals
3329
symbol (<literal>=</literal>) as a numeric prefix (like the minus
3330
above), it will force the string to be centered within its minimum
3331
space range. For example, <literal>%=14y</literal> will reserve 14
3332
characters for the %y expansion -- that's the X-Label: header, in
3333
<literal>$index_format</literal>. If the expansion
3334
results in a string less than 14 characters, it will be centered in a
3335
14-character space. If the X-Label for a message were "test", that
3336
expansion would look like `` test ''.
3340
There are two very little-known modifiers that affect the way that an
3341
expando is replaced. If there is an underline (``_'') character
3342
between any format modifiers (as above) and the expando letter, it will
3343
expands in all lower case. And if you use a colon (``:''), it will
3344
replace all decimal points with underlines.
3350
<title>Filters</title>
3353
Any format string ending in a vertical bar (``|'') will be
3354
expanded and piped through the first word in the string, using spaces
3355
as separator. The string returned will be used for display.
3356
If the returned string ends in %, it will be passed through
3357
the formatter a second time. This allows the filter to generate a
3358
replacement format string including % expandos.
3362
All % expandos in a format string are expanded before the script
3367
set status_format="script.sh '%r %f (%L)'|"
3371
will make mutt expand <literal>%r</literal>,
3372
<literal>%f</literal> and <literal>%L</literal>
3373
before calling the script. The example also shows that arguments can be
3374
quoted: the script will receive the expanded string between the single quotes
3375
as the only argument.
3379
A practical example is the <literal>mutt_xtitle</literal>
3380
script installed in the <literal>samples</literal>
3381
subdirectory of the mutt documentation: it can be used as filter for
3382
<literal>$status_format</literal> to set the current
3383
terminal's title, if supported.
3264
3392
<chapter id="advancedusage">
4509
<title>POP3 Support (OPTIONAL)</title>
4512
If Mutt was compiled with POP3 support (by running the <emphasis>configure</emphasis>
4513
script with the <emphasis>--enable-pop</emphasis> flag), it has the ability to work
4514
with mailboxes located on a remote POP3 server and fetch mail for local
4519
You can access the remote POP3 mailbox by selecting the folder
4520
<literal>pop://popserver/</literal>.
4524
You can select an alternative port by specifying it with the server, ie:
4525
<literal>pop://popserver:port/</literal>.
4529
You can also specify different username for each folder, ie:
4530
<literal>pop://username@popserver[:port]/</literal>.
4534
Polling for new mail is more expensive over POP3 than locally. For this
4535
reason the frequency at which Mutt will check for mail remotely can be
4537
<link linkend="pop-checkinterval">$pop_checkinterval</link>
4538
variable, which defaults to every 60 seconds.
4542
If Mutt was compiled with SSL support (by running the <emphasis>configure</emphasis>
4543
script with the <emphasis>--with-ssl</emphasis> flag), connections to POP3 servers
4544
can be encrypted. This naturally requires that the server supports
4545
SSL encrypted connections. To access a folder with POP3/SSL, you should
4546
use pops: prefix, ie:
4547
<literal>pops://[username@]popserver[:port]/</literal>.
4551
Another way to access your POP3 mail is the <emphasis>fetch-mail</emphasis> function
4552
(default: G). It allows to connect to <link linkend="pop-host">$pop_host</link>, fetch all your new mail and place it in the
4553
local <link linkend="spoolfile">$spoolfile</link>. After this
4554
point, Mutt runs exactly as if the mail had always been local.
4558
<emphasis role="bold">Note:</emphasis> If you only need to fetch all messages to local mailbox
4559
you should consider using a specialized program, such as <ulink
4560
url="http://www.ccil.org/~esr/fetchmail"
4568
<title>IMAP Support (OPTIONAL)</title>
4571
If Mutt was compiled with IMAP support (by running the <emphasis>configure</emphasis>
4572
script with the <emphasis>--enable-imap</emphasis> flag), it has the ability to work
4573
with folders located on a remote IMAP server.
4577
You can access the remote inbox by selecting the folder
4578
<literal>imap://imapserver/INBOX</literal>, where <literal>imapserver</literal> is the name of the
4579
IMAP server and <literal>INBOX</literal> is the special name for your spool mailbox on
4580
the IMAP server. If you want to access another mail folder at the IMAP
4581
server, you should use <literal>imap://imapserver/path/to/folder</literal> where
4582
<literal>path/to/folder</literal> is the path of the folder you want to access.
4586
You can select an alternative port by specifying it with the server, ie:
4587
<literal>imap://imapserver:port/INBOX</literal>.
4591
You can also specify different username for each folder, ie:
4592
<literal>imap://username@imapserver[:port]/INBOX</literal>.
4596
If Mutt was compiled with SSL support (by running the <emphasis>configure</emphasis>
4597
script with the <emphasis>--with-ssl</emphasis> flag), connections to IMAP servers
4598
can be encrypted. This naturally requires that the server supports
4599
SSL encrypted connections. To access a folder with IMAP/SSL, you should
4600
use <literal>imaps://[username@]imapserver[:port]/path/to/folder</literal> as your
4605
Pine-compatible notation is also supported, ie
4606
<literal>{[username@]imapserver[:port][/ssl]}path/to/folder</literal>
4610
Note that not all servers use / as the hierarchy separator. Mutt should
4611
correctly notice which separator is being used by the server and convert
4616
When browsing folders on an IMAP server, you can toggle whether to look
4617
at only the folders you are subscribed to, or all folders with the
4618
<emphasis>toggle-subscribed</emphasis> command. See also the
4619
<link linkend="imap-list-subscribed">$imap_list_subscribed</link> variable.
4623
Polling for new mail on an IMAP server can cause noticeable delays. So, you'll
4624
want to carefully tune the
4625
<link linkend="mail-check">$mail_check</link>
4627
<link linkend="timeout">$timeout</link>
4628
variables. Personally I use
4635
with relatively good results over my slow modem line.
4639
Note that if you are using mbox as the mail store on UW servers prior to
4640
v12.250, the server has been reported to disconnect a client if another client
4641
selects the same folder.
4645
<title>The Folder Browser</title>
4648
As of version 1.2, mutt supports browsing mailboxes on an IMAP
4649
server. This is mostly the same as the local file browser, with the
4650
following differences:
4656
In lieu of file permissions, mutt displays the string "IMAP",
4657
possibly followed by the symbol "+", indicating
4658
that the entry contains both messages and subfolders. On
4659
Cyrus-like servers folders will often contain both messages and
4666
For the case where an entry can contain both messages and
4667
subfolders, the selection key (bound to <literal>enter</literal> by default)
4668
will choose to descend into the subfolder view. If you wish to view
4669
the messages in that folder, you must use <literal>view-file</literal> instead
4670
(bound to <literal>space</literal> by default).
4676
You can create, delete and rename mailboxes with the
4677
<literal>create-mailbox</literal>, <literal>delete-mailbox</literal>, and
4678
<literal>rename-mailbox</literal> commands (default bindings: <literal>C</literal>,
4679
<literal>d</literal> and <literal>r</literal>, respectively). You may also
4680
<literal>subscribe</literal> and <literal>unsubscribe</literal> to mailboxes (normally
4681
these are bound to <literal>s</literal> and <literal>u</literal>, respectively).
4692
<title>Authentication</title>
4695
Mutt supports four authentication methods with IMAP servers: SASL,
4696
GSSAPI, CRAM-MD5, and LOGIN (there is a patch by Grant Edwards to add
4697
NTLM authentication for you poor exchange users out there, but it has
4698
yet to be integrated into the main tree). There is also support for
4699
the pseudo-protocol ANONYMOUS, which allows you to log in to a public
4700
IMAP server without having an account. To use ANONYMOUS, simply make
4701
your username blank or "anonymous".
4705
SASL is a special super-authenticator, which selects among several protocols
4706
(including GSSAPI, CRAM-MD5, ANONYMOUS, and DIGEST-MD5) the most secure
4707
method available on your host and the server. Using some of these methods
4708
(including DIGEST-MD5 and possibly GSSAPI), your entire session will be
4709
encrypted and invisible to those teeming network snoops. It is the best
4710
option if you have it. To use it, you must have the Cyrus SASL library
4711
installed on your system and compile mutt with the <emphasis>--with-sasl</emphasis> flag.
4715
Mutt will try whichever methods are compiled in and available on the server,
4716
in the following order: SASL, ANONYMOUS, GSSAPI, CRAM-MD5, LOGIN.
4720
There are a few variables which control authentication:
4726
<link linkend="imap-user">$imap_user</link> - controls
4727
the username under which you request authentication on the IMAP server,
4728
for all authenticators. This is overridden by an explicit username in
4729
the mailbox path (ie by using a mailbox name of the form
4730
<literal>{user@host}</literal>).
4736
<link linkend="imap-pass">$imap_pass</link> - a
4737
password which you may preset, used by all authentication methods where
4738
a password is needed.
4744
<link linkend="imap-authenticators">$imap_authenticators</link> - a colon-delimited list of IMAP
4745
authentication methods to try, in the order you wish to try them. If
4746
specified, this overrides mutt's default (attempt everything, in the order
4759
<sect1 id="account-hook">
4760
<title>Managing multiple IMAP/POP accounts (OPTIONAL)</title>
4763
If you happen to have accounts on multiple IMAP and/or POP servers,
4764
you may find managing all the authentication settings inconvenient and
4765
error-prone. The account-hook command may help. This hook works like
4766
folder-hook but is invoked whenever you access a remote mailbox
4767
(including inside the folder browser), not just when you open the
4778
account-hook . 'unset imap_user; unset imap_pass; unset tunnel'
4779
account-hook imap://host1/ 'set imap_user=me1 imap_pass=foo'
4780
account-hook imap://host2/ 'set tunnel="ssh host2 /usr/libexec/imapd"'
4787
4633
<sect1 id="urlview">
4788
4634
<title>Start a WWW Browser on URLs (EXTERNAL)</title>
4809
<sect1 id="caching">
4810
<title>Local caching (OPTIONAL)</title>
4813
Mutt contains two types of local caching: <emphasis>(1)</emphasis>
4814
the so-called ``header caching'' and <emphasis>(2)</emphasis> the
4815
so-called ``body caching'' which are both described in this section.
4819
These are optional which means they're not enabled by default.
4820
Details on how to enable either of these techniques are given in the
4821
following subsections.
4824
<sect2 id="header-caching">
4825
<title>Header caching</title>
4828
Mutt provides optional support for caching message headers for the
4829
following types of folders: IMAP, POP, Maildir and MH. Header caching
4830
greatly improves speed because for remote folders, headers
4831
usually only need to be downloaded once. For Maildir and MH, reading the
4832
headers from a single file is much faster than looking at possibly
4833
thousands of single files (since Maildir and MH use one file per message.)
4837
Header caching can be enabled via the configure script and the
4838
<emphasis>--enable-hcache</emphasis> option. It's not turned on
4839
by default because external database libraries are required: one
4840
of qdbm, gdbm or bdb must be present.
4845
linkend="header-cache">$header_cache</link> can be
4846
used to either point to a file or a directory. If set to point to
4847
a file, one database file for all folders will be used (which may
4848
result in lower performance), but one file per folder if it points
4853
For the one-file-per-folder case, database files will be named by MD5
4854
sums. They may be safely removed if a system is short on space. You
4855
can compute the name of the header cache file for a particular folder
4856
through a command like the following:
4861
$ printf '%s' '/path/to/folder' | md5sum
4862
$ printf '%s' 'imaps://user@host/path/to/folder' | md5sum
4863
$ printf '%s' 'pops://user@host' | md5sum
4868
The <literal>md5sum</literal> command may also be
4869
named <literal>md5</literal>, depending on your operating system.
4874
<sect2 id="body-caching">
4875
<title>Body caching</title>
4878
In addition to caching message headers only, mutt can also cache
4879
whole message bodies. This results in faster display of messages
4880
for POP and IMAP folders because messages usually have to be
4881
downloaded only once.
4885
If the configure script is called with <emphasis>--enable-pop</emphasis>
4886
and/or <emphasis>--enable-imap</emphasis>, body caching will be
4887
built in as it does not require additional software packages such
4888
as database libraries.
4892
For configuration, the variable <link linkend="message-cachedir"
4893
>$message_cachedir</link> must point to a
4894
directory. There, mutt will create a hierarchy of subdirectories
4895
named like: <literal>proto:user@hostname</literal> where
4896
<literal>proto</literal> is either ``pop'' or ``imap.'' Within
4897
there for each folder, mutt stores messages in single files (just
4898
like Maildir) so that with manual symlink creation these cache
4899
directories can be examined with mutt as read-only Maildir folders.
4903
All files can be removed as needed if the consumed disk space
4904
becomes an issue as mutt will silently fetch missing items again.
4913
4657
<chapter id="mimesupport">
5575
<chapter id="optionalfeatures">
5576
<title>Optional features</title>
5579
<title>General notes</title>
5582
<title>Enabling/disabling features</title>
5585
Mutt supports several of optional features which can be enabled or
5586
disabled at compile-time by giving the <emphasis>configure</emphasis> script
5587
certain arguments. These are listed in the ``Optional features'' section of
5588
the <emphasis>configure --help</emphasis> output.
5592
Which features are enabled or disabled can later be determined from the
5593
output of <literal>mutt -v</literal>. If a compile option starts with
5594
``+'' it is enabled and disabled if prefixed with ``-''. For example, if
5595
mutt was compiled using GnuTLS for encrypted communication instead of
5596
OpenSSL, <literal>mutt -v</literal> would contain:
5600
-USE_SSL_OPENSSL +USE_SSL_GNUTLS</screen>
5604
<sect2 id="url-syntax">
5605
<title>URL syntax</title>
5608
Mutt optionally supports the IMAP, POP3 and SMTP protocols which require
5609
to access servers using URLs. The canonical syntax for specifying URLs
5610
in mutt is (an item enclosed in <literal>[]</literal> means it is optional and
5615
proto[s]://[username[:password]@]server[:port]/[path]
5619
<literal>proto</literal> is the communication protocol:
5620
<literal>imap</literal> for IMAP, <literal>pop</literal> for POP3 and
5621
<literal>smtp</literal> for SMTP. If ``s'' for ``secure communication''
5622
is appended, mutt will attempt to establish an encrypted communication
5623
using SSL or TLS. If no explicit port is given, mutt will use the
5624
system's default for the given protocol.
5628
Since all protocols by mutt support authentication, the username may be
5629
given directly in the URL instead of using the <literal>pop_user</literal> or
5630
<literal>imap_user</literal> variables. A password can be given, too but
5631
is not recommended if the URL is specified in a configuration file on
5636
The optional path is only relevant for IMAP.
5640
For IMAP for example, you can select an alternative port by specifying it with the
5641
server: <literal>imap://imapserver:port/INBOX</literal>. You can also specify different
5642
username for each folder: <literal>imap://username@imapserver[:port]/INBOX</literal>
5643
or <literal>imap://username2@imapserver[:port]/path/to/folder</literal>.
5644
Replacing <literal>imap://</literal> by <literal>imaps://</literal>
5645
would make mutt attempt to conect using SSL or TLS on a different port
5646
to encrypt the communication.
5654
<title>SSL/TLS Support</title>
5657
If mutt is compiled with IMAP, POP3 and/or SMTP support, it can also be
5658
compiled with support for SSL or TLS using either OpenSSL or GnuTLS (
5659
by running the <emphasis>configure</emphasis> script with the
5660
<emphasis>--enable-ssl=...</emphasis> option for OpenSSL or
5661
<emphasis>--enable-gnutls=...</emphasis> for GnuTLS). Mutt can then
5662
attempt to encrypt communication with remote servers if these protocols
5663
are suffixed with ``s'' for ``secure communication''.
5669
<title>POP3 Support</title>
5672
If Mutt was compiled with POP3 support (by running the <emphasis>configure</emphasis>
5673
script with the <emphasis>--enable-pop</emphasis> flag), it has the ability to work
5674
with mailboxes located on a remote POP3 server and fetch mail for local
5679
Remote POP3 servers can be accessed using URLs with the <literal>pop</literal> protocol
5680
for unencrypted and <literal>pops</literal> for encrypted
5681
communication, see <xref linkend="url-syntax"/> for details.
5685
Polling for new mail is more expensive over POP3 than locally. For this
5686
reason the frequency at which Mutt will check for mail remotely can be
5688
<link linkend="pop-checkinterval">$pop_checkinterval</link>
5689
variable, which defaults to every 60 seconds.
5693
Another way to access your POP3 mail is the <emphasis>fetch-mail</emphasis> function
5694
(default: G). It allows to connect to <link linkend="pop-host">$pop_host</link>, fetch all your new mail and place it in the
5695
local <link linkend="spoolfile">$spoolfile</link>. After this
5696
point, Mutt runs exactly as if the mail had always been local.
5700
<emphasis role="bold">Note:</emphasis> If you only need to fetch all messages to a
5701
local mailbox you should consider using a specialized program, such as
5702
<literal>fetchmail</literal>, <literal>getmail</literal> or similar.
5708
<title>IMAP Support</title>
5711
If Mutt was compiled with IMAP support (by running the <emphasis>configure</emphasis>
5712
script with the <emphasis>--enable-imap</emphasis> flag), it has the ability to work
5713
with folders located on a remote IMAP server.
5717
You can access the remote inbox by selecting the folder by its URL
5718
(see <xref linkend="url-syntax"/> for details) using the
5719
<literal>imap</literal> or <literal>imaps</literal> protocol.
5720
Alternatively, a pine-compatible notation is also supported, ie
5721
<literal>{[username@]imapserver[:port][/ssl]}path/to/folder</literal>
5725
Note that not all servers use ``/'' as the hierarchy separator. Mutt should
5726
correctly notice which separator is being used by the server and convert
5731
When browsing folders on an IMAP server, you can toggle whether to look
5732
at only the folders you are subscribed to, or all folders with the
5733
<emphasis>toggle-subscribed</emphasis> command. See also the
5734
<link linkend="imap-list-subscribed">$imap_list_subscribed</link> variable.
5738
Polling for new mail on an IMAP server can cause noticeable delays. So, you'll
5739
want to carefully tune the
5740
<link linkend="mail-check">$mail_check</link>
5742
<link linkend="timeout">$timeout</link>
5743
variables. Personally I use
5750
with relatively good results over my slow modem line.
5754
Note that if you are using mbox as the mail store on UW servers prior to
5755
v12.250, the server has been reported to disconnect a client if another client
5756
selects the same folder.
5760
<title>The Folder Browser</title>
5763
As of version 1.2, mutt supports browsing mailboxes on an IMAP
5764
server. This is mostly the same as the local file browser, with the
5765
following differences:
5771
In lieu of file permissions, mutt displays the string "IMAP",
5772
possibly followed by the symbol "+", indicating
5773
that the entry contains both messages and subfolders. On
5774
Cyrus-like servers folders will often contain both messages and
5781
For the case where an entry can contain both messages and
5782
subfolders, the selection key (bound to <literal>enter</literal> by default)
5783
will choose to descend into the subfolder view. If you wish to view
5784
the messages in that folder, you must use <literal>view-file</literal> instead
5785
(bound to <literal>space</literal> by default).
5791
You can create, delete and rename mailboxes with the
5792
<literal>create-mailbox</literal>, <literal>delete-mailbox</literal>, and
5793
<literal>rename-mailbox</literal> commands (default bindings: <literal>C</literal>,
5794
<literal>d</literal> and <literal>r</literal>, respectively). You may also
5795
<literal>subscribe</literal> and <literal>unsubscribe</literal> to mailboxes (normally
5796
these are bound to <literal>s</literal> and <literal>u</literal>, respectively).
5807
<title>Authentication</title>
5810
Mutt supports four authentication methods with IMAP servers: SASL,
5811
GSSAPI, CRAM-MD5, and LOGIN (there is a patch by Grant Edwards to add
5812
NTLM authentication for you poor exchange users out there, but it has
5813
yet to be integrated into the main tree). There is also support for
5814
the pseudo-protocol ANONYMOUS, which allows you to log in to a public
5815
IMAP server without having an account. To use ANONYMOUS, simply make
5816
your username blank or "anonymous".
5820
SASL is a special super-authenticator, which selects among several protocols
5821
(including GSSAPI, CRAM-MD5, ANONYMOUS, and DIGEST-MD5) the most secure
5822
method available on your host and the server. Using some of these methods
5823
(including DIGEST-MD5 and possibly GSSAPI), your entire session will be
5824
encrypted and invisible to those teeming network snoops. It is the best
5825
option if you have it. To use it, you must have the Cyrus SASL library
5826
installed on your system and compile mutt with the <emphasis>--with-sasl</emphasis> flag.
5830
Mutt will try whichever methods are compiled in and available on the server,
5831
in the following order: SASL, ANONYMOUS, GSSAPI, CRAM-MD5, LOGIN.
5835
There are a few variables which control authentication:
5841
<link linkend="imap-user">$imap_user</link> - controls
5842
the username under which you request authentication on the IMAP server,
5843
for all authenticators. This is overridden by an explicit username in
5844
the mailbox path (ie by using a mailbox name of the form
5845
<literal>{user@host}</literal>).
5851
<link linkend="imap-pass">$imap_pass</link> - a
5852
password which you may preset, used by all authentication methods where
5853
a password is needed.
5859
<link linkend="imap-authenticators">$imap_authenticators</link> - a colon-delimited list of IMAP
5860
authentication methods to try, in the order you wish to try them. If
5861
specified, this overrides mutt's default (attempt everything, in the order
5875
<title>SMTP Support</title>
5878
Besides supporting traditional mail delivery through a
5879
sendmail-compatible program, mutt supports delivery through SMTP if it
5880
was configured and built with <literal>--enable-smtp</literal>.
5884
If the configuration variable
5885
<link linkend="smtp-url">$smtp_url</link> is set, mutt
5886
will contact the given SMTP server to deliver messages; if it is unset,
5887
mutt will use the program specified by <link linkend="sendmail">$sendmail</link>.
5891
For details on the URL syntax, please see <xref linkend="url-syntax"/>.
5895
The built-in SMTP support supports encryption (the <literal>smtps</literal> protocol
5896
using SSL or TLS) as well as SMTP authentication using SASL. The authentication mechanisms
5897
for SASL are specified in <link linkend="smtp-authenticators">$smtp_authenticators</link>
5898
defaulting to an empty list which makes mutt try all available methods
5899
from most-secure to least-secure.
5904
<sect1 id="account-hook">
5905
<title>Managing multiple accounts</title>
5908
If you happen to have accounts on multiple IMAP, POP and/or SMTP servers,
5909
you may find managing all the authentication settings inconvenient and
5910
error-prone. The account-hook command may help. This hook works like
5911
folder-hook but is invoked whenever you access a remote mailbox
5912
(including inside the folder browser), not just when you open the
5923
account-hook . 'unset imap_user; unset imap_pass; unset tunnel'
5924
account-hook imap://host1/ 'set imap_user=me1 imap_pass=foo'
5925
account-hook imap://host2/ 'set tunnel="ssh host2 /usr/libexec/imapd"'
5926
account-hook smtp://user@host3/ 'set tunnel="ssh host3 /usr/libexec/smtpd"'
5933
<sect1 id="caching">
5934
<title>Local caching</title>
5937
Mutt contains two types of local caching: <emphasis>(1)</emphasis>
5938
the so-called ``header caching'' and <emphasis>(2)</emphasis> the
5939
so-called ``body caching'' which are both described in this section.
5943
These are optional which means they're not enabled by default.
5944
Details on how to enable either of these techniques are given in the
5945
following subsections.
5948
<sect2 id="header-caching">
5949
<title>Header caching</title>
5952
Mutt provides optional support for caching message headers for the
5953
following types of folders: IMAP, POP, Maildir and MH. Header caching
5954
greatly improves speed because for remote folders, headers
5955
usually only need to be downloaded once. For Maildir and MH, reading the
5956
headers from a single file is much faster than looking at possibly
5957
thousands of single files (since Maildir and MH use one file per message.)
5961
Header caching can be enabled via the configure script and the
5962
<emphasis>--enable-hcache</emphasis> option. It's not turned on
5963
by default because external database libraries are required: one
5964
of qdbm, gdbm or bdb must be present.
5969
linkend="header-cache">$header_cache</link> can be
5970
used to either point to a file or a directory. If set to point to
5971
a file, one database file for all folders will be used (which may
5972
result in lower performance), but one file per folder if it points
5977
For the one-file-per-folder case, database files will be named by MD5
5978
sums. They may be safely removed if a system is short on space. You
5979
can compute the name of the header cache file for a particular folder
5980
through a command like the following:
5985
$ printf '%s' '/path/to/folder' | md5sum
5986
$ printf '%s' 'imaps://user@host/path/to/folder' | md5sum
5987
$ printf '%s' 'pops://user@host' | md5sum
5992
The <literal>md5sum</literal> command may also be
5993
named <literal>md5</literal>, depending on your operating system.
5998
<sect2 id="body-caching">
5999
<title>Body caching</title>
6002
In addition to caching message headers only, mutt can also cache
6003
whole message bodies. This results in faster display of messages
6004
for POP and IMAP folders because messages usually have to be
6005
downloaded only once.
6009
If the configure script is called with <emphasis>--enable-pop</emphasis>
6010
and/or <emphasis>--enable-imap</emphasis>, body caching will be
6011
built in as it does not require additional software packages such
6012
as database libraries.
6016
For configuration, the variable <link linkend="message-cachedir"
6017
>$message_cachedir</link> must point to a
6018
directory. There, mutt will create a hierarchy of subdirectories
6019
named like: <literal>proto:user@hostname</literal> where
6020
<literal>proto</literal> is either ``pop'' or ``imap.'' Within
6021
there for each folder, mutt stores messages in single files (just
6022
like Maildir) so that with manual symlink creation these cache
6023
directories can be examined with mutt as read-only Maildir folders.
6027
All files can be removed as needed if the consumed disk space
6028
becomes an issue as mutt will silently fetch missing items again.
5811
6037
<chapter id="tuning">
5812
6038
<title>Performance tuning</title>