Chapter 6. Optional features

If Mutt was compiled with POP3 support (by running the configure script with the --enable-pop flag), it has the ability to work with mailboxes located on a remote POP3 server and fetch mail for local browsing.

Remote POP3 servers can be accessed using URLs with the pop protocol for unencrypted and pops for encrypted communication, see Section 1.2, “URL syntax” for details.

Polling for new mail is more expensive over POP3 than locally. For this reason the frequency at which Mutt will check for mail remotely can be controlled by the popcheckinterval variable, which defaults to every 60 seconds.

Another way to access your POP3 mail is the <fetch-mail function (default: G). It allows to connect to pophost, fetch all your new mail and place it in the local spoolfile. After this point, Mutt runs exactly as if the mail had always been local.

Note: If you only need to fetch all messages to a local mailbox you should consider using a specialized program, such as fetchmail, getmail or similar.

If Mutt was compiled with IMAP support (by running the configure script with the --enable-imap flag), it has the ability to work with folders located on a remote IMAP server.

You can access the remote inbox by selecting the folder by its URL (see Section 1.2, “URL syntax” for details) using the imap or imaps protocol. Alternatively, a pine-compatible notation is also supported, ie [username@]imapserver[:port][/ssl]path/to/folder

Note that not all servers use ``/'' as the hierarchy separator. Mutt should correctly notice which separator is being used by the server and convert paths accordingly.

When browsing folders on an IMAP server, you can toggle whether to look at only the folders you are subscribed to, or all folders with the toggle-subscribed command. See also the imaplistsubscribed variable.

Polling for new mail on an IMAP server can cause noticeable delays. So, you'll want to carefully tune the mailcheck and timeout variables. Personally I use

set mail_check=90
set timeout=15

with relatively good results over my slow modem line.

Note that if you are using mbox as the mail store on UW servers prior to v12.250, the server has been reported to disconnect a client if another client selects the same folder.

Mutt supports four authentication methods with IMAP servers: SASL, GSSAPI, CRAM-MD5, and LOGIN (there is a patch by Grant Edwards to add NTLM authentication for you poor exchange users out there, but it has yet to be integrated into the main tree). There is also support for the pseudo-protocol ANONYMOUS, which allows you to log in to a public IMAP server without having an account. To use ANONYMOUS, simply make your username blank or "anonymous".

SASL is a special super-authenticator, which selects among several protocols (including GSSAPI, CRAM-MD5, ANONYMOUS, and DIGEST-MD5) the most secure method available on your host and the server. Using some of these methods (including DIGEST-MD5 and possibly GSSAPI), your entire session will be encrypted and invisible to those teeming network snoops. It is the best option if you have it. To use it, you must have the Cyrus SASL library installed on your system and compile mutt with the --with-sasl flag.

Mutt will try whichever methods are compiled in and available on the server, in the following order: SASL, ANONYMOUS, GSSAPI, CRAM-MD5, LOGIN.

There are a few variables which control authentication:

  • imapuser - controls the username under which you request authentication on the IMAP server, for all authenticators. This is overridden by an explicit username in the mailbox path (ie by using a mailbox name of the form user@host).

  • imappass - a password which you may preset, used by all authentication methods where a password is needed.

  • imapauthenticators - a colon-delimited list of IMAP authentication methods to try, in the order you wish to try them. If specified, this overrides mutt's default (attempt everything, in the order listed above).

Besides supporting traditional mail delivery through a sendmail-compatible program, mutt supports delivery through SMTP if it was configured and built with --enable-smtp.

If the configuration variable smtpurl is set, mutt will contact the given SMTP server to deliver messages; if it is unset, mutt will use the program specified by sendmail.

For details on the URL syntax, please see Section 1.2, “URL syntax”.

The built-in SMTP support supports encryption (the smtps protocol using SSL or TLS) as well as SMTP authentication using SASL. The authentication mechanisms for SASL are specified in smtpauthenticators defaulting to an empty list which makes mutt try all available methods from most-secure to least-secure.

Mutt contains two types of local caching: (1) the so-called ``header caching'' and (2) the so-called ``body caching'' which are both described in this section.

Header caching is optional as it depends on external libraries, body caching is always enabled if mutt is compiled with POP and/or IMAP support as these use it (body caching requires no external library).

Mutt provides optional support for caching message headers for the following types of folders: IMAP, POP, Maildir and MH. Header caching greatly improves speed because for remote folders, headers usually only need to be downloaded once. For Maildir and MH, reading the headers from a single file is much faster than looking at possibly thousands of single files (since Maildir and MH use one file per message.)

Header caching can be enabled via the configure script and the --enable-hcache option. It's not turned on by default because external database libraries are required: one of qdbm, gdbm or bdb must be present.

If enabled, headercache can be used to either point to a file or a directory. If set to point to a file, one database file for all folders will be used (which may result in lower performance), but one file per folder if it points to a directory.

For the one-file-per-folder case, database files for remote folders will be named according to their URL while database files for local folders will be named by the MD5 checksums of their path. These database files may be safely removed if a system is short on space. You can compute the name of the header cache file for a particular local folder through a command like the following:

$ printf '%s' '/path/to/folder' | md5sum

The md5sum command may also be named md5, depending on your operating system.

Both cache methods can be combined using the same directory for storage (and for IMAP/POP even provide meaningful file names) which simplifies manual maintenance tasks.

In addition to caching message headers only, mutt can also cache whole message bodies. This results in faster display of messages for POP and IMAP folders because messages usually have to be downloaded only once.

For configuration, the variable messagecachedir must point to a directory. There, mutt will create a hierarchy of subdirectories named like: proto:user@hostname where proto is either ``pop'' or ``imap.'' Within there for each folder, mutt stores messages in single files (just like Maildir) so that with manual symlink creation these cache directories can be examined with mutt as read-only Maildir folders.

All files can be removed as needed if the consumed disk space becomes an issue as mutt will silently fetch missing items again.

Mutt does not (yet) support maintenance features for header cache database files so that files have to be removed in case they grow too big. It depends on the database library used for header caching whether disk space freed by removing messages is re-used.

For body caches, mutt can keep the local cache in sync with the remote mailbox if the messagecacheclean variable is set. Cleaning means to remove messages from the cache which are no longer present in the mailbox which only happens when other mail clients or instances of mutt using a different body cache location delete messages (Mutt itself removes deleted messages from the cache when syncing a mailbox). As cleaning can take a noticeable amount of time, it should not be set in general but only occasionally.