RFC 5231

Sieve Email Filtering: Relational Extension

๐Ÿ“… published January 2008, from ietf

RFC 5231: Sieve Email Filtering: Relational Extension โœจ

Okay bestie, this is RFC 5231, and it's giving Standards Track ๐Ÿ’…. It was written by Wolfgang Segmuller and Barry Leiba from IBM T.J. Watson Research Center, and it's dated January 2008 ๐ŸŒธ. It also obsoletes RFC 3431 ๐Ÿฆ‹, so that older one is retired now.

Status of This Memo

This document describes an Internet standards track protocol for the Internet community, and it's asking everyone to discuss it and suggest improvements ๐Ÿซถ. For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) โœจ. Distribution of this memo is unlimited ๐ŸŒˆ.

Abstract

So this doc describes the RELATIONAL extension to the Sieve mail filtering language from RFC 3028 ๐Ÿ’–. It lets conditional tests in Sieve use relational operators, not just "is it equal?" ๐Ÿ‘‘. It also lets you test how many entities show up in header and envelope fields, which is lowkey iconic ๐Ÿ”ฅ.

This document obsoletes RFC 3431 ๐Ÿฆ‹.

Table of Contents

1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.  Conventions Used in This Document . . . . . . . . . . . . . . . 2
3.  Comparators . . . . . . . . . . . . . . . . . . . . . . . . . . 2
4.  Match Types . . . . . . . . . . . . . . . . . . . . . . . . . . 3
  4.1.  Match Type VALUE  . . . . . . . . . . . . . . . . . . . . . 3
  4.2.  Match Type COUNT  . . . . . . . . . . . . . . . . . . . . . 3
5.  Interaction with Other Sieve Actions  . . . . . . . . . . . . . 4
6.  Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
7.  Extended Example  . . . . . . . . . . . . . . . . . . . . . . . 6
8.  Changes since RFC 3431  . . . . . . . . . . . . . . . . . . . . 6
9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 7
10. Security Considerations . . . . . . . . . . . . . . . . . . . . 7
11. Normative References  . . . . . . . . . . . . . . . . . . . . . 7

1. Introduction โœจ

Okay so the RELATIONAL extension is an add-on for the Sieve mail filtering language [Sieve] ๐ŸŽ€. It gives you relational operators for the address, envelope, and header tests ๐Ÿ’…. It also gives you a way to count the entities in a message header or address field ๐Ÿงฎ.

This is so cute because now a Sieve script can check whether a field is greater than or less than a value, not just equivalent ๐ŸŒธ. One example is the x-priority field: move messages with a priority greater than 3 into the "work on later" folder ๐Ÿ’ผ. You could also sort mail by the from address. Userids that start with 'a'-'m' go in one folder, and everyone else goes in another ๐Ÿ“.

The Sieve script can also count stuff. It can figure out how many fields are in the header, or how many addresses are in a recipient field. For example, it can check whether there are more than 5 addresses in the to and cc fields ๐Ÿ˜ญ.

The capability string for this extension is relational ๐Ÿฆ‹.

2. Conventions Used in This Document ๐Ÿ“

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14, RFC 2119 ๐Ÿซถ.

Notation conventions follow [Sieve] section 1.1, including the use of [Kwds] and the use of [ABNF] ๐ŸŒˆ.

3. Comparators ๐Ÿ’œ

This document doesn't define any comparators, and it doesn't exempt any comparators from the require clause ๐Ÿ™ˆ. Any comparator used must be treated as defined in [Sieve] โœจ.

The comparator i;ascii-numeric, as defined in [RFC4790], MUST be supported for any implementation of this extension ๐Ÿ‘‘. The comparator i;ascii-numeric MUST support at least 32-bit unsigned integers ๐Ÿ”ฅ.

Larger integers MAY be supported ๐Ÿงš. Note: the i;ascii-numeric comparator does not support negative numbers ๐Ÿ’€.

4. Match Types ๐ŸŽ€

This document defines two new match types, VALUE and COUNT ๐ŸŒธ.

The syntax is:

MATCH-TYPE =/ COUNT / VALUE

COUNT = ":count" relational-match

VALUE = ":value" relational-match

