[Dovecot] Question on Mail Formats

William Blunn bill+dovecot at blunn.org
Thu Sep 9 17:50:57 EEST 2010

On 09/09/2010 14:49, Giovanni Giorgi wrote:
> I am still tuning my dovecot, but I find myself very confortable with it.
> I am going to structure my imap folder with a new namespace (somthing you cannot do with GMail :)
> and I can choose the mailbox format.
> What is the difference between the two mailbox format "mbox" and "maildir"?
> I know mbox is older, but there is a good reason to use maildir instead?
> I can get for instance some performance improvement?
> Better archiving?

mbox stores all the messages for one mailbox (mail folder) in one file.

Maildir stores each message in a separate file.


With mbox you need to be careful that everything which manipulates mbox 
files uses compatible locking methods, otherwise you risk scrambling 
your mail files.

With Maildir this problem does not arise.


With mbox, deleting messages from the beginning of the mailbox is 
comparitively expensive.

With Maildir, deleting messages is always cheap.


With mbox, reading a portion (e.g. header) from every message in a 
mailbox (mail folder) only requires opening one file.

With Maildir, reading a portion (e.g. header) from every message in a 
mailbox (mail folder) requires opening many files.


If you are picking this issue up and looking at it, you may want to 
consider Dovecot's own native formats single-dbox and multi-dbox as well.

See http://wiki2.dovecot.org/MailboxFormat

Note that multi-dbox requires Dovecot 2. Then again if you aren't 
already using Dovecot 2, you might want to consider upgrading.


More information about the dovecot mailing list