Internet-Draft | Sieve MAILBOXID | September 2020 |
Gondwana | Expires March 7, 2021 | [Page] |
The OBJECTID capability of the IMAP protocol (RFC8474) allows clients to identify mailboxes by a unique identifier which survives rename.¶
This document extends the Sieve mail filtering language (RFC5228) to allow using that same unique identifier as a target for fileinto rules, and for testing the existance of mailboxes.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on March 7, 2021.¶
Copyright (c) 2020 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 (https://trustee.ietf.org/license-info) 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.¶
[RFC5228] Sieve 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 multi-step 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 extending fileinto
to reference the immutable mailboxid specified by
[RFC8474] , sieve rules can continue to target the same mailbox, even
if it gets renamed.¶
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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The server advertises the capability "mailboxid", and scripts which use the following extensions MUST explicitly request the capability "mailboxid".¶
Example:¶
require "mailboxid";¶
Normally, 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 [RFC2342] with the specified [RFC8474] 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 with the objectid of the mailbox to file into.¶
Example:¶
require "fileinto"; require "mailboxid"; if header :contains ["from"] "coyote" { fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3" "INBOX.harassment"; }¶
For servers which also support the [RFC5490] mailbox extension, the ":create" modifier to fileinto does not create the mailbox with the specified mailboxid, however it may be specified and interacts as normal with all other extensions.¶
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.¶
For servers which also support [RFC8579] delivery to special-use mailboxes, if a fileinto command has both ":mailboxid" and ":special-use" specified, then the mailboxid is resolved first.¶
If a mailbox with the specified mailboxid does not exist, then the process specified in [RFC8579] is followed - which includes processing of [RFC5490] ":create" tags to add the special-use to the created mailbox.¶
Example:¶
require "fileinto"; require "mailboxid"; require "special-use"; if header :contains ["from"] "coyote" { fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3" :specialuse "\\Junk" "INBOX.harassment"; }¶
Example:¶
require "fileinto"; require "mailboxid"; require "mailbox"; require "special-use"; fileinto :mailboxid "F1234567" :specialuse "\\Archive" :create "INBOX.Archive"; # creates INBOX.Archive with use \Archive but # with a different mailboxid.¶
This document extends the definition of the ":fcc" argument defined in [RFC8580] so that it can optionally be used with the ":mailboxid" argument.¶
FCC =/ [":mailboxid" <mailboxid: string>]¶
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.¶
Example:¶
require ["enotify", "fcc", "mailboxid"]; notify :fcc "INBOX.Sent" :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3" :message "You got mail!" "mailto:ken@example.com";¶
The "mailboxidexists" test is true if all mailboxes listed in the "mailboxids" argument exist in the mailstore, and each allows the user in whose context the Sieve script runs to "deliver" messages into it. When the mailstore is an IMAP server, "delivery" of messages is possible if:¶
a) the READ-WRITE response code is present for the mailbox (see Section 7.1 of [RFC3501]), if IMAP Access Control List (ACL) [RFC4314] is not supported by the server, or¶
b) the user has 'p' or 'i' rights for the mailbox (see Section 5.2 of [RFC4314]).¶
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 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.harassment"; } else { fileinto "INBOX.harassment"; } }¶
Note to implementers: this test behaves identically to the
mailboxexists
test defined in [RFC5490] but operates on
mailboxids rather than mailbox names.¶
There is no special interaction defined, however as an objectid is a string in this document, objectid values can contain variable expansions if [RFC5229] is enabled.¶
test /= "mailboxidexists" string-list tag /= ":mailboxid" string¶
FCC =/ [":mailboxid" <mailboxid: string>]¶
Because mailboxid is always generated by the server, implementations MUST NOT allow sieve to make an endrun around this protection by creating mailboxes with the specified ID by using ":create" and ":mailboxid" in a fileinto rule for a non-existant mailbox.¶
Implementers are referred to the security considerations sections of [RFC5228] and [RFC8474].¶
IANA are requested to add a capability to the sieve-extensions registry:¶
To: iana@iana.org Subject: Registration of new Sieve extension Capability name: mailboxid Description: adds a test for checking mailbox existence by objectid, and new optional arguments to fileinto and :fcc which allow selecting the destination mailbox by objectid. RFC number: this RFC Contact address: The EXTRA discussion list <extra@ietf.org>¶
This document borrows heavily from [RFC5490] for the matching mailboxexists test, and from [RFC8579] for an example of modifying the fileinto command.¶
Thanks to Ned Freed and Ken Murchison and Alexey Melnikov for feedback on the EXTRA mailing list.¶
(EDITOR: remove this section before publication)¶