rfc-9042

Sieve Email Filtering: Delivery by MAILBOXID

B. Gondwana (Editor)
date2021-06 streamIETF areaart wgextra statusPROPOSED STANDARD pages8 canonicalhttps://www.rfc-editor.org/rfc/rfc9042 doi10.17487/RFC9042
The OBJECTID capability of IMAP (RFC 8474) allows clients to identify mailboxes by a unique identifier that survives renaming. This document extends the Sieve email filtering language (RFC 5228) to allow using that same unique identifier as a target for fileinto rules and for testing the existence of mailboxes.

updates

Extracted elements (17)

design-rationale §1

Sieve rules created via graphical interfaces reference mailboxes by name; if a mailbox is renamed by another IMAP client, those rules go out of sync. By referencing the immutable MAILBOXID (RFC 8474) instead of the mailbox name, Sieve rules continue to target the correct mailbox even after renaming.

email

design-rationale §4.2

The note to developers of Sieve generation tools advises using :specialuse rather than :mailboxid when creating rules based on a special-use purpose (e.g., delivering to the Junk folder), because special-use flags better capture intent and are more portable across server configurations.

email

interoperability-note §6

A successful mailboxidexists test does not guarantee a subsequent fileinto :mailboxid will succeed; for example, the user may be over quota. The test only verifies existence and delivery permission, not that the delivery will complete.

email

interoperability-note §4.1

For servers supporting the mailbox extension (RFC 5490), if both :create and :mailboxid are provided and no matching mailbox is found, a new mailbox is created with the name from the positional argument but receives a server-chosen MAILBOXID rather than the one specified in :mailboxid.

email

interoperability-note §6

The mailboxidexists test behaves identically to the mailboxexists test defined in RFC 5490 but operates on MAILBOXIDs rather than mailbox names.

email

interoperability-note §7

There is no special interaction between this extension and the Variables Extension (RFC 5229); however, since OBJECTID is a string in this document, OBJECTID values can contain variable expansions if RFC 5229 is enabled.

email

normative-requirement §5 MUST NOT

As with fileinto, it is an error to specify both :mailboxid and :specialuse for the same fcc rule.

email

normative-requirement §4 MUST

If the optional :mailboxid argument is specified and a matching mailbox is found by MAILBOXID in the user's personal namespace, that mailbox is used for delivery. If no such mailbox is found, fileinto proceeds as it would without the :mailboxid argument.

email

normative-requirement §4.2 MUST NOT

It is an error to specify both :mailboxid and :specialuse in the same fileinto command. Advanced filtering combining both criteria must use explicit mailboxidexists and specialuse_exists tests.

email

normative-requirement §3 MUST

Scripts that use the extensions defined in this document MUST explicitly require the capability "mailboxid".

email

normative-requirement §6 MUST

When the mailstore is an IMAP server supporting ACL (RFC 4314), delivery is considered allowed for mailboxidexists if the user has the 'p' or 'i' rights for the mailbox.

email

normative-requirement §6 MUST

When the mailstore is an IMAP server that does not support IMAP ACL, delivery is allowed for mailboxidexists if the READ-WRITE response code is present for the mailbox when selected by the user (RFC 3501 Section 7.1).

email

protocol-element §5

The :fcc argument (RFC 8580) is extended to accept an optional :mailboxid argument. ABNF: MAILBOXID-OPT = ":mailboxid" objectid; FCC-OPTS =/ MAILBOXID-OPT. When specified, the Sieve interpreter checks for a mailbox with the given MAILBOXID and files there if found; otherwise falls back to the :fcc target mailbox.

email

protocol-element §4

The :mailboxid tagged argument to fileinto consumes one additional token — a string containing the OBJECTID of the target mailbox. When specified, fileinto first checks whether a mailbox exists in the user's personal namespace with that MAILBOXID and, if found, delivers there; otherwise proceeds as without :mailboxid.

email

protocol-element §6

The mailboxidexists test takes a string-list of mailbox OBJECTIDs and returns true if every provided MAILBOXID corresponds to a mailbox that exists in the mailstore and allows the script-running user to deliver messages into it.

email

registry §9

IANA has added the "mailboxid" capability to the "Sieve Extensions" registry. It adds a test for checking mailbox existence by OBJECTID and new optional :mailboxid arguments to fileinto and :fcc for selecting the destination mailbox by OBJECTID.

email, registry

security-consideration §8 MUST NOT

Because MAILBOXID is always generated by the server, implementations MUST NOT allow Sieve to circumvent this protection by creating mailboxes with a specified MAILBOXID via :create and :mailboxid for a nonexistent mailbox. Implementations are also referred to the Security Considerations of RFC 5228 and RFC 8474.

email, security