中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

Sieve: An Email Filtering Language

Sieve is a language for filtering email messages at time of final delivery. It is designed to be implementable on either a mail client or mail server.   It is meant to be extensible, simple, and independent of access protocol, mail architecture, and operating system. It is suitable for running on a mail server where users may not be allowed to execute arbitrary programs, such as on black box Internet Message Access Protocol (IMAP) servers, as the base language has no variables, loops, or ability to shell out to external programs.

The Sieve language is powerful enough to be useful but limited in order to allow for a safe server-side filtering system. The intention is to make it impossible for users to do anything more complex (and dangerous) than write simple mail filters, along with facilitating the use of graphical user interfaces (GUIs) for filter creation and manipulation.   The base language was not designed to be Turing-complete: it does not have a loop control structure or functions.

Scripts written in Sieve are executed during final delivery, when the message is moved to the user-accessible mailbox. In systems where the Mail Transfer Agent (MTA) does final delivery, such as traditional Unix mail, it is reasonable to filter when the MTA deposits mail into the user's mailbox.

There are a number of reasons to use a filtering system. Mail traffic for most users has been increasing due to increased usage of email, the emergence of unsolicited email as a form of advertising,and increased usage of mailing lists.

Because of the expectation that users will make use of filtering if it is offered and easy to use, this language has been made simple enough to allow many users to make use of it, but rich enough that it can be used productively.   However, it is expected that GUI-based editors will be the preferred way of editing filters for a large number of users.

Sieve consists of a set of commands. Each command consists of a set of tokens delimited by whitespace. The command identifier is the first token and it is followed by zero or more argument tokens. Arguments may be literal data, tags, blocks of commands, or test commands.

With the exceptions of strings and comments, the language is limited to US-ASCII characters. Strings and comments may contain octets outside the US-ASCII range.  Specifically, they will normally be in UTF-8, as specified in [UTF-8]. NUL (US-ASCII 0) is never permitted in scripts, while CR and LF can only appear as the CRLF line ending.

Reference links:
http://www.javvin.com/protocol/rfc5228.pdf: Sieve: An Email Filtering Language
http://www.javvin.com/protocol/rfc5229.pdf: Sieve Email Filtering: Variables Extension.
http://www.javvin.com/protocol/rfc5230.pdf: Sieve Email Filtering: Vacation Extension.
http://www.javvin.com/protocol/rfc5231.pdf: Sieve: Sieve Email Filtering: Relational Extension.
http://www.javvin.com/protocol/rfc5232.pdf: Sieve Email Filtering: Imap4 flags Extension.
http://www.javvin.com/protocol/rfc5233.pdf: Sieve Email Filtering: Subaddress Extension.
http://www.javvin.com/protocol/rfc5235.pdf : Sieve Email Filtering: Spamtest and Virustest Extensions.