Using mutt with a maildir

Contents

What is mutt, and what is maildir?

  • Mutt is a command-line mail client with lots of features
  • maildir is a way to store e-mail

Maildir

maildir is one of the popular ways of storing e-mail in a home directory. It uses a directory and file naming scheme to organize your mail. The organization shows what folders the messages live in. It isn't terribly user friendly to deal with at a low level.

The layout of a maildir looks something like this:

~/.maildir/cur/
~/.maildir/new/
~/.maildir/tmp/
~/.maildir/.Trash/cur/
~/.maildir/.Trash/new/
~/.maildir/.Trash/tmp/
~/.maildir/.Work/cur/
~/.maildir/.Work/new/
~/.maildir/.Work/tmp/

This is an e-mail folder that has an inbox, and two other folders "Trash" and Work".

the 'cur', 'new', and 'tmp', folders hold the messages themselves. The messages have a naming scheme. It might be named something like: 1208448247.30629_1.mail.example.com:2,Sa This all means something for mail servers, but isn't terribly useful to us humans. The individual files contain the e-mail message in its entirety. It contains all the headers, the body, the attachments, etc.

Mutt

Mutt is a command line mail client for unix-based systems. Most of the time, mail stored in maildir format are accessed on a mail server to make them available via pop or imap. Sometimes, it is just easier to access the maildir directly. mutt can do this.

Depending on how your distribution comes set up, and ships mutt, you might be able to simply start mutt at the command line, and everything works. This is the case in good 'ole gentoo linux

A maildir can have various names varying from system to system. I like making mine ~/.maildir/. Here are a few of the different variations I've seen:

~/.maildir
~/maildir
~/.Maildir
~/Maildir
~/mail

Each system can be configured to have the default maildir be something different. If you know what your maildir is, you can start using mutt with it by typing:

~$ mutt -f ~/.maildir

Depending on how your distribution configures mutt by default, you might see your e-mail.