rfc-3431

Sieve Extension: Relational Tests

W. Segmuller
date2002-12 streamIETF wgnon working group statusPROPOSED STANDARD pages8 canonicalhttps://www.rfc-editor.org/rfc/rfc3431 doi10.17487/RFC3431
This document describes the RELATIONAL extension to the Sieve mail filtering language defined in RFC 3028. This extension extends existing conditional tests in Sieve to allow relational operators. In addition to testing their content, it also allows for testing of the number of entities in header and envelope fields. [STANDARDS-TRACK]

obsoleted by

Extracted elements (15)

design-rationale §3

The "i;ascii-numeric" comparator does not support negative numbers; this is a known limitation inherited from [ACAP] and not addressed by this extension.

email

design-rationale §1

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.

email

interoperability-note §4.2

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.

email

normative-requirement §3 MUST

Any comparator used other than "i;octet" and "i;ascii-casemap" MUST be declared in a require clause as defined in [SIEVE].

email

normative-requirement §4.1 MUST

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.

email

normative-requirement §4.1 MUST

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.

email

normative-requirement §4.2 SHOULD

The COUNT match type SHOULD only be used with numeric comparators.

email

normative-requirement §3 MUST

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.

email

protocol-element §4.2

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.

email

protocol-element §4.2

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.

email

protocol-element §4

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.

email

protocol-element §4.1

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.

email

protocol-element §4.2

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.

email

registry §8

This document registers the Sieve extension with capability name "RELATIONAL" and capability keyword "relational" in the IANA sieve-extensions registry.

email, registry

security-consideration §5

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.

email, security