<?xml version="1.0" encoding="utf-8"?> encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-ietf-extra-sieve-mailboxid-09" number="9042" submissionType="IETF" category="std" consensus="true" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" updates="5228" consensus="true"> sortRefs="true" symRefs="true" tocInclude="true">
<front>
<title abbrev="Sieve MAILBOXID">Sieve Email Filtering: delivery Delivery by mailboxid</title><seriesInfo value="draft-ietf-extra-sieve-mailboxid-09" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
MAILBOXID</title>
<seriesInfo name="RFC" value="9042"/>
<author role="editor" initials="B." surname="Gondwana" fullname="Bron Gondwana"><organization>Fastmail</organization><address><postal><street>Level 2, 114 Gondwana">
<organization>Fastmail</organization>
<address>
<postal>
<extaddr>Level 2</extaddr>
<street>114 William St</street>
<city>Melbourne</city>
<code>VIC 3000</code>
<region>VIC</region>
<code>3000</code>
<country>Australia</country>
</postal><email>brong@fastmailteam.com</email>
</postal>
<email>brong@fastmailteam.com</email>
<uri>https://www.fastmail.com</uri>
</address></author>
<date year="2021" month="March" day="16"></date> month="June"></date>
<area>Applications</area>
<workgroup>EXTRA</workgroup>
<keyword>sieve</keyword>
<keyword>email</keyword>
<abstract>
<t>The OBJECTID capability of the IMAP protocol (RFC8474) (RFC 8474) allows clients to
identify mailboxes by a unique identifier which that survives rename.</t> renaming.</t>
<t>This document extends the Sieve mail email filtering language (RFC5228) (RFC 5228) to
allow using that same unique identifier as a target for fileinto rules, rules
and for testing the existance existence of mailboxes.</t>
</abstract>
</front>
<middle>
<section anchor="introduction"><name>Introduction</name>
<t><xref target="RFC5228"></xref> Sieve
<t>Sieve rules <xref target="RFC5228"></xref> are sometimes created using graphical interfaces interfaces,
which allow users to select the mailbox to be used as a target for a rule.</t>
<t>If that mailbox is renamed, the client may also update its internal
representation of the rule and update the sieve Sieve script to match,
however match;
however, this is a multi-step multistep process and subject to partial failures.
Also, if the folder is renamed by a different mechanism (e.g. (e.g., another
IMAP client) client), the rules will get out of sync.</t>
<t>By telling "fileinto" fileinto to reference the immutable mailboxid MAILBOXID specified
by <xref target="RFC8474"></xref>, using the extension specified herein, sieve Sieve rules can
continue to target the same mailbox mailbox, even if it gets renamed.</t>
</section>
<section anchor="conventions-used-in-this-document"><name>Conventions Used In in This Document</name>
<t>The
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "OPTIONAL" "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 BCP 14 <xref target="RFC2119"></xref> target="RFC2119"/> <xref target="RFC8174"></xref> target="RFC8174"/>
when, and only when, they appear in all capitals, as shown here.</t> here.
</t>
</section>
<section anchor="sieve-capability-string"><name>Sieve capability string</name> Capability String</name>
<t>Scripts which that use the following extensions MUST defined in this document <bcp14>MUST</bcp14> explicitly require
the capability "mailboxid".</t> "mailboxid".</t>
<t>Example:</t>
<artwork>require "mailboxid";
</artwork>
<sourcecode type=""><![CDATA[
require "mailboxid";
]]></sourcecode>
</section>
<section anchor="argument-mailboxid-to-command-fileinto"><name>Argument ":mailboxid" anchor="argument-mailboxid-to-command-fileinto">
<name>Argument :mailboxid to Command "fileinto"</name> fileinto</name>
<t>Normally, the "fileinto" fileinto command delivers the message in the mailbox
specified using its positional mailbox argument. However, if the
optional ":mailboxid" :mailboxid argument is also specified, the "fileinto" fileinto
command first checks whether a mailbox exists in the user's personal
namespace <xref target="RFC2342"></xref> with the specified MAILBOXID <xref target="RFC8474"></xref> MAILBOXID.</t> target="RFC8474"></xref>.</t>
<t>If a matching mailbox is found, that mailbox is used for delivery.</t>
<t>If there is no such mailbox, the "fileinto" fileinto action proceeds as it would
without the ":mailboxid" :mailboxid argument.</t>
<t>The tagged argument <tt>:mailboxid</tt> :mailboxid to fileinto consumes one additional token,
a string with containing the objectid OBJECTID of the mailbox to file into.</t> target mailbox.</t>
<t>Example:</t>
<artwork>require "fileinto";
<sourcecode type=""><![CDATA[
require "mailboxid"; "fileinto";
require "mailboxid";
if header :contains ["from"] "coyote" ["from"] "coyote" {
fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.harassment"; "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.harassment";
}
</artwork>
]]></sourcecode>
<section anchor="interaction-with-mailbox-extension"><name>Interaction with "mailbox" extension</name> Mailbox Extension</name>
<t>For servers which that also support the <xref target="RFC5490"></xref> mailbox extension, extension defined in <xref target="RFC5490"></xref>, if both the
":create"
:create and ":mailboxid" :mailboxid arguments are provided to a "fileinto" fileinto command and
no matching mailbox is found, then a new mailbox will be created.</t>
<t>This new mailbox will have the name specified by the positional mailbox
argument ([RFC5228] section 4.1), however (<xref target="RFC5228" sectionFormat="comma" section="4.1"/>); however, it will get a different mailboxid MAILBOXID
(chosen by the server) rather than the one specified by the ":mailboxid" :mailboxid
argument to fileinto.</t>
<t>Example:</t>
<artwork>require "fileinto";
<sourcecode type=""><![CDATA[
require "mailboxid"; "fileinto";
require "mailbox"; "mailboxid";
require "mailbox";
fileinto :mailboxid "Fnosuch" "Fnosuch"
:create
"INBOX.no-such-folder";
"INBOX.no-such-folder";
# creates INBOX.no-such-folder, but it doesn't
# get the "Fnosuch" "Fnosuch" mailboxid.
</artwork>
]]></sourcecode>
</section>
<section anchor="interaction-with-specialuse-extension"><name>Interaction with "specialuse" extension</name> Special-Use Extension</name>
<t>For servers which that also support <xref target="RFC8579"></xref> delivery to special-use mailboxes, mailboxes <xref target="RFC8579"></xref>,
it is an error to specify both ":mailboxid" :mailboxid and ":specialuse" :specialuse in the same
fileinto command.</t>
<t>Advanced filtering based on both special-use and mailboxid MAILBOXID can be
built with explicit "specialuse_exists" specialuse_exists and "mailboxidexists" mailboxidexists tests.</t>
<aside>
<t>Note to developers of sieve Sieve generation tools: it tools:</t>
<t>It is advisable to use
special-use rather than mailboxid MAILBOXID when creating rules that are based
on a special-use purpose (e.g. (e.g., delivery directly to the Junk folder
based on a header that was added by a scanning agent earlier in the
mailflow).</t>
mail flow).</t>
</aside>
</section>
</section>
<section anchor="interaction-with-fcc-extension"><name>Interaction with "fcc" extension</name> FCC Extension</name>
<t>This document extends the definition of the ":fcc" :fcc argument defined in
<xref target="RFC8580"></xref> so that it can optionally be used with the ":mailboxid" :mailboxid
argument. The syntax for "FCC" FCC is extended here using ABNF <xref target="RFC5234"></xref>:</t>
<artwork>MAILBOXID-OPT
<sourcecode type="abnf"><![CDATA[
MAILBOXID-OPT = ":mailboxid" ":mailboxid" objectid
FCC-OPTS =/ MAILBOXID-OPT
</artwork>
]]></sourcecode>
<t>If the optional ":mailboxid" :mailboxid argument is specified with ":fcc", :fcc, it
instructs the Sieve interpreter to check whether a mailbox exists
with the specific mailboxid. MAILBOXID. If such a mailbox exists, the generated
message is filed into that mailbox. Otherwise, the generated message
is filed into the ":fcc" :fcc target mailbox.</t>
<t>As with fileinto, it is an error to specify both ":mailboxid" :mailboxid
and ":specialuse" :specialuse for the same fcc rule.</t>
<t>Example:</t>
<artwork>require ["enotify", "fcc", "mailboxid"];
<sourcecode type=""><![CDATA[
require ["enotify", "fcc", "mailboxid"];
notify :fcc "INBOX.Sent" "INBOX.Sent"
:mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3" "F6352ae03-b7f5-463c-896f-d8b48ee3"
:message "You "You got mail!"
"mailto:ken@example.com";
</artwork> mail!"
"mailto:ken@example.com";
]]></sourcecode>
</section>
<section anchor="test-mailboxidexists"><name>Test "mailboxidexists"</name> mailboxidexists</name>
<t>Usage: mailboxidexists <mailbox-objectids: string-list></t>
<t>The "mailboxidexists" mailboxidexists test is true if all mailboxes listed in the
"mailboxids" every string argument exist provided is the MAILBOXID of a mailbox that exists in the mailstore, mailstore and each that allows the user in whose context the Sieve script runs to "deliver" deliver messages into it. When it.</t>
<t>When the mailstore is an IMAP server, "delivery" of
messages is possible if:</t>
<t>a) the READ-WRITE response code is present for the mailbox (see
Section 7.1 of <xref target="RFC3501"></xref>), if server that also supports IMAP
Access Control List (ACL) <xref target="RFC4314"></xref> target="RFC4314"></xref>, delivery is not supported by the server, or</t>
<t>b) allowed if the user has the 'p' or 'i' rights for the mailbox (see Section 5.2
of
<xref target="RFC4314"></xref>).</t> target="RFC4314" sectionFormat="of" section="5.2"/>).</t>
<t> 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 <xref target="RFC3501" sectionFormat="of" section="7.1"/>).</t>
<t>Note that a successful "mailboxidexists" mailboxidexists test for a mailbox doesn't
necessarily mean that a "fileinto :mailboxid" action on this mailbox
would succeed. For example, the "fileinto" fileinto action might put the user over
quota. The "mailboxidexists" mailboxidexists test only verifies existence of the
mailbox and whether the user in whose context the Sieve script runs
has permissions to execute "fileinto" fileinto on it.</t>
<t>Example:</t>
<artwork>require "fileinto";
<sourcecode type=""><![CDATA[
require "fileinto";
require "mailboxid"; "mailboxid";
if header :contains ["from"] "coyote" ["from"] "coyote" {
if mailboxidexists "F6352ae03-b7f5-463c-896f-d8b48ee3" "F6352ae03-b7f5-463c-896f-d8b48ee3" {
fileinto :mailboxid "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.name.will.not.be.used"; "F6352ae03-b7f5-463c-896f-d8b48ee3"
"INBOX.name.will.not.be.used";
} else {
fileinto "INBOX.harassment"; "INBOX.harassment";
}
}
</artwork>
]]></sourcecode>
<aside>
<t>Note to implementers: this implementers:</t>
<t>This test behaves identically to the
<tt>mailboxexists</tt>
mailboxexists test defined in <xref target="RFC5490"></xref> but operates on
mailboxids
MAILBOXIDs rather than mailbox names.</t>
</aside>
</section>
<section anchor="interaction-with-variables-extension"><name>Interaction with variables extension</name> Variables Extension</name>
<t>There is no special interaction defined, however defined; however, as an objectid OBJECTID
is a string in this document, objectid OBJECTID values can contain
variable expansions if <xref target="RFC5229"></xref> is enabled.</t>
</section>
<section anchor="security-considerations"><name>Security considerations</name> Considerations</name>
<t>Because mailboxid MAILBOXID is always generated by the server, implementations
MUST NOT
<bcp14>MUST NOT</bcp14> allow sieve Sieve to make an endrun end run around this protection by
creating mailboxes with the specified ID by using ":create" :create and
":mailboxid"
:mailboxid in a fileinto rule for a non-existant nonexistent mailbox.</t>
<t>Implementers are referred to the security considerations Security Considerations sections
of <xref target="RFC5228"></xref> and <xref target="RFC8474"></xref>.</t>
</section>
<section anchor="iana-considerations"><name>IANA considerations</name> Considerations</name>
<t>IANA are requested to add a has added the following capability to the sieve-extensions registry:</t>
<artwork>To: iana@iana.org
Subject: Registration of new Sieve extension
Capability name: mailboxid
Description: adds "Sieve Extensions" registry
at <eref brackets="angle"
target="https://www.iana.org/assignments/sieve-extensions"/>:</t>
<dl newline="false" spacing="compact">
<dt>Capability name:</dt>
<dd>mailboxid</dd>
<dt>Description:</dt>
<dd>adds a test for checking mailbox existence by objectid, OBJECTID
and new optional arguments to fileinto and :fcc which that
allow selecting the destination mailbox by objectid.
RFC number: this RFC
Contact address: The EXTRA OBJECTID.</dd>
<dt>RFC number:</dt>
<dd>RFC 9042</dd>
<dt>Contact address:</dt>
<dd>EXTRA discussion list <extra@ietf.org>
</artwork> <extra@ietf.org></dd>
</dl>
</section>
</middle>
<back>
<references><name>References</name>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5228.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8474.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2342.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8580.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8579.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5490.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3501.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4314.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5229.xml"/>
</references>
</references>
<section anchor="acknowledgements"><name>Acknowledgements</name> anchor="acknowledgements" numbered="false"><name>Acknowledgements</name>
<t>This document borrows heavily from <xref target="RFC5490"></xref> for the matching
mailboxexists test, test and from <xref target="RFC8579"></xref> for an example of modifying
the fileinto command.</t>
<t>Thanks to Ned Freed and Ken Murchison and Alexey Melnikov <contact fullname="Ned Freed"/>, <contact fullname="Ken Murchison"/>, and <contact fullname="Alexey Melnikov"/> for feedback
on the EXTRA mailing list.</t>
</section>
<section anchor="changes"><name>Changes</name>
<t>(EDITOR: remove this section before publication)</t>
<section anchor="draft-ietf-sieve-mailboxid-09"><name>draft-ietf-sieve-mailboxid-09</name>
<ul>
<li>update FCC-OPTS to have an intermediate production for the :mailboxid
option, and reference <tt>objectid</tt> from RFC8474 as the valid format for
the option value.</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-08"><name>draft-ietf-sieve-mailboxid-08</name>
<ul>
<li>IETF110 discussion - re-add FCC-OPTS syntax, and clarify that :mailboxid
is incompatible with :specialuse to parallel the fileinto behaviour</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-07"><name>draft-ietf-sieve-mailboxid-07</name>
<ul>
<li>Martin Duke review - remove formal section</li>
<li>Martin Duke review - wording for section 4.1 (interaction with :create)</li>
<li>Ken Murchison review - fixed :special-use to :specialuse per RFC8579</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-06"><name>draft-ietf-sieve-mailboxid-06</name>
<ul>
<li>GENART review - fixed example to not be semantically pointless</li>
<li>GENART review - fixed !@ to @! in RFC reference mmark syntax</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-05"><name>draft-ietf-sieve-mailboxid-05</name>
<ul>
<li>disallow :mailboxid and :special-use in the same fileinto action.</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-04"><name>draft-ietf-sieve-mailboxid-04</name>
<ul>
<li>made RFC5490 and RFC8579 normative</li>
<li>clarified wording based on AD feedback from Barry</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-03"><name>draft-ietf-sieve-mailboxid-03</name>
<ul>
<li>Fixed ABNF syntax error</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-02"><name>draft-ietf-sieve-mailboxid-02</name>
<ul>
<li>removed bogus : from "mailboxidexists" test title</li>
<li>moved FCC to its own top-level section since it is not used
with the fileinto command.</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-01"><name>draft-ietf-sieve-mailboxid-01</name>
<ul>
<li>fixed idnits - RFC5228 not mentioned in the abstract</li>
<li>fixed other I-D references I had missed, oops</li>
</ul>
</section>
<section anchor="draft-ietf-sieve-mailboxid-00"><name>draft-ietf-sieve-mailboxid-00</name>
<ul>
<li>Adopted into working group per adoption call on list</li>
<li>Updated references to old drafts which have since been published.</li>
<li>Fixed some typoes and simplified some language.</li>
<li>Removed stray leading colon on mailboxexists (thanks Alexey)</li>
<li>Added :fcc to the IANA registration description (thanks Alexey)</li>
<li>Mentioned that variables can be expanded (thanks Alexey)</li>
</ul>
</section>
<section anchor="draft-gondwana-sieve-mailboxid-02"><name>draft-gondwana-sieve-mailboxid-02</name>
<ul>
<li>Update document date by a couple of years! Ooops, it got forgotten after
a WGLC which got not dissent.</li>
<li>Create xml2rfc v3 output.</li>
</ul>
</section>
<section anchor="draft-gondwana-sieve-mailboxid-01"><name>draft-gondwana-sieve-mailboxid-01</name>
<ul>
<li>Switch to :mailboxid tagged parameter value with fallback mailbox name.</li>
<li>Document interaction with "mailbox".</li>
<li>Document interaction with "special-use".</li>
<li>Document interaction with "fcc".</li>
<li>Document security considerations around :mailboxid and :create.</li>
</ul>
</section>
<section anchor="draft-gondwana-sieve-mailboxid-00"><name>draft-gondwana-sieve-mailboxid-00</name>
<ul>
<li>Initial version.</li>
</ul>
</section>
</section>
</middle>
<back>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5228.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8474.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2342.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8580.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8579.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5490.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3501.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4314.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5229.xml"/>
</references>
</back>
</rfc>