Creating mailboxes

There are three kinds of mailboxes:

  1. Mailboxes that can have only messages.
  2. Mailboxes that can have only child mailboxes. This could also be called a directory.
  3. Mailboxes that can have both messages and child mailboxes. These are also called dual-use mailboxes.

If server doesn't support dual-use mailboxes, the user has to choose between creating a mailbox that can have messages and a directory. Many clients implement this badly, so users often complain that "the server doesn't support subfolders!" while in fact they are supported.

CREATE mailbox creates a mailbox that can have messages. CREATE mailbox/ creates a mailbox that can have child mailboxes. If the server supports dual-use mailboxes the latter might not actually do anything. It's not really even necessary, CREATE mailbox/foo could be used directly without creating the parent mailbox at all.

So unless you know that the server supports dual-use mailboxes your user interface should have some kind of a "create a directory" checkbox or some help text that lets user know that it's possible to create two types of mailboxes.

Dual-use state isn't actually server-specific. Some namespaces may have dual-use mailboxes while others may not. If you keep track of the dual-use status do it separately for each namespace. If server has at least one selectable (doesn't have \NoSelect flag) mailbox created (other than INBOX), you can figure out from its LIST reply if the namespace supports dual-use mailboxes. If the flags contain \NoInferiors it doesn't, otherwise it does.

If a mailbox has \NoInferiors flag, your client should give a helpful error message if user tries to create or rename a mailbox under it.

Renaming mailboxes

When you rename a mailbox yourself, you can also rename the mailbox in your local cache. If another client does the rename, this isn't really possible because you'll simply see the old mailbox gone and a new mailbox appear. It's not safe to assume that the local cache is valid even if you can figure out that this could be a rename.

Deleting mailboxes

Some clients perform mailbox deletions by moving the mailbox under Trash. This doesn't work if the server doesn't support dual-use mailboxes. If you insist on doing this, at least handle the RENAME failure in some way, either just DELETEing the mailbox or doing the move by updating only internal state.

ClientImplementation/MailboxCreate (last edited 2009-03-15 22:47:46 by localhost)