4

I am trying to figure out if/what there is a connection between the file-system structure and dovecot's namespace prefixes. Specifically, in my setup, I have not declared any namespace, so dovecot creates a default one. Whenever a new user logs in for first time the folder structure in their maildir is:

Maildir/
   ...
   cur
   new
   .Sent Items
   .Drafts
   .Junk E-mail
   .Deleted Items
   ...

When I login from an email client I see these mailboxes:

INBOX
Sent Items
Drafts
Junk E-mail
Deleted Items

My questions are:

1.Shouldn't the INBOX mailbox be an ".INBOX" directory? From looking into the contents, I see that the INBOX mailbox gets its items from the "cur" directory. Why this exception for the INBOX mailbox?

2.If I define an explicit private namespace with inbox=yes, and prefix=FOO, what consequences, if any will this have to the folder structure and to the client mailbox display?. Essentially I cant figure out what purpose the namespace prefix serves, and if it is used for naming the actual directories in the users Maildir or not.

Thanks

EDIT: After reading the answers and doing some more digging, what I still have this problem: the IMAP mailboxes/folder have their corresponding fs directory inside the Maildir directory, (e.g. when the user creates (from their IMAP client) a toplevel folder/mailbox, say "Important", there is an ".Important" directory that gets created under Maildir. So every IMAP mailbox/folder has its mapped directory be a subdirectory of Maildir. Except the INBOX mailbox: Its corresponding directory is the Maildir itself. I would like to set the INBOX directory to be a subdirectory of Maildir, as it is for all other mailboxes. I dont use mbox at all. Does what I want to do make sense and if yes how can I do it?

2 Answers 2

4

Shouldn't the INBOX mailbox be an ".INBOX" directory?

Possibly, but customarily the ~/Maildir/[new|cur|tmp] are what make up the INBOX.

As with all things you can configure Dovecot differently to match with how you want e-mail messages to be delivered and stored. ~/Maildir/INBOX/[new|cur|tmp] is completely possble. Beware though that that should match with how your incoming SMTP server (or LDA) is configured to store new e-mail on disk as well....

Folders are an extension to the original Maildir format called Maildir++ as described here. A IMAP folder is implemented as a subdirectory with the naming convention Maildir/.<Folder Name>and Maildir/.<Folder Name>.<Sub Folder>.

IMAP folders are also Maildir directories themselves, in the regard that they also contain the cur, new and tmp subdirectories i.e. Maildir/.<Folder Name>/[cur|new|tmp]/

Depending on your needs you can change that to Maildir/<Folder Name>/<Sub folder> by including the LAYOUT=fs option in the Dovecot mail_location configuration setting. Although I don't really see the need as you shouldn't be managing your mail via the file-system anyway.

If I define an explicit private namespace with inbox=yes, and prefix=FOO, what consequences, if any will this have to the folder structure and to the client mailbox display?

On the folder structure on disk, mostly none, that is configured by the mail_location setting in the namespace and the presence or absence of the layout=FS option.

Creating a namespace with inbox=yes makes that namespace the INBOX. A user can only have a single INBOX. You need to ensure that your incoming mail also get delivered there for that to be useful. An example with two namespace is the classic mbox file being the INBOX and the Maildir holding all IMAP folders in in Maildir format in a users home-directory:

namespace {
  separator = /
  prefix = "#mbox/"
  location = mbox:~/mail:INBOX=/var/spool/mail/%u
  inbox = yes
  hidden = yes
  list = no
}
namespace {
  separator = /
  prefix =
  location = maildir:~/Maildir
}  

The prefix is used in the NAMESPACE response from Dovecot and the effect will depend on the IMAP client. See RFC 2342 about the purpose of namespaces.

Essentially I cant figure out what purpose the namespace prefix serves, and if it is used for naming the actual directories in the users Maildir or not.

Dovecot has quite a lot to say about the Namespaces extension to the IMAP protocol as well.

3
  • Again, reading the manual really helps. mail_location = maildir:~/Maildir:INBOX=~/Maildir/.INBOX But make sure that's also where your MTA (postfix, sendmail, qmail, exim, procmail etc.) will deliver the mail.
    – HBruijn
    Oct 10, 2014 at 10:17
  • In your example, is it possible to expose the namespace with the underlying mbox storage to the client? In my installation, only the INBOX namespace seems to be making it to the client, even with list = yes and hidden = no.
    – A__A__0
    Mar 29, 2016 at 23:05
  • Sorry, I should clarify that in my installation the 'mbox' namespace is not the INBOX, so essentially my question is whether a non-INBOX namespace can be exposed to clients (Which for me means come up as a folder in thunderbird..)
    – A__A__0
    Mar 29, 2016 at 23:24
1
  1. Because that's how it works, POP3 in Maildir format takes your inbox messages from cur/new in the root of the Maildir. If it were delivered to .INBOX/cur, there would be no messages for POP3

  2. Namespaces are defined in RFC2342. In Dovecot namespaces are used to change the hierarchy separator, provide backwards compatibility with other mailservers, provides support for public and shared mailboxes, and allows you to have mail in different places. Dovecot provides information about its usage on their wiki: http://wiki2.dovecot.org/Namespaces

To specifically answer your question about what effect that will have on the client, it depends on the client. When speaking about an IMAP connection specifically, in response to the NAMESPACE command you would then have a "FOO" namespace returned. The client could then issue a LIST "FOO%" command to get a list of mailboxes in that namespace. How that plays out on the filesystem for the mailstore is then determined by your mailstore format (for example, Mbox or Maildir)

2
  • Ah so for compatibility with POP, the INBOX mailbox (in IMAP) is stored in cur? And regarding your answer on (2), how would that play out for Maildir?
    – Paralife
    Oct 9, 2014 at 15:11
  • For Maildir you would still see folders on disk as User/Maildir/.FolderName but in what's returned from LIST it would appear as FOO.FolderName if your prefix was FOO. and Separator was .
    – brent
    Oct 9, 2014 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .