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

Mail Namespace

src/lib-storage/mail-namespace.h describes mail namespaces. See Namespaces for more information about what they are actually about.

Hierarchy separators and namespace prefixes

A namespace and mailbox list has 1:1 relationship. A namespace is mainly about dealing with hierarchy separators and namespace prefixes, which mailbox list doesn't know or care much about.

Mailbox lists have their native hierarchy separators. For example with FS layout the separator is '/', because child mailboxes are physically in subdirectories and '/' is the separator for directories. With Maildir++ layout the separator is (currently) hardcoded to '.' in the maildir directory name, so that's its native hierarchy separator.

Dovecot allows separators to be configurable, so namespaces have two separators:

Namespaces also have prefixes. The prefixes are visible for users/clients and they appear to be part of the actual mailbox name. One commonly used namespace prefix is "INBOX.", so all mailboxes (other than INBOX itself) appear to be children of the INBOX.

So the same mailbox can be visible in three different forms:

Users and owners

When accessing other users' shared mailboxes, there's a difference between a namespace's user and owner:

The distinction can be important sometimes. For example if user adds or removes messages from the shared mailbox, the owner's quota must be updated instead of the user's.


Functions about finding namespaces:

Functions about translating between virtual and storage names when the namespace is known:

A single namespace can currently point to only a single storage, but there is already some code that attempts to make the transition to multiple storages per namespace easier. In general you shouldn't try to access ns->storage directly. When creating new mailboxes, mail_namespace_get_default_storage() returns the storage that should be used. For other purposes you should find the storage via mailbox list functions.

None: Design/Storage/MailNamespace (last edited 2009-12-15 23:33:00 by TimoSirainen)