This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

mbox configuration

See MailboxFormat/mbox for a complete description of how Dovecot has implemented mbox support.

Mail location

In many systems the user's mails are by default stored in /var/mail/username file. This file is called INBOX in IMAP world. Since IMAP supports multiple mailboxes, you'll need to have a directory for them as well. Usually ~/mail is a good choice for this. For installation such as this, the mail location is specified with:

# %u is replaced with the username that logs in
mail_location = mbox:~/mail:INBOX=/var/mail/%u

It's in no way a requirement to have the INBOX in /var/mail/ directory. In fact this often just brings problems because Dovecot might not be able to write dotlock files to the directory (see below). You can avoid this completely by just keeping everything in ~/mail/:

# INBOX exists in ~/mail/inbox
mail_location = mbox:~/mail

Index files

See MailLocation#indexfiles for full explanation of how to change the index path. For example:

mail_location = mbox:~/mail:INBOX=/var/mail/%u:INDEX=/var/indexes/%u


Make sure that all software accessing the mboxes are using the same locking methods in the same order. The order is important to prevent deadlocking. From Dovecot's side you can change these from mbox_read_locks and mbox_write_locks settings. See MboxLocking for more information.

/var/mail/ dotlocks

Often mbox write locks include dotlock, which means that Dovecot needs to create a new "<mbox>.lock" file to the directory where the mbox file exists. If your INBOXes are in /var/mail/ directory you may have to give Dovecot write access to the directory. There are two ways the /var/mail/ directory's permissions have traditionally been set up:

You can give Dovecot access to mail group by setting:

mail_privileged_group = mail

NOTE: With deliver the mail_privileged_group setting unfortunately doesn't work, so you'll have to use the sticky bit or disable dotlocking completely.

NOTE 2: Older Dovecot versions used mail_extra_groups setting. Its usage could result in security problems in some setups.


The settings below are related to mbox performance. See MailboxFormat/mbox for more complete description of what they do.

Only /var/mail/ mboxes

With POP3 it's been traditional that users have their mails only in the /var/mail/ directory. IMAP however supports having multiple mailboxes, so each user has to have a private directory where the mailboxes are stored. Dovecot also needs a directory for its index files unless you disable them completely.

If you really want to use Dovecot as a plain POP3 server without index files, you can work around the problem of not having the per-user directory:

None: MailLocation/Mbox (last edited 2009-03-15 22:35:22 by localhost)