RFC 9042

Sieve Email Filtering: Delivery by MAILBOXID

πŸ“… published June 2021, from ietf

RFC 9042: Sieve Email Filtering: Delivery by MAILBOXID πŸ’Œ

Okay bestie, here's the title block first πŸŽ€

Series: Internet Engineering Task Force (IETF) 🌸 Request for Comments: 9042 Author: B. Gondwana, Ed., Fastmail πŸ‘‘ Date: June 2021 πŸ“… Category: Standards Track ✨ ISSN: 2070-1721 Updates: 5228 (RFC 5228, the Sieve base spec) πŸ”₯

This one updates RFC 5228, so it's adding onto the Sieve email filtering language instead of replacing it. Iconic πŸ’…

Abstract

Okay so the OBJECTID capability of IMAP (RFC 8474) lets clients identify a mailbox with a unique ID that doesn't change when the mailbox gets renamed. Main character energy πŸ¦‹

This doc extends Sieve (RFC 5228) so you can use that same unique ID as the target for fileinto rules, and to check whether a mailbox exists. Rules keep pointing at the right mailbox even after a rename 🫢

Status of This Memo πŸ“œ

This is an Internet Standards Track document. 🌈

It's a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). For more on Internet Standards, check Section 2 of RFC 7841. πŸ’œ

Info about the current status, any errata, and how to give feedback lives at https://www.rfc-editor.org/info/rfc9042. ✨

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 (https://trustee.ietf.org/license-info) as they stand on the publication date. Please read these carefully, because they explain your rights and restrictions for this document. Code Components pulled out of this document must include the Simplified BSD License text described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as the Simplified BSD License says. πŸ™ˆ

Table of Contents πŸ—‚οΈ

   1.  Introduction
   2.  Conventions Used in This Document
   3.  Sieve Capability String
   4.  Argument :mailboxid to Command fileinto
     4.1.  Interaction with Mailbox Extension
     4.2.  Interaction with Special-Use Extension
   5.  Interaction with FCC Extension
   6.  Test mailboxidexists
   7.  Interaction with Variables Extension
   8.  Security Considerations
   9.  IANA Considerations
   10. References
     10.1.  Normative References
     10.2.  Informative References
   Acknowledgements
   Author's Address

1. Introduction 🧚

Sieve rules [RFC5228] are sometimes made with graphical interfaces, where you pick the mailbox a rule should target. 🌸

Now, if that mailbox gets renamed, the client can update its own copy of the rule and then update the Sieve script to match. Lowkey a lot of steps, though, and any one of them can fail partway through 😭 Also, if someone renames the folder some other way (like a different IMAP client), the rules get out of sync. Not it πŸ’€

So the fix is to have fileinto point at the immutable MAILBOXID from [RFC8474], using the extension in this doc. Rules keep targeting the same mailbox even after it's renamed. Slay πŸ‘‘

2. Conventions Used in This Document πŸ“–

Okay, the BCP 14 key words are exactly this list: "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL". They only count as requirement language when they show up in ALL CAPS, the way they're written here. Keep that in mind when you read the rest 🫢 They're interpreted as described in BCP 14 [RFC2119] [RFC8174].

3. Sieve Capability String πŸŽ€

Real talk: scripts that use this extension MUST explicitly require the capability "mailboxid". No skipping this step, bestie πŸ’…

Example:

require "mailboxid";

4. Argument :mailboxid to Command fileinto πŸ’Œ

So normally, fileinto delivers the message to the mailbox named by its positional mailbox argument. ✨ But if you also add the optional :mailboxid argument, fileinto first checks whether a mailbox with that MAILBOXID [RFC8474] exists in the user's personal namespace [RFC2342]. πŸ¦‹

If it finds a matching mailbox, that's where the message goes. 🎯

If there's no such mailbox, the fileinto action carries on just like it would without :mailboxid. 🌈

The tagged argument :mailboxid to fileinto eats one more token: a string holding 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";
}

4.1. Interaction with Mailbox Extension πŸ“¦

For servers that also support the mailbox extension from [RFC5490], if you give both :create and :mailboxid to a fileinto command and no matching mailbox turns up, a new mailbox gets created. 🌷

This new mailbox takes the name from the positional mailbox argument ([RFC5228], Section 4.1). It does NOT get the MAILBOXID you passed in with :mailboxid, though. The server picks a different one instead πŸ™ˆ

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.

4.2. Interaction with Special-Use Extension πŸ“

For servers that also support delivery to special-use mailboxes [RFC8579], it's an error to put both :mailboxid and :specialuse in the same fileinto command. Big no πŸ’€

You can still build advanced filtering that uses both special-use and MAILBOXID, though. Just use explicit specialuse_exists and mailboxidexists tests. 🧚

Here's a tip from the doc for people making Sieve generation tools πŸ‘€

   |  Note to developers of Sieve generation tools:
   |
   |  It is advisable to use special-use rather than MAILBOXID when
   |  creating rules that are based on a special-use purpose (e.g.,
   |  delivery directly to the Junk folder based on a header that was
   |  added by a scanning agent earlier in the mail flow).

Part 1 is done, and the rest is coming next πŸ’– Sections 5 onward (FCC, the mailboxidexists test, Security Considerations, IANA, and the references) are still to come, so stay tuned πŸ¦‹βœ¨

10.2. Informative References πŸ“š

Okay bestie, these are the "for more context" reads, the extra background that helps everything click πŸ€“

[RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, <https://www.rfc-editor.org/info/rfc3501>.

[RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", RFC 4314, DOI 10.17487/RFC4314, December 2005, <https://www.rfc-editor.org/info/rfc4314>.

[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, DOI 10.17487/RFC5229, January 2008, <https://www.rfc-editor.org/info/rfc5229>.

[RFC5490] Melnikov, A., "The Sieve Mail-Filtering Language -- Extensions for Checking Mailbox Status and Accessing Mailbox Metadata", RFC 5490, DOI 10.17487/RFC5490, March 2009, <https://www.rfc-editor.org/info/rfc5490>.

[RFC8579] Bosch, S., "Sieve Email Filtering: Delivering to Special-Use Mailboxes", RFC 8579, DOI 10.17487/RFC8579, May 2019, <https://www.rfc-editor.org/info/rfc8579>.


Acknowledgements 🫢

This one is a big shoutout to the docs we leaned on. This document borrows heavily from [RFC5490] for the matching mailboxexists test, and from [RFC8579] for an example of modifying the fileinto command. Literally iconic sources 🌸

Thanks to Ned Freed, Ken Murchison, and Alexey Melnikov for feedback on the EXTRA mailing list. You all are the real MVPs πŸ‘‘βœ¨


Author's Address πŸ’Œ

The editor is Bron Gondwana, at Fastmail, and the contact details are below:

Bron Gondwana (editor)
Fastmail
Level 2
114 William St
Melbourne VIC 3000
Australia

Email: brong@fastmailteam.com URI: https://www.fastmail.com

πŸ“¦ where this page comes from