Skip to content

Shared mailboxes

A user can share a mailbox with other accounts, for example a team inbox, and grant each of them a set of rights, as described in Sharing. The account that receives the share is the sharee. Both IMAP and JMAP clients reach shared mailboxes, but they present them differently, and they express the rights in different vocabularies that refer to the same rights stored on the mailbox. POP3 clients never see shared mailboxes.

Group accounts are a special case. The members of a group see every mailbox of the group, with every right, as they see their own; the rights described on this page govern accounts that hold an explicit share.

JMAP presents each account that shares something with the user as an account of its own in the session resource, next to the user’s own account. A JMAP client therefore shows shared mailboxes grouped by the account they belong to, and addresses them by that account’s identifier. Some capabilities are not offered on shared accounts, such as sending mail as the owner or editing the owner’s vacation response, as described in JMAP capabilities.

IMAP has a single folder tree per session, so shared mailboxes are placed under a virtual folder, named by the shared entry of the default folders and Shared Folders unless renamed. Below it comes one folder per owner, named by the owner’s address, and below that the owner’s mailboxes with their own paths:

Shared Folders/[email protected]/Projects
Shared Folders/[email protected]/Inbox

The virtual folder and the owner folders cannot be selected. A sharee sees only the mailboxes on which it holds the read right. The NAMESPACE command reports the shared prefix only while at least one account shares something with the user.

IMAP clients set and read the rights with the ACL extension (RFC 4314), whose rights are single letters. JMAP clients read them in the myRights property of a mailbox. The following table maps one to the other:

IMAP rightMeaningJMAP myRights
lSee the mailbox in the folder list.(mayReadItems requires both l and r)
rRead messages.mayReadItems
s, wChange the seen flag and other flags. Stalwart grants and revokes both letters together.maySetSeen, maySetKeywords
iAdd messages, by copying, moving or appending.mayAddItems
t, eMark messages as deleted and expunge them. Stalwart grants and revokes both letters together.mayRemoveItems
kCreate child mailboxes.mayCreateChild
xDelete or rename the mailbox. Stalwart grants and revokes both rights together.mayDelete, mayRename
nSet shared metadata (annotations) on the mailbox.maySetMetadata
pSubmit messages to the mailbox.maySubmit
aChange the rights of other users.mayShare

An account always has every right on its own mailboxes. The rights matter for a sharee, and both protocols enforce them on every command, as the following sections describe.

Over IMAP, the rights of a sharee determine what a client may do in that mailbox:

  • SELECT opens the mailbox with [READ-WRITE] only if the sharee may add messages, remove messages or change flags. Otherwise, and always for EXAMINE, the mailbox is opened with [READ-ONLY]. A sharee without the read right receives NO [NOPERM] You do not have the required permissions to read this mailbox.
  • The PERMANENTFLAGS response lists the flags the sharee may change: all flags, all flags except \Deleted, only \Deleted, or none.
  • Storing \Deleted requires the delete right, and storing any other flag, including \Seen set implicitly by fetching BODY[], requires the write right. A STORE command fails only when none of the named flags may be changed. Otherwise the flags that may not be changed are dropped silently and the response reports the flags the message has after the command.
  • A message that the owner has filed in several folders can be modified only if the sharee holds the required right on each of them.
  • CLOSE, EXPUNGE, UID EXPUNGE, MOVE and UID MOVE remove messages from a shared mailbox only with the expunge right. CLOSE after EXAMINE never expunges.
  • Deleting a shared folder that still contains messages requires the right to delete messages in addition to the right to delete the folder.

Over JMAP, Email/set applies the same rules to keywords, the JMAP equivalent of IMAP flags. Changing any keyword requires maySetKeywords on every mailbox the message is in. Otherwise, the change fails with a forbidden error, You are not allowed to modify keywords.. Adding or removing $deleted requires mayRemoveItems on those mailboxes in addition, and fails with You are not allowed to change the $deleted keyword. otherwise.