Mail storage

System mailspool and home archives

By default, mutt looks for your inbox mailfolder in the system mailspool. This mailspool is usually an mbox file somewhere like /var/spool/mail/$USER (where $USER is your username). To find out where your mailspool is, type this command in your shell:

echo $MAIL

Your mailspool is just one folder and you should only use it for current mail. Keep old mail archives and filter mailing-lists to mailfolders somewhere in your home directory. By default mutt looks for these folders in the ~/Mail/ directory.

Some people find that it is more logical to have your mailspool in your home directory along with all your other mail. Look at the filtering mail section to find out how to get your system to deliver incoming mail into your home directory.

You can use this configuration command to get mutt to look for your mailspool somewhere other than /var/spool/mail/$USER:

set spoolfile=~/Mail/inbox

Of course your spoolfile doesn't have to be on your local machine, mutt allows you to keep it anywhere, such as a POP3 or IMAP mailbox. It could be mounted via nfs or another network based file system.

Creating mail folders

To create a new mail folder, just move or copy a message and type the name of your folder; mutt will create the folder for you if it doesn't already exist (move/save is the s key and copy is shift & c).

mbox

The traditional unix mailfolder format consists of all the messages stored one after the other in a single plain-text file. This is the default format for system mailspools and is the default folder format for mutt.

There are advantages and disadvantages with mbox format. It is slow when removing messages, as the whole thing has to be rewritten, and it can be a mess when several applications want to write to an mbox at the same time. Advantages are that the mbox format is universal and can be read by many other programs (even some in the Windows world).

So use mbox in these situations:

gzipped mbox

A variation on the mbox format is mbox compressed with gzip. The only advantage is that the files are somewhat smaller than mbox. The disadvantage is that any corruption caused by multiple applications writing to the same file or any other data-loss is generally not recoverable. Mutt does not support gzipped mbox format by default, so you may have to apply the Compressed folders patch for Mutt.

So use gzipped mbox format in these situations:

Maildir

Maildir is a more recently devised folder format where each message is a separate file in a directory full of other messages.

The advantages of Maildir are that no locking is required, so multiple applications can work on the same mailfolder at the same time without messing up. Plus, having one file per message makes manipulating mail with scripts much simpler

The disadvantages are that some file-systems are very inefficient with both small-files and with thousands of files in one directory.

Mutt can automatically detect Maildir. If you want mutt to create Maildir by default rather than mbox, use this configuration command:

set mbox_type=Maildir

Use Maildir in these situations:

MH

MH is a one-file per message format much like Maildir, all the same advantages and disadvantages apply. MH support in mutt is much improved since version 1.2.*.

POP3

POP3 is a way of accessing a remote mailfolder on a POP3 server. Traditionally, mail user agents simply connect to a POP3 mailbox and retrieve everything.

Mutt supports browsing a POP3 account as if it was any other mailfolder. You can sort, delete and read messages without having to retrieve them locally first. However, mutt isn't much use if all you want to do is fetch and download every message to your local machine - see the Collecting mail section for ways to do this properly.

POP3 may not configured for your version of mutt, you can check the compiled-in options by typing this in your shell:

mutt -v

If the output contains +USE_POP, then you have POP3 enabled; if it also contains +USE_SSL, then you have Secure Socket Layer encrypted POP3 enabled as well.

To browse a POP3 mailbox, just hit c to change mailboxes. Then, instead of typing the name of a local mailbox, you can enter the location of your POP3 server. This is much like typing the URL for a page in a web-browser:

pop://username@mail.example.com/

Mutt will ask you for your password and you can browse, delete, edit and save the messages as normal. If your POP3 mail account supports SSL encryption, then you should use pops:// instead of pop:// to enable it.

Note, URL-style addressing for POP and IMAP mailboxes is a recent feature, if you are using mutt version 1.2.* or older, the syntax is different.

Use POP3 mail storage in these situations:

IMAP

IMAP is a more sophisticated successor to POP3, the name is an acronym of Internet Message Access Protocol. If the output of mutt -v contains +USE_IMAP, then you have it enabled; if it also contains +USE_SSL, then you have Secure Socket Layer encrypted IMAP as well.

IMAP can be used as a full alternative to local mail storage. You can create sub-folders and manipulate messages in every way. The author of mutt's IMAPsupport has written a complete mutt and IMAP guide.

Mutt's IMAP support is missing extended features like header caching and a disconnected mode for offline reading. If you find yourself using IMAP all the time, then you probably want to use a helper tool like OfflineIMAP to speed things up.

IMAP locations can be accessed in the same sort of web-browser style as POP3 mailboxes:

imap://username@mail.example.com/
imaps://username@mail.example.com/

You can access individual folders in your account by using '/' as a path separator:

imap://username@mail.example.com/path/to/mailbox/

Note, URL-style addressing for POP3 and IMAP mailboxes is a recent feature, if you are using mutt version 1.2.* or older, the syntax is different.

Use IMAP mail storage in these situations:

NFS

IMAP has many advantages as a way of accessing mail over a network connection; it is a high level protocol understood by a large number of mail clients, and if you are connecting via ssl, then it can provide strong authentication and encryption.

The disadvantage of imap is that mail servers tend to be slower than simply accessing the mail-files directly using the NFS 'Network File System' (sometimes known as the 'Nightmare File System').

Use NFS mail storage in these situations:

Document Links

Compressed folders patch for Mutt
The compressed folders patch allows to you to access mailbox folders, which are compressed using something like gzip or which are encrypted with something like pgp.
http://www.spinnaker.de/mutt/compressed/
mutt and IMAP guide
Brendan Culley's guide to using imap with mutt
http://mutt.sourceforge.net/imap/
Using maildir format
D. J. Bernstein's guide to the Maildir archive format
http://cr.yp.to/proto/maildir.html
Internet Message Access Protocol
IMAP is a method of accessing electronic mail or bulletin board messages that are kept on a mail server
http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol
OfflineIMAP
With OfflineIMAP, you can read the same mailbox from multiple computers. You get a current copy of your messages on each computer, and changes you make one place will be visible on all other systems.
https://github.com/nicolas33/offlineimap
This document was last modified on 2012-02-28 21:04:57.
Bruno Postle
Copyright © 2001 Bruno Postle and others. This guide is released under the Free Documentation License. http://www.gnu.org/licenses/fdl.txt