Summary

  • RFC 5229 added set, string expansion, and match variables to Sieve — but only when a script explicitly declared the variables capability.
  • The memory it created was deliberately bounded: captures depended on which tests actually ran, values lived only inside the running script, and implementations could truncate oversized values without error.

A filter needed a notebook, not a brain

Sieve was built to be small on purpose. By January 2008 it had a settled identity: a mail-filtering language for final delivery, deliberately stripped of variables, loops, and any way to call out to a shell. Those missing features were not empty sockets waiting to be filled. They were a fence around what a server-side user filter should be allowed to ask a mail system to do.

RFC 5229 opened one gate in that fence, carefully. A script could require "variables", then assign a named string with set, splice it into another string, and test what it had built. A successful wildcard match could expose the whole match as ${0} and each wildcard piece as ${1}, ${2}, and so on. The payoff was practical: pull a list name out of a header, carry it into a mailbox path, reuse a fragment instead of retyping it.

But a notebook is not a diary. The extension says variables are visible only to the script currently running. It defines no mailbox-wide store, no record of earlier messages, no shared state between users. The word “variable” sounds grander than the object the standard actually specifies: a name bound to string data for the life of one execution.

Declaration was the safety catch

Nothing happened until the script asked. A script without the variables requirement did not quietly inherit new string semantics — the feature was an explicit contract between script and interpreter, not a silent upgrade.

Once enabled, references were evaluated when control reached the statement holding them, in a single substitution pass. An undefined name expanded to the empty string; names were case-insensitive. That made composition compact and some mistakes invisible: a misspelled reference vanished into the text instead of announcing itself. A value that itself contained ${...} was not expanded a second time.

The extension added a handful of narrow modifiers — ASCII case folding, first-character case, wildcard quoting, string length — plus a string test. No arithmetic, no loops, no arbitrary code. “More expressive” meant a finite set of simple values could be named, lightly normalized, and reused. It did not mean unbounded.

A capture is a fact about one branch, not a witness

Match variables dragged control flow into the data model. RFC 5229 requires tests to run left to right and to short-circuit once a Boolean answer is known. In anyof (true, header :matches ...), the header test never runs, so it never captures. A later successful :matches can overwrite the previous capture list; a failed match supplies nothing. The author has to know which test actually fired before trusting ${1}.

The extension also refused to spray capture side effects across every lookalike operation. RFC 5173, the body extension published four months later, draws the line explicitly: variable references in a body-test key expand when the extension is enabled, but wildcard matching inside that body test must not set match variables. One capability can feed another without every superficially similar operation behaving alike.

The limits table turns boundedness into a contract. A conforming implementation had to support at least 128 variables, names of at least 32 characters, values of at least 4,000 characters, and captures ${1} through ${9}. When a value outgrew what an implementation could hold, the RFC recommended catching it at compile time where possible; if it surfaced only at run time, truncation was expected and was not an error. The security section duly warns against parking large, security-significant structures in variables and notes that captures may contain arbitrary sender-controlled text.

The paper trail of a small idea

The Datatracker record traces the individual draft to March 2003, then working-group drafts from late 2004 and revisions through 2005. The IESG write-up names the Sieve Mail Filtering Language Working Group as the source. Approval in 2006 and RFC publication in January 2008 are separate recorded events; the chronology does not explain the gap or how widely the feature was adopted.

Read through Heng Lu’s “Minimum Initial Specification,” the require gate looks like a localized future decision: keep a small base stable while a script opts into a precise extension. “Running-Code Primacy” adds the second distinction — a published capability does not prove any named server implements or enables it. “Reality Layers” keeps the declared feature, interpreter state, server behavior, and the user’s eventual mailbox from collapsing into a single claim. These are later interpretive frames, not evidence of the authors’ intent.

So the filter could remember what one evaluated match had captured, and reuse a few named strings. It could not, on that basis, remember a conversation across executions, authenticate a sender, or prove where a message landed. RFC 5229’s historical move was not to erase Sieve’s boundary but to make one carefully declared seam more useful — and to keep the notebook firmly shut when the script stopped running.

Sources