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.
Shared mailboxes in clients
Section titled “Shared mailboxes in clients”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 folder names
Section titled “IMAP folder names”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]/ProjectsShared Folders/[email protected]/InboxThe 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.
Rights
Section titled “Rights”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 right | Meaning | JMAP myRights |
|---|---|---|
l | See the mailbox in the folder list. | (mayReadItems requires both l and r) |
r | Read messages. | mayReadItems |
s, w | Change the seen flag and other flags. Stalwart grants and revokes both letters together. | maySetSeen, maySetKeywords |
i | Add messages, by copying, moving or appending. | mayAddItems |
t, e | Mark messages as deleted and expunge them. Stalwart grants and revokes both letters together. | mayRemoveItems |
k | Create child mailboxes. | mayCreateChild |
x | Delete or rename the mailbox. Stalwart grants and revokes both rights together. | mayDelete, mayRename |
n | Set shared metadata (annotations) on the mailbox. | maySetMetadata |
p | Submit messages to the mailbox. | maySubmit |
a | Change 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.
Enforcement over IMAP
Section titled “Enforcement over IMAP”Over IMAP, the rights of a sharee determine what a client may do in that mailbox:
SELECTopens the mailbox with[READ-WRITE]only if the sharee may add messages, remove messages or change flags. Otherwise, and always forEXAMINE, the mailbox is opened with[READ-ONLY]. A sharee without the read right receivesNO [NOPERM] You do not have the required permissions to read this mailbox.- The
PERMANENTFLAGSresponse lists the flags the sharee may change: all flags, all flags except\Deleted, only\Deleted, or none. - Storing
\Deletedrequires the delete right, and storing any other flag, including\Seenset implicitly by fetchingBODY[], requires the write right. ASTOREcommand 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,MOVEandUID MOVEremove messages from a shared mailbox only with the expunge right.CLOSEafterEXAMINEnever expunges.- Deleting a shared folder that still contains messages requires the right to delete messages in addition to the right to delete the folder.
Enforcement over JMAP
Section titled “Enforcement over JMAP”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.