Sieve (mail filtering language)

Last updated
Sieve
Original author(s) University of Washington and Carnegie Mellon University [1] and standardized by Tim Showalter
Initial release1999;25 years ago (1999) [1]
Operating system Cross-platform
Type Email filtering
Website sieve.info

Sieve is a programming language that can be used for email filtering. It owes its creation to the CMU Cyrus Project, creators of Cyrus IMAP server.

Contents

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 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 languages.

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 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-aware.

While Sieve was originally conceived as tool external to SMTP, [2] [3] RFC  5429 precognitively extends it in order to allow rejection at the SMTP protocol level. [4]

Use

The Sieve scripts may be generated by a GUI-based rules editor or they may be entered directly using a text editor.

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 .sieve 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 group [5] has updated the base specification in 2008 (RFC  5228), and has brought the following extensions to Proposed Standard status:

A number of other extensions are still being developed by the Sieve working group.[ citation needed ]

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#ifsize:over100K{reject"I'm sorry, I do not accept mail over 100kb in size. Please upload larger files to a server and send me a link.Thanks.";}# Mails from a mailing list will be put into the folder "mailinglist" #elsifaddress:is["From","To"]"mailinglist@blafasel.invalid"{fileinto"INBOX.mailinglist";}# Spam Rule: Message does not contain my address in To, CC or BCC# header, or subject is something with "money" or "Viagra".#elsifanyof(notaddress:all:contains["To","Cc","Bcc"]"me@blafasel.invalid",header:matches"Subject"["*money*","*Viagra*"]){fileinto"INBOX.spam";}# Keep the rest.# This is not necessary because there is an "implicit keep" rule#else{keep;}

See also

Related Research Articles

<span class="mw-page-title-main">Email</span> Mail sent using electronic means

Electronic mail is a method of transmitting and receiving messages using electronic devices. It was conceived in the late–20th century as the digital version of, or counterpart to, mail. Email is a ubiquitous and very widely used communication medium; in current use, an email address is often treated as a basic and necessary part of many processes in business, commerce, government, education, entertainment, and other spheres of daily life in most countries.

In computing, the Internet Message Access Protocol (IMAP) is an Internet standard protocol used by email clients to retrieve email messages from a mail server over a TCP/IP connection. IMAP is defined by RFC 9051.

Within the Internet email system, a message transfer agent (MTA), mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using the Simple Mail Transfer Protocol. In some contexts, the alternative names mail server, mail exchanger, or MX host are used to describe an MTA.

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 typically use SMTP only for sending messages to a mail server for relaying, and typically submit outgoing email to the mail server on port 587 or 465 per RFC 8314. For retrieving messages, IMAP is standard, but proprietary servers also often implement proprietary protocols, e.g., Exchange ActiveSync.

<span class="mw-page-title-main">Email client</span> Computer program used to access and manage a users email

An email client, email reader or, more formally, message user agent (MUA) or mail user agent is a computer program used to access and manage a user's email.

A message delivery agent (MDA), or mail delivery agent, is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox. It is also called a local delivery agent (LDA).

An email address identifies an email box to which messages are delivered. While early messaging systems used a variety of formats for addressing, today, email addresses follow a set of specific rules originally standardized by the Internet Engineering Task Force (IETF) in the 1980s, and updated by RFC 5322 and 6854. The term email address in this article refers to just the addr-spec in Section 3.4 of RFC 5322. The RFC defines address more broadly as either a mailbox or group. A mailbox value can be either a name-addr, which contains a display-name and addr-spec, or the more common addr-spec alone.

A bounce message or just "bounce" is an automated message from an email system, informing the sender of a previous message that the message has not been delivered. The original message is said to have "bounced".

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 applying anti-spam techniques. Filtering can be applied to incoming emails as well as to outgoing ones.

Email authentication, or validation, is a collection of techniques aimed at providing verifiable information about the origin of email messages by validating the domain ownership of any message transfer agents (MTA) who participated in transferring and possibly modifying a message.

Many email clients now offer some support for Unicode. Some clients will automatically choose between a legacy encoding and Unicode depending on the mail's content, either automatically or when the user requests it.

Domain-based Message Authentication, Reporting and Conformance (DMARC) is an email authentication protocol. It is designed to give email domain owners the ability to protect their domain from unauthorized use, commonly known as email spoofing. The purpose and primary outcome of implementing DMARC is to protect a domain from being used in business email compromise attacks, phishing email, email scams and other cyber threat activities.

Email forwarding generically refers to the operation of re-sending a previously delivered email to an email address to one or more different email addresses.

Ned Freed was an IETF participant and Request for Comments author who contributed to a significant number of Internet Protocol standards, mostly related to email. He is best known as the co-inventor of email MIME attachments, with Nathaniel Borenstein.

International email arises from the combined provision of internationalized domain names (IDN) and email address internationalization (EAI). The result is email that contains international characters, encoded as UTF-8, in the email header and in supporting mail transfer protocols. The most significant aspect of this is the allowance of email addresses in most of the world's writing systems, at both interface and transport levels.

A mailbox is the destination to which electronic mail messages are delivered. It is the equivalent of a letter box in the postal system.

<span class="mw-page-title-main">Barry Leiba</span> American computer scientist and software researcher

Barry Leiba is a computer scientist and software researcher. He retired from IBM's Thomas J. Watson Research Center in Hawthorne, New York in February 2009, and now works for FutureWei Technologies as a Director of Internet Standards. His work has focused for many years on electronic mail and anti-spam technology, on mobile computing and the Internet of things, and on Internet standards.

SMTP Authentication, often abbreviated SMTP AUTH, is an extension of the Simple Mail Transfer Protocol (SMTP) whereby a client may log in using any authentication mechanism supported by the server. It is mainly used by submission servers, where authentication is mandatory.

Maildrop is a Mail delivery agent used by the Courier Mail Server. The maildrop Mail Delivery Agent (MDA) also includes filtering functionality.

A mailbox provider, mail service provider or, somewhat improperly, email service provider is a provider of email hosting. It implements email servers to send, receive, accept, and store email for other organizations or end users, on their behalf.

References

  1. 1 2 "History - Sieve.Info".
  2. That Sieve operates after message acceptance is in its defining document: P. Guenther; T. Showalter (January 2008). Sieve: An Email Filtering Language. IETF. doi: 10.17487/RFC5228 . RFC 5228. it is reasonable to filter when the MTA deposits mail into the user's mailbox
  3. That final delivery is outside SMTP is in its defining document: John Klensin (October 2008). "Trace Information". Simple Mail Transfer Protocol. IETF. sec. 4.4. doi: 10.17487/RFC5321 . RFC 5321. final delivery means the message has left the SMTP environment
  4. Aaron Stone (March 2009). "Rejecting a Message at the SMTP/LMTP Protocol Level". Sieve Email Filtering: Reject and Extended Reject Extensions. IETF. sec. 2.1.1. doi: 10.17487/RFC5429 . RFC 5429.
  5. Sieve working group charter Archived 2005-12-31 at the Wayback Machine