Sieve Extension: Relational Tests
obsoleted by
- rfc-5231 — Sieve Email Filtering: Relational Extension
Extracted elements (15)
The "i;ascii-numeric" comparator does not support negative numbers; this is a known limitation inherited from [ACAP] and not addressed by this extension.
The relational extension is designed to extend existing Sieve conditional tests (address, envelope, header) with relational operators rather than creating entirely new tests, allowing comparison of field values beyond simple string equality and enabling count-based filtering.
The Header COUNT test counts the total number of field instances, not individual addresses within fields. Thus, testing ["to", "cc"] with COUNT on an RFC 2822 compliant message will always return at most 2, since each field may appear at most once.
Any comparator used other than "i;octet" and "i;ascii-casemap" MUST be declared in a require clause as defined in [SIEVE].
If there are multiple values on either side or both sides of a VALUE comparison, the test is considered true if any pair is true.
Leading and trailing white space MUST be removed from the value of the message before comparison in the VALUE match type. White space is defined as SP / HTAB / CRLF.
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 MUST support at least 32-bit unsigned integers. Larger integers MAY be supported.
For the Envelope COUNT test, the envelope "to" always has exactly one entry (the address of the user running the sieve script), and envelope "from" is 0 if MAIL FROM is blank or 1 if not blank.
The COUNT match type determines the number of specified entities in the message and performs a relational comparison of that count against values in the test expression. For address tests it counts recipients, for envelope tests it counts envelope parts, and for header tests it counts field instances.
The RELATIONAL extension defines two new match types: VALUE and COUNT. The syntax is MATCH-TYPE =/ COUNT / VALUE, where COUNT = ":count" relational-match and VALUE = ":value" relational-match, and relational-match = DQUOTE ( "gt" / "ge" / "lt" / "le" / "eq" / "ne" ) DQUOTE.
The VALUE match type performs a relational comparison between strings and may be used with any comparator that returns sort information. The value from the message is treated as the left side of the relation, and the key-list from the test expression is the right side.
When multiple field names are specified in a COUNT test, the counts for all specified fields are added together to obtain the number for comparison. For example, specifying ["to", "cc"] compares the total combined count; separate counts require separate comparisons.
This document registers the Sieve extension with capability name "RELATIONAL" and capability keyword "relational" in the IANA sieve-extensions registry.
An implementation MUST ensure that the test for envelope "to" only reflects delivery to the current user. It MUST NOT be possible for a user to determine if a message was delivered to someone else using this test.