Sieve Email Filtering: Relational Extension
obsoletes
- rfc-3431 — Sieve Extension: Relational Tests
Extracted elements (16)
The 'i;ascii-numeric' comparator does not support negative numbers, a deliberate constraint noted explicitly to clarify the scope of numeric comparison in Sieve.
When multiple field names are specified in a COUNT test, counts for all fields are summed; if separate counts are desired, they must be done in two comparisons joined by 'allof' or 'anyof'. This simplifies the common case while preserving flexibility.
A header COUNT test on fields like 'to' and 'cc' will always evaluate to false on an RFC 2822 compliant message when testing for 3 or more, since each of those fields may appear at most once; the test counts field instances, not addresses.
The relational extension has no interaction with other Sieve operations or known extensions; it does not affect implicit KEEP or any explicit message actions.
The VALUE match type may only be used with comparators that return sort information; the COUNT match type only makes sense with numeric comparators.
An implementation MUST ensure that the test for envelope 'to' only reflects the delivery to the current user; it MUST NOT be possible for a user to determine if the message was delivered to someone else.
The COUNT match type SHOULD only be used with numeric comparators.
The 'i;ascii-numeric' comparator MUST be supported for any implementation of this extension, and it MUST support at least 32-bit unsigned integers.
The COUNT match type determines the number of specified entities in the message and does a relational comparison of that count to values in the test expression. For address tests it counts mailbox elements; group names are ignored but contained mailboxes are counted.
The envelope 'to' will always have only one entry (the current delivery recipient), and envelope 'from' will be 0 if 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, not individual addresses within those fields. When multiple field names are specified, counts are summed.
The RELATIONAL extension defines two new match types: VALUE and COUNT, extending address, envelope, and header tests with relational operators (gt, ge, lt, le, eq, ne).
The VALUE match type performs a relational comparison between strings, treating a value from the message as the left side and the key-list from the test expression as the right side. The test is true if any pair satisfies the relation.
This document registers the 'relational' capability name in the Sieve extension registry, describing it as extending existing conditional tests to allow relational operators.
Implementations must prevent the envelope 'to' test from revealing whether a message was delivered to users other than the one running the current Sieve script, protecting recipient privacy.
The MATCH-TYPE syntax is extended with COUNT and VALUE, each followed by a relational-match token which is a double-quoted string from the set: 'gt', 'ge', 'lt', 'le', 'eq', 'ne'.