HOME

TheInfoList



OR:

Sieve is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
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 appl ...
. 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 should generalize 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 procmail is an email server software component — specifically, a message delivery agent (MDA). It was one of the earliest mail filter programs. It is typically used in Unix-like mail systems, using the mbox and Maildir storage formats. procm ...
and
maildrop Maildrop is a Mail delivery agent used by the Courier Mail Server. The maildrop Mail Delivery Agent (MDA) also includes filtering functionality. Maildrop receives mail via stdin and delivers in both Maildir and mbox formats. Features Mai ...
, and earlier line-oriented languages such as
sed sed ("stream editor") is a Unix utility that parses and transforms text, using a simple, compact programming language. It was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs, and is available today for most operating systems. sed w ...
and
AWK AWK (''awk'') is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems. The AWK lang ...
: 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 domains. Conversely, a domain-specific programming language is used within a specific area. For exam ...
s in that it is highly limited – the base standard has no variables, and no loops (but does allow conditional branching), preventing runaway programs and limiting the language to simple filtering operations. Although extensions have been devised to extend the language to include variables and, to a limited degree, 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, the grammar of a natural language is its set of structure, structural constraints on speakers' or writers' composition of clause (linguistics), clauses, phrases, and words. The term can also refer to the study of such constraint ...
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, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
-aware. While Sieve was originally conceived as tool external to SMTP, RFC 5429 serendipitously extends it in order to allow rejection at the SMTP protocol level.


Use

The Sieve scripts may be generated by a
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
-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. Such programs are sometimes known as "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be us ...
. The scripts are transferred to the mail server in a server-dependent way. The ManageSieve protocol (defined in RFC 5804) 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) RFC 3028 of January 2001, by Tim Showalter.


Extensions

The IETF Sieve working groupSieve working group charter
has updated the base specification in 2008 (RFC 5228), and has brought the following extensions to Proposed Standard status: * RFC 5173 – Body; allows a script to test the body of a message, not just its header. * RFC 5229 – Variables; allows the script to save and retrieve values in variables. * RFC 5230 – Vacation; specifies an action to send a response informing the sender that the recipient may be away. * RFC 5231 – 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. * RFC 5232 – IMAP4flags; allows a script to test and set a message's IMAP flags. * RFC 5233 – Subaddress; allows a script to test subaddresses of the form "[email protected]". * RFC 5235 – Spamtest and Virustest; allows a script to interface with implementation-dependent message filtering. * RFC 5260 – Date and Index Extensions. * RFC 5293 – Editheader; allows a script to add and delete message header fields. * RFC 5429 – Reject; allows messages to be rejected at either the
LMTP The Local Mail Transfer Protocol (LMTP) is an alternative to (Extended) Simple Mail Transfer Protocol for situations where the receiving side does not have a mail queue, such as a message transfer agent acting as a message delivery agent. LMTP was ...
/
SMTP The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typical ...
level or with an MDN or DSN. * RFC 5435 – Notifications; allows a script to trigger external notifications of email. * RFC 5436 – E-mail notifications; specifies notifications via e-mail. * RFC 5437 – XMPP notifications; specifies notifications via
XMPP Extensible Messaging and Presence Protocol (XMPP, originally named Jabber) is an open communication protocol designed for instant messaging (IM), presence information, and contact list maintenance. Based on XML (Extensible Markup Language), it ...
. * RFC 5490 – Checking; Mailbox status and accessing mailbox metadata. * RFC 5703 – MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure * RFC 5804 - A Protocol for Remotely Managing Sieve Scripts 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""[email protected]" # 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""[email protected]", 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 appl ...
*
procmail procmail is an email server software component — specifically, a message delivery agent (MDA). It was one of the earliest mail filter programs. It is typically used in Unix-like mail systems, using the mbox and Maildir storage formats. procm ...
*
maildrop Maildrop is a Mail delivery agent used by the Courier Mail Server. The maildrop Mail Delivery Agent (MDA) also includes filtering functionality. Maildrop receives mail via stdin and delivers in both Maildir and mbox formats. Features Mai ...
* fdm


References

{{reflist


External links


Sieve.Info, a Wiki Site about Sieve

The old Sieve Home Page on web.archive.org
* RFC 5228 (Base Specification about Sieve)



Email Spam filtering