Sieve Email Filtering: Delivery by
MAILBOXIDFastmailLevel 2114 William StMelbourneVIC3000Australiabrong@fastmailteam.comhttps://www.fastmail.com
Applications
EXTRAsieveemailThe 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.IntroductionSieve rules are sometimes created using graphical interfaces,
which allow users to select the mailbox to be used as a target for a rule.If that mailbox is renamed, the client may also update its internal
representation of the rule and update the Sieve script to match;
however, this is a multistep process and subject to partial failures.
Also, if the folder is renamed by a different mechanism (e.g., another
IMAP client), the rules will get out of sync.By telling fileinto to reference the immutable MAILBOXID specified
by , using the extension specified herein, Sieve rules can
continue to target the same mailbox, even if it gets renamed.Conventions Used in This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document are to be interpreted as
described in BCP 14
when, and only when, they appear in all capitals, as shown here.
Sieve Capability StringScripts that use the extensions defined in this document MUST explicitly require
the capability "mailboxid".Example:Argument :mailboxid to Command fileintoNormally, the fileinto command delivers the message in the mailbox
specified using its positional mailbox argument. However, if the
optional :mailboxid argument is also specified, the fileinto
command first checks whether a mailbox exists in the user's personal
namespace with the specified MAILBOXID .If a matching mailbox is found, that mailbox is used for delivery.If there is no such mailbox, the fileinto action proceeds as it would
without the :mailboxid argument.The tagged argument :mailboxid to fileinto consumes one additional token,
a string containing the OBJECTID of the target mailbox.Example:Interaction with Mailbox ExtensionFor servers that also support the mailbox extension defined in , if both the
:create and :mailboxid arguments are provided to a fileinto command and
no matching mailbox is found, then a new mailbox will be created.This new mailbox will have the name specified by the positional mailbox
argument (); however, it will get a different MAILBOXID
(chosen by the server) rather than the one specified by the :mailboxid
argument to fileinto.Example:Interaction with Special-Use ExtensionFor servers that also support delivery to special-use mailboxes ,
it is an error to specify both :mailboxid and :specialuse in the same
fileinto command.Advanced filtering based on both special-use and MAILBOXID can be
built with explicit specialuse_exists and mailboxidexists tests.Interaction with FCC ExtensionThis document extends the definition of the :fcc argument defined in
so that it can optionally be used with the :mailboxid
argument. The syntax for FCC is extended here using ABNF :If the optional :mailboxid argument is specified with :fcc, it
instructs the Sieve interpreter to check whether a mailbox exists
with the specific MAILBOXID. If such a mailbox exists, the generated
message is filed into that mailbox. Otherwise, the generated message
is filed into the :fcc target mailbox.As with fileinto, it is an error to specify both :mailboxid
and :specialuse for the same fcc rule.Example:Test mailboxidexistsUsage: mailboxidexists <mailbox-objectids: string-list>The mailboxidexists test is true if every string argument provided is the MAILBOXID of a mailbox that exists in the mailstore and that allows the user in whose context the Sieve script runs to deliver messages into it.When the mailstore is an IMAP server that also supports IMAP
Access Control List (ACL) , delivery is allowed if the user has the 'p' or 'i' rights for the mailbox (see
). When the mailstore is an IMAP server that does not support IMAP ACL, delivery is allowed if the READ-WRITE response code is present for the mailbox when selected by the user (see ).Note that a successful mailboxidexists test for a mailbox doesn't
necessarily mean that a "fileinto :mailboxid" action on this mailbox
would succeed. For example, the fileinto action might put the user over
quota. The mailboxidexists test only verifies existence of the
mailbox and whether the user in whose context the Sieve script runs
has permissions to execute fileinto on it.Example:Interaction with Variables ExtensionThere is no special interaction defined; however, as an OBJECTID
is a string in this document, OBJECTID values can contain
variable expansions if is enabled.Security ConsiderationsBecause MAILBOXID is always generated by the server, implementations
MUST NOT allow Sieve to make an end run around this protection by
creating mailboxes with the specified ID by using :create and
:mailboxid in a fileinto rule for a nonexistent mailbox.Implementers are referred to the Security Considerations sections
of and .IANA ConsiderationsIANA has added the following capability to the "Sieve Extensions" registry
at :
Capability name:
mailboxid
Description:
adds a test for checking mailbox existence by OBJECTID
and new optional arguments to fileinto and :fcc that
allow selecting the destination mailbox by OBJECTID.
RFC number:
RFC 9042
Contact address:
EXTRA discussion list <extra@ietf.org>
ReferencesNormative ReferencesInformative ReferencesAcknowledgementsThis document borrows heavily from for the matching
mailboxexists test and from for an example of modifying
the fileinto command.Thanks to , , and for feedback
on the EXTRA mailing list.