relational-match = DQUOTE
        ("gt" / "ge" / "lt" / "le" / "eq" / "ne") DQUOTE
        ; "gt" means "greater than", the C operator ">".
        ; "ge" means "greater than or equal", the C operator ">=".
        ; "lt" means "less than", the C operator "<".
        ; "le" means "less than or equal", the C operator "<=".
        ; "eq" means "equal to", the C operator "==".
        ; "ne" means "not equal to", the C operator "!=".

4.1. Match Type VALUE ๐Ÿฆ‹

The VALUE match type does a relational comparison between strings ๐Ÿ’–.

The VALUE match type may be used with any comparator that returns sort information โœจ.

A value from the message is the left side of the relation ๐Ÿ‘ˆ. A value from the test expression is the right side of the relation. That's the key-list for address, envelope, and header tests ๐Ÿซถ.

If there are multiple values on either side or both sides, the test is considered true if any pair is true ๐ŸŒˆ.

4.2. Match Type COUNT ๐Ÿงฎ

The COUNT match type first figures out the number of the specified entities in the message ๐Ÿ’…. Then it does a relational comparison of that number, as defined below, against the values in the test expression ๐Ÿ‘‘.

The COUNT match type SHOULD only be used with numeric comparators ๐Ÿ”ข.

The Address Test counts the number of addresses in the specified fields. Those are the "mailbox" elements defined in [RFC2822] ๐Ÿ“ฌ. Group names are ignored, but the mailboxes inside the groups get counted ๐Ÿ™ˆ.

The Envelope Test counts the number of addresses in the specified envelope parts ๐Ÿ’Œ. The envelope "to" will always have only one entry, which is the address of the user the Sieve script is running for ๐ŸŽ€. With this test, there's no way for a script to tell whether the message was actually sent to someone else ๐Ÿ™ˆ. The envelope "from" will be 0 if the MAIL FROM is empty, or 1 if MAIL FROM is not empty ๐Ÿ’….

The Header Test counts the total number of instances of the specified fields ๐Ÿงพ. It does not count individual addresses in the "to", "cc", and other recipient fields ๐ŸŒธ.

In all cases, if you specify more than one field name, the counts for all of them get added together ๐Ÿ’–. So ["to", "cc"] in an address COUNT test compares the total number of "to" and "cc" addresses ๐Ÿงฎ. If you want separate counts, you need two comparisons, maybe joined by "allof" or "anyof" ๐Ÿซถ.

5. Interaction with Other Sieve Actions ๐ŸŒˆ

This specification adds two match types ๐ŸŽ€. The VALUE match type only works with comparators that return sort information โœจ. The COUNT match type only makes sense with numeric comparators ๐Ÿ”ข.

There's no interaction with any other Sieve operations, and no interaction with any known extensions either ๐Ÿ™Œ. This specification has no effect on implicit KEEP, and no effect on any explicit message actions ๐Ÿ’….


Part 2 is next, bestie, and it's where the examples and the big security stuff live ๐Ÿซถ๐Ÿ”ฅ.

Okay so, the copyright part ๐Ÿซถ Copyright (C) The IETF Trust (2008). The IETF Trust owns this one, and the rights, licenses and restrictions in BCP 78 apply to it. Except for whatever BCP 78 says, the authors keep all their rights ๐Ÿ’…

The legal disclaimer is in all caps, so no shade, just lawyers being lawyers ๐Ÿ˜ญ This document and the information in it are provided on an "AS IS" basis. THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ๐Ÿ’€


Intellectual Property ๐Ÿฆ‹

The IETF doesn't take a side on whether any Intellectual Property Rights or other rights are valid, or how far they reach, for anything that uses the tech in this document ๐Ÿ™ˆ It also doesn't say whether you can get a license for them. And it hasn't gone looking for any of those rights either, so it's not vouching for anything. If you want the details on how rights work for RFC documents, check out BCP 78 and BCP 79 ๐Ÿ“š

Copies of IPR disclosures sent to the IETF Secretariat are a thing, and so are any assurances of licenses that might be offered. If someone tried to get a general license or permission to use those proprietary rights, implementers or users can look for the results too. All of that lives in the IETF on-line IPR repository at http://www.ietf.org/ipr ๐ŸŒธ

And the IETF really wants to hear from you ๐Ÿซถ If you know about any copyrights, patents, patent applications, or other proprietary rights that might cover tech you'd need to implement this standard, tell the IETF. Send it to ietf-ipr@ietf.org โœจ

๐Ÿ“ฆ where this page comes from