Decide on your own which one best fits your needs. See also MaildirFormat and ExtendedMaildirFormat.
See ExtendedMaildirFormat for example layout and how to create folders.
To get mutt to work nicely with this setup use the following in your muttrc:
set mbox_type=Maildir
set spoolfile="~/Maildir/"
set folder="~/Maildir/"
set mask="!^\\.[^.]"
set record="+.Sent"
set postponed="+.Drafts"
mailboxes ! + `\
for file in ~/Maildir/.*; do \
box=$(basename "$file"); \
if [ ! "$box" = '.' -a ! "$box" = '..' -a ! "$box" = '.customflags' \
-a ! "$box" = '.subscriptions' ]; then \
echo -n "\"+$box\" "; \
fi; \
done`
macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"
(Note: When copy/pasting this, make sure you remove whitespace from the end of the lines as otherwise the backslashes at the ends of the lines will not work, resulting in a syntax error.)
The '!' adds the user's default mail spool location, '+' the base folder to the list of mailboxes. This may be necessary if, for example, the system uses mbox. The above code assumes your Maildir being ~/Maildir and containing Drafts and Sent subfolders as commonly used by other MUAs via IMAP. It uses the mailboxes feature to make the folder browser work, ignoring the .customflags and .subscriptions files dovecot puts into Maildirs.
Note that there should be no trailing spaces behind the backslashes ('\') at the end of the lines, blame the Wiki and remove them after pasting or you will see errors like "echo: unknown command"! Also ensure that the lines mailboxes` and done` are on the same line such that without the backslashes so that it looks like
mailboxes ! + `... done`
To additionally get to the folder browser when copying and moving mail, add the following:
macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
Let's make an example: there are folders peter, mike, mutt, and debian. A flat structure would like the following:
~/Mail/
peter/
cur/ new/ tmp/
mike/
cur/ new/ tmp/
mutt/
cur/ new/ tmp/
debian/
cur/ new/ tmp/
To group things, create new directories. If you have messages that fit into a category, but not into a sub-category, create a new folder, e.g. misc.
~/Mail/
friends/
peter/
cur/ new/ tmp/
mike/
cur/ new/ tmp/
others/
cur/ new/ tmp/
software/
mutt/
cur/ new/ tmp/
debian/
cur/ new/ tmp/
misc/
cur/ new/ tmp/
archive/
cur/ new/ tmp/
So far for the theory part. The whole truth is that you can indeed create subfolders inside Maildir folders. The problem with that is that Mutt's directory browser cannot know whether you want to enter the folder when you press enter on the item, or whether you want to go to the subdirectory to see the subfolders there. You can still enter the folder's full name at the 'c'hange folder prompt, but the folder browser will not work.
# MAILDIR LINES # Add Lines header for mutt with Maildirs. Mutt shows lines based on Lines # header. We have to do this manually for Maildir delivered messages. :0 BWfh * H ?? !^Lines: * -1^0 * 1^1 ^.*$ | formail -A "Lines: $="
This script is a simple modification of the one provided above. The difference is that it scans one level deeper into the folder structure--it also makes the root of the maildir structure only show up once instead of twice in the list. Note that this assumes that your maildir is "~/.maildir"
mailboxes + `\
for file in ~/.maildir/.*; do \
box=$(basename "$file"); \
if [ ! "$box" = '.' -a ! "$box" = '..' -a ! "$box" = '.customflags' \
-a ! "$box" = '.subscriptions' ]; then \
echo -n "\"+$box\" "; \
fi; \
done; \
for folder in ~/.maildir/*; do \
if [ -x $folder]; then \
box=$(basename "$folder"); \
for file in ~/.maildir/$box/.*; do \
box2=$(basename "$file"); \
if [ ! "$box2" = '.' -a ! "$box2" = '..' -a ! "$box2" = '.customflags' \
-a ! "$box2" = '.subscriptions' ]; then \
echo -n "\"+$box/$box2\" "; \
fi; \
done; \
fi; \
done`
(Note: When copy/pasting this, make sure you remove whitespace from the end of the lines as otherwise the backslashes at the ends of the lines will not work, resulting in a syntax error.)