I have set up Dovecot on my Postfix mailserver. My mailserver is using Maildir format:

home_mailbox = Mail/inbox/

A user's Mail directory looks like this:


I have set up mailboxes in Dovecot accordingly

mail_location = maildir:~/Mail

namespace inbox {
  mailbox drafts {
    special_use = \Drafts
  mailbox sent {
    special_use = \Sent
  mailbox trash {
    special_use = \Trash

Now, the problem is, Dovecot does not use the mailboxes as defined, but creates its own mailboxes named with a . in front and with first letter capital:


Further, instead of using $HOME/Mail/inbox as inbox, it uses $HOME/Mail as inbox. i.e. it created the cur/new/tmp directories directly in $HOME/Mail/, rather than using the existing $HOME/Mail/inbox:



explained briefly, what I need is the following:

I have an existing Maildir folder structure where Postfix delivers mail, plus the usual folders (drafts, sent, ...):


How can I tell Dovecot to use the correct directories?

  • 1
    It looks like you're mixing two things, the mapping between RFC 6154 tags and dovecot mailboxes and the mapping between dovecot mailboxes and filesystem directory names. Those are two different things. Jul 6 '14 at 19:25
  • @Pavel Šimerda - OK, thank you. Do you have a solution how to achieve what I need ? Jul 8 '14 at 17:31
  • I don't know what you're trying to achieve. In my opinion the best way is to deliver mail always through Dovecot and then you don't have any problem. As a bonus, you can then use Dovecot's SIEVE filters which are really handy. Jul 9 '14 at 20:50

By default Dovecot uses Maildir++ directory layout for organizing mailbox directories. This means that all the folders are directly inside ~/Maildir directory, and:

~/Maildir/new, ~/Maildir/cur and ~/Maildir/tmp directories contain
the messages for INBOX.

You can read more about the layout here

Thus what you complain about is standard behavior. You can change the layout nevertheless, by using the LAYOUT and INBOX options. To have cur, new, tmp inside Inbox as you require:


you could specify the following option in /etc/dovecot/conf.d/10-mail.conf:

mail_location = maildir:~/Mail:INBOX=~/Mail/inbox:LAYOUT=fs
  • Good answer. But I still think it may be better to use dovecot's deliver to be able to make use of dovecot filtering features and stuff like that, as described in my answer. Jul 12 '14 at 19:29

Modify your mail_location as follows.

mail_location = maildir:~/Mail:LAYOUT=fs

Ref: Dovecot Docs

  • ~/Maildir/new, ~/Maildir/cur and ~/Maildir/tmp directories contain the messages for INBOX.
  • ~/Maildir/.folder/ is a mailbox folder
  • You can also optionally use the fs layout by appending :LAYOUT=fs to mail_location. This makes the folder structure look like: ~/Maildir/new, ~/Maildir/cur and ~/Maildir/tmp directories contain the messages for INBOX, just like with Maildir++. ~/Maildir/folder/ is a mailbox folder
  • but I need inbox to be in ~/Maildir/inbox/new not ~/Maildir/new. Also, appending :LAYOUT=fs only changes the names of other folders from .Draft to Draft. But my folders have lower case letters, i.e. draft. Is there any way to configure this? Jul 7 '14 at 8:14

The best way to work with dovecot maildirs is to always access them through tools packaged with dovecot. The combination of postfix and dovecot for virtual mailboxes follows.

This is not an answer to how to configure dovecot to understand postfix maildirs but rather an alternative way to work with e-mail directories. You can rather easily transition to this way by simply moving around the files so that everything resides where dovecot expects it.


dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}


virtual_transport = dovecot
virtual_mailbox_domains = hash:/etc/postfix/virtual/domains


example.com    none
example.net    none

(Don't forget to run postmap on the file.)


auth default {
    mechanisms = plain
    userdb static {
        args = uid=vmail gid=vmail home=/var/mail/%d/%n
    passdb passwd-file {
        args = /etc/dovecot/passwd

(Don't forget to create user vmail with group vmail.)



Of course all this is just a simple example (derived from an actual configuration), you can use any user backend you wish with any tools to manage it.


for Dovecot 2.1+

namespace {
    type = private
    separator = .
    inbox = yes
  mailbox Trash {
    auto = subscribe # autocreate and autosubscribe
    special_use = \Trash
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  mailbox Junk {
    auto = subscribe
    special_use = \Junk

You can also add your custom virtual mailboxes. Very nice docs can be found here: http://wiki2.dovecot.org/MailboxSettings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.