Sieve (mail Filtering Language)
   HOME

TheInfoList



OR:

Sieve is a
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
that can be used for
email filtering Email filtering is the processing of email to organize it according to specified criteria. The term can apply to the intervention of human intelligence, but most often refers to the automatic processing of messages at an SMTP server, possibly ap ...
. It owes its creation to the CMU Cyrus Project, creators of
Cyrus IMAP server The Cyrus IMAP server is electronic mail server software developed by Carnegie Mellon University. It differs from other Internet Message Access Protocol (IMAP) server implementations in that it is generally intended to be run on sealed servers ...
. The language is not tied to any particular operating system or mail architecture. It requires the use of RFC-2822–compliant messages, but otherwise generalizes to other systems that meet these criteria. The current version of Sieve's base specification is outlined in RFC 5228, published in January 2008.


Language

Sieve is a
data-driven programming In computer programming, data-driven programming is a programming paradigm in which the program statements describe the data to be matched and the processing required rather than defining a sequence of steps to be taken. Standard examples of dat ...
language, similar to earlier email filtering languages such as procmail and maildrop, and earlier line-oriented languages such as sed and AWK: it specifies conditions to match and actions to take on matching. This differs from
general-purpose programming language In computer software, a general-purpose programming language (GPL) is a programming language for building software in a wide variety of application Domain (software engineering), domains. Conversely, a Domain-specific language, domain-specific pro ...
s. While Sieve has many limitations – the base standard has no variables and no loops – it does allow conditional branching, preventing runaway programs. These limitations generally confine the language to simple filtering operations. Although extensions have been devised to extend the language to include variables and, limited loops, the language is still highly restricted, and thus suitable for running user-devised programs as part of the mail system. There are also a significant number of restrictions on the
grammar In linguistics, grammar is the set of rules for how a natural language is structured, as demonstrated by its speakers or writers. Grammar rules may concern the use of clauses, phrases, and words. The term may also refer to the study of such rul ...
of the language, in order to reduce the complexity of parsing the language, but the language also supports the use of multiple methods for comparing localized strings, and is fully
Unicode Unicode or ''The Unicode Standard'' or TUS is a character encoding standard maintained by the Unicode Consortium designed to support the use of text in all of the world's writing systems that can be digitized. Version 16.0 defines 154,998 Char ...
-aware. While Sieve was originally conceived as tool external to SMTP, precognitively extends it in order to allow rejection at the SMTP protocol level.


Use

The Sieve scripts may be generated by a GUI-based rules editor or they may be entered directly using a
text editor A text editor is a type of computer program that edits plain text. An example of such program is "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be used to c ...
. The scripts are transferred to the mail server in a server-dependent way. The ManageSieve protocol (defined in ) allows users to manage their Sieve scripts on a remote server. Mail servers with local users may allow the scripts to be stored in e.g. a file in the users' home directories.


History

The language was standardized in the (now-obsolete) of January 2001, by Tim Showalter.


Extensions

The IETF Sieve working groupSieve working group charter
has updated the base specification in 2008 (), and has brought the following extensions to Proposed Standard status: * – Copying without side effects; allows a script to be copied across mailboxes without halting the script. * – Body; allows a script to test the body of a message, not just its header. * – Environment; provides access to information about the Sieve interpreter and its system environment. * – Variables; allows the script to save and retrieve values in variables. * – Vacation; specifies an action to send a response informing the sender that the recipient may be away. * – Relational tests; defines numeric tests, so that a script may test a field for a numeric value, and may test against the number of occurrences of a field. * – IMAP4flags; allows a script to test and set a message's IMAP flags. * – Subaddress; allows a script to test subaddresses of the form "user+detail@domain.example". * – Spamtest and Virustest; allows a script to interface with implementation * – Date and Index Extensions. * – Editheader; allows a script to add and delete message header fields. * – Reject; allows messages to be rejected at either the LMTP/SMTP level or with an MDN or DSN. * – Notifications; allows a script to trigger external notifications of email. * – Notifications; allows notifications to be sent via the mailto protocol * – XMPP notifications; specifies notifications via
XMPP Extensible Messaging and Presence Protocol (abbreviation XMPP, originally named Jabber) is an Open standard, open communication protocol designed for instant messaging (IM), presence information, and contact list maintenance. Based on XML (Ext ...
. * – Checking; Mailbox status and accessing mailbox metadata. * – MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure * – A Protocol for Remotely Managing Sieve Scripts * – Vacation; adds the ability to specify seconds in a vacation time period. * – MIME part conversion; allows a script to convert body parts between MIME types. * – Script inclusion; allow a user to include one script inside another. * - Detecting Duplicate Deliveries; allows a script to detect duplicate messages and define custom behavior in those cases. A number of other extensions are still being developed by the Sieve working group.


Example

This is an example sieve script: # Sieve filter # Declare the extensions used by this script. # require fileinto", "reject" # Messages bigger than 100K will be rejected with an error message # if size :over 100K # Mails from a mailing list will be put into the folder "mailinglist" # elsif address :is From", "To""mailinglist@blafasel.invalid" # Spam Rule: Message does not contain my address in To, CC or BCC # header, or subject is something with "money" or "Viagra". # elsif anyof (not address :all :contains To", "Cc", "Bcc""me@blafasel.invalid", header :matches "Subject" *money*","*Viagra*" # Keep the rest. # This is not necessary because there is an "implicit keep" rule # else


See also

*
Email filtering Email filtering is the processing of email to organize it according to specified criteria. The term can apply to the intervention of human intelligence, but most often refers to the automatic processing of messages at an SMTP server, possibly ap ...
* procmail * maildrop * fdm


References


External links


Sieve.Info, a Wiki Site about Sieve

The old Sieve Home Page on web.archive.org
* {{IETF RFC, 5228



Email Anti-spam Request for Comments Programming_languages_created_in_2001