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.Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
.
Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
() in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with
respect to this document. Code Components extracted from this
document must include Simplified BSD License text as described in
Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Simplified BSD License.
Table of Contents
. Introduction
. Conventions Used in This Document
. Sieve Capability String
. Argument :mailboxid to Command fileinto
. Interaction with Mailbox Extension
. Interaction with Special-Use Extension
. Interaction with FCC Extension
. Test mailboxidexists
. Interaction with Variables Extension
. Security Considerations
. IANA Considerations
. References
. Normative References
. Informative References
Acknowledgements
Author's Address
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:
require "mailboxid";
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:
require "fileinto";
require "mailboxid";
if header :contains ["from"] "coyote" {
fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.harassment";
}
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:
require "fileinto";
require "mailboxid";
require "mailbox";
fileinto :mailboxid "Fnosuch"
:create
"INBOX.no-such-folder";
# creates INBOX.no-such-folder, but it doesn't
# get the "Fnosuch" mailboxid.
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 :
MAILBOXID-OPT = ":mailboxid" objectid
FCC-OPTS =/ MAILBOXID-OPT
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:
require ["enotify", "fcc", "mailboxid"];
notify :fcc "INBOX.Sent"
:mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3"
:message "You got mail!"
"mailto:ken@example.com";
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:
require "fileinto";
require "mailboxid";
if header :contains ["from"] "coyote" {
if mailboxidexists "F6352ae03-b7f5-463c-896f-d8b48ee3" {
fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.name.will.not.be.used";
} else {
fileinto "INBOX.harassment";
}
}
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 ReferencesKey words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.IMAP4 NamespaceThis document defines a NAMESPACE command that allows a client to discover the prefixes of namespaces used by a server for personal mailboxes, other users' mailboxes, and shared mailboxes. [STANDARDS-TRACK]Sieve: An Email Filtering LanguageThis document describes a language for filtering email messages at time of final delivery. It is designed to be implementable on either a mail client or mail server. It is meant to be extensible, simple, and independent of access protocol, mail architecture, and operating system. It is suitable for running on a mail server where users may not be allowed to execute arbitrary programs, such as on black box Internet Message Access Protocol (IMAP) servers, as the base language has no variables, loops, or ability to shell out to external programs. [STANDARDS-TRACK]Augmented BNF for Syntax Specifications: ABNFInternet technical specifications often need to define a formal syntax. Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications. The current specification documents ABNF. It balances compactness and simplicity with reasonable representational power. The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges. This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications. [STANDARDS-TRACK]Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.IMAP Extension for Object IdentifiersThis document updates RFC 3501 (IMAP4rev1) with persistent identifiers on mailboxes and messages to allow clients to more efficiently reuse cached data when resources have changed location on the server.Sieve Extension: File Carbon Copy (FCC)The Sieve email filtering language provides a number of action commands, some of which can generate additional messages on behalf of the user. This document defines an extension to such commands to allow a copy of any generated message to be filed into a target mailbox.This document updates RFCs 5230 and 5435 by adding a new tagged argument to the Vacation and Notify actions, respectively.Informative ReferencesINTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server. IMAP4rev1 permits manipulation of mailboxes (remote message folders) in a way that is functionally equivalent to local folders. IMAP4rev1 also provides the capability for an offline client to resynchronize with the server. IMAP4rev1 includes operations for creating, deleting, and renaming mailboxes, checking for new messages, permanently removing messages, setting and clearing flags, RFC 2822 and RFC 2045 parsing, searching, and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4rev1 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers. IMAP4rev1 supports a single server. A mechanism for accessing configuration information to support multiple IMAP4rev1 servers is discussed in RFC 2244. IMAP4rev1 does not specify a means of posting mail; this function is handled by a mail transfer protocol such as RFC 2821. [STANDARDS-TRACK]IMAP4 Access Control List (ACL) ExtensionThe Access Control List (ACL) extension (RFC 2086) of the Internet Message Access Protocol (IMAP) permits mailbox access control lists to be retrieved and manipulated through the IMAP protocol.This document is a revision of RFC 2086. It defines several new access control rights and clarifies which rights are required for different IMAP commands. [STANDARDS-TRACK]Sieve Email Filtering: Variables ExtensionIn advanced mail filtering rule sets, it is useful to keep state or configuration details across rules. This document updates the Sieve filtering language (RFC 5228) with an extension to support variables. The extension changes the interpretation of strings, adds an action to store data in variables, and supplies a new test so that the value of a string can be examined. [STANDARDS-TRACK]The Sieve Mail-Filtering Language -- Extensions for Checking Mailbox Status and Accessing Mailbox MetadataThis memo defines an extension to the Sieve mail filtering language (RFC 5228) for accessing mailbox and server annotations, checking for mailbox existence, and controlling mailbox creation on "fileinto" action. [STANDARDS-TRACK]Sieve Email Filtering: Delivering to Special-Use MailboxesThe SPECIAL-USE capability of the IMAP protocol (RFC 6154) allows clients to identify special-use mailboxes, e.g., where draft or sent messages should be put. This simplifies client configuration. In contrast, the Sieve mail filtering language (RFC 5228) currently has no such capability. This memo defines a Sieve extension that fills this gap: it adds a test for checking whether a special-use attribute is assigned for a particular mailbox or any mailbox, and it adds the ability to file messages into a mailbox identified solely by a special-use attribute.AcknowledgementsThis 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.Author's AddressFastmailLevel 2114 William StMelbourneVIC3000Australiabrong@fastmailteam.comhttps://www.fastmail.com