draft-ietf-sieve-3028bis-06.txt   draft-ietf-sieve-3028bis-07.txt 
Network Working Group P. Guenther Network Working Group P. Guenther
Internet-Draft Sendmail, Inc. Internet-Draft Sendmail, Inc.
Expires: September 2006 T. Showalter Expires: December 2006 T. Showalter
Obsoletes: 3028 (if approved) Editors Obsoletes: 3028 (if approved) Editors
Sieve: An Email Filtering Language Sieve: An Email Filtering Language
draft-ietf-sieve-3028bis-06.txt draft-ietf-sieve-3028bis-07.txt
Status of this Memo Status of this Memo
By submitting this Internet-Draft, each author represents that any By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware applicable patent or other IPR claims of which he or she is aware
have been or will be disclosed, and any of which he or she becomes have been or will be disclosed, and any of which he or she becomes
aware will be disclosed, in accordance with Section 6 of BCP 79. aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at page 4, line 36 skipping to change at page 4, line 36
editors will be the preferred way of editing filters for a large editors will be the preferred way of editing filters for a large
number of users. number of users.
1.1. Conventions Used in This Document 1.1. Conventions Used in This Document
In the sections of this document that discuss the requirements of In the sections of this document that discuss the requirements of
various keywords and operators, the following conventions have been various keywords and operators, the following conventions have been
adopted. adopted.
The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
in this document are to be interpreted as defined in [KEYWORDS]. in this document are to be interpreted as described in [KEYWORDS].
Each section on a command (test, action, or control) has a line Each section on a command (test, action, or control) has a line
labeled "Usage:". This line describes the usage of the command, labeled "Usage:". This line describes the usage of the command,
including its name and its arguments. Required arguments are listed including its name and its arguments. Required arguments are listed
inside angle brackets ("<" and ">"). Optional arguments are listed inside angle brackets ("<" and ">"). Optional arguments are listed
inside square brackets ("[" and "]"). Each argument is followed by inside square brackets ("[" and "]"). Each argument is followed by
its type, so "<key: string>" represents an argument called "key" that its type, so "<key: string>" represents an argument called "key" that
is a string. Literal strings are represented with double-quoted is a string. Literal strings are represented with double-quoted
strings. Alternatives are separated with slashes, and parenthesis strings. Alternatives are separated with slashes, and parenthesis
are used for grouping, similar to [ABNF]. are used for grouping, similar to [ABNF].
skipping to change at page 11, line 20 skipping to change at page 11, line 20
of performing the match operation. These are accomplished with three of performing the match operation. These are accomplished with three
types of matches: an exact match, a substring match, and a wildcard types of matches: an exact match, a substring match, and a wildcard
glob-style match. These are described below. glob-style match. These are described below.
In order to provide for matches between character sets and case In order to provide for matches between character sets and case
insensitivity, Sieve uses the comparators defined in the Internet insensitivity, Sieve uses the comparators defined in the Internet
Application Protocol Collation Registry [COLLATION]. Application Protocol Collation Registry [COLLATION].
However, when a string represents the name of a header, the However, when a string represents the name of a header, the
comparator is never user-specified. Header comparisons are always comparator is never user-specified. Header comparisons are always
done with the "en;ascii-casemap" operator, i.e., case-insensitive done with the "i;ascii-casemap" operator, i.e., case-insensitive
comparisons, because this is the way things are defined in the comparisons, because this is the way things are defined in the
message specification [IMAIL]. message specification [IMAIL].
2.7.1. Match Type 2.7.1. Match Type
There are three match types describing the matching used in this There are three match types describing the matching used in this
specification: ":is", ":contains", and ":matches". Match type specification: ":is", ":contains", and ":matches". Match type
arguments are supplied to those commands which allow them to specify arguments are supplied to those commands which allow them to specify
what kind of match is to be performed. what kind of match is to be performed.
skipping to change at page 11, line 46 skipping to change at page 11, line 46
For instance, the string "frobnitzm" contains "frob" and "nit", but For instance, the string "frobnitzm" contains "frob" and "nit", but
not "fbm". The empty key ("") is contained in all values. not "fbm". The empty key ("") is contained in all values.
The ":is" match type describes an absolute match; if the contents of The ":is" match type describes an absolute match; if the contents of
the first string are absolutely the same as the contents of the the first string are absolutely the same as the contents of the
second string, they match. Only the string "frobnitzm" is the string second string, they match. Only the string "frobnitzm" is the string
"frobnitzm". The empty key ":is" and only ":is" the empty value. "frobnitzm". The empty key ":is" and only ":is" the empty value.
The ":matches" match type specifies a wildcard match using the The ":matches" match type specifies a wildcard match using the
characters "*" and "?"; the entire value must be matched. "*" characters "*" and "?"; the entire value must be matched. "*"
matches zero or more characters, and "?" matches a single character, matches zero or more characters in the value and "?" matches a single
using the definition of character appropriate for the comparator in character in the value, where the comparator that is used (see 2.7.3)
use. That is, "?" will match exactly one octet when the "i;octet" or defines what a character is. For example, the comparators "i;octet"
"en;ascii-casemap" comparators are used, but will match the one or and "i;ascii-casemap" define a character to be a single octet so "?"
more octets that compose a character in UTF-8 when the will always match exactly one octet when one of those comparators is
"i;basic;uca=3.1.1;uv=3.2" comparator is used. "?" and "*" may be in use. In contrast, the comparator "i;basic;uca=3.1.1;uv=3.2"
escaped as "\\?" and "\\*" in strings to match against themselves. defines a character to be any UTF-8 octet sequence encoding one
The first backslash escapes the second backslash; together, they Unicode character and thus "?" may match more than one octet. "?"
escape the "*". This is awkward, but it is commonplace in several and "*" may be escaped as "\\?" and "\\*" in strings to match against
programming languages that use globs and regular expressions. themselves. The first backslash escapes the second backslash;
together, they escape the "*". This is awkward, but it is
commonplace in several programming languages that use globs and
regular expressions.
In order to specify what type of match is supposed to happen, In order to specify what type of match is supposed to happen,
commands that support matching take optional tagged arguments commands that support matching take optional tagged arguments
":matches", ":is", and ":contains". Commands default to using ":is" ":matches", ":is", and ":contains". Commands default to using ":is"
matching if no match type argument is supplied. Note that these matching if no match type argument is supplied. Note that these
modifiers interact with comparators; in particular, only comparators modifiers interact with comparators; in particular, only comparators
that supoprt the "substring match" operation are suitable for that support the "substring match" operation are suitable for
matching with ":contains" or ":matches". It is an error to use a matching with ":contains" or ":matches". It is an error to use a
comparator with ":contains" or ":matches" that is not compatible with comparator with ":contains" or ":matches" that is not compatible with
it. it.
It is an error to give more than one of these arguments to a given It is an error to give more than one of these arguments to a given
command. command.
For convenience, the "MATCH-TYPE" syntax element is defined here as For convenience, the "MATCH-TYPE" syntax element is defined here as
follows: follows:
skipping to change at page 13, line 4 skipping to change at page 13, line 7
(character zero) SHOULD NOT cause early termination of the header (character zero) SHOULD NOT cause early termination of the header
content being compared against. content being compared against.
If implementations fail to support the above behavior, they MUST If implementations fail to support the above behavior, they MUST
conform to the following: conform to the following:
No two strings can be considered equal if one contains octets No two strings can be considered equal if one contains octets
greater than 127. greater than 127.
2.7.3. Comparators 2.7.3. Comparators
In order to allow for language-independent, case-independent matches, In order to allow for language-independent, case-independent matches,
the match type may be coupled with a comparator name. The Internet the match type may be coupled with a comparator name. The Internet
Application Protocol Collation Registry [COLLATION] provides the Application Protocol Collation Registry [COLLATION] provides the
framework for describing and naming comparators as used by this framework for describing and naming comparators as used by this
specification. specification.
All implementations MUST support the "i;octet" comparator (simply All implementations MUST support the "i;octet" comparator (simply
compares octets), the "en;ascii-casemap" comparator (which treats compares octets) and the "i;ascii-casemap" comparator (which treats
uppercase and lowercase characters in the US-ASCII subset of UTF-8 as uppercase and lowercase characters in the US-ASCII subset of UTF-8 as
the same), as well as the "i;ascii-casemap" comparator, which is a the same). If left unspecified, the default is "i;ascii-casemap".
deprecated synonym for "en;ascii-casemap". If left unspecified, the
default is "en;ascii-casemap".
Some comparators may not be usable with substring matches; that is, Some comparators may not be usable with substring matches; that is,
they may only work with ":is". It is an error to try and use a they may only work with ":is". It is an error to try and use a
comparator with ":matches" or ":contains" that is not compatible with comparator with ":matches" or ":contains" that is not compatible with
it. it.
Sieve treats a comparator result of "undefined" the same as a result
of "no-match". That is, this base specification does not provide any
means to directly detect invalid comparator input.
A comparator is specified by the ":comparator" option with commands A comparator is specified by the ":comparator" option with commands
that support matching. This option is followed by a string providing that support matching. This option is followed by a string providing
the name of the comparator to be used. For convenience, the syntax the name of the comparator to be used. For convenience, the syntax
of a comparator is abbreviated to "COMPARATOR", and (repeated in of a comparator is abbreviated to "COMPARATOR", and (repeated in
several tests) is as follows: several tests) is as follows:
Syntax: ":comparator" <comparator-name: string> Syntax: ":comparator" <comparator-name: string>
So in this example, So in this example,
Example: if header :contains :comparator "i;octet" "Subject" Example: if header :contains :comparator "i;octet" "Subject"
"MAKE MONEY FAST" { "MAKE MONEY FAST" {
discard; discard;
} }
would discard any message with subjects like "You can MAKE MONEY would discard any message with subjects like "You can MAKE MONEY
FAST", but not "You can Make Money Fast", since the comparator used FAST", but not "You can Make Money Fast", since the comparator used
is case-sensitive. is case-sensitive.
Comparators other than "i;octet", "en;ascii-casemap", and "i;ascii- Comparators other than "i;octet" and "i;ascii-casemap" must be
casemap" must be declared with require, as they are extensions. If a declared with require, as they are extensions. If a comparator
comparator declared with require is not known, it is an error, and declared with require is not known, it is an error, and execution
execution fails. If the comparator is not declared with require, it fails. If the comparator is not declared with require, it is also an
is also an error, even if the comparator is supported. (See 2.10.5.) error, even if the comparator is supported. (See 2.10.5.)
Both ":matches" and ":contains" match types are compatible with the Both ":matches" and ":contains" match types are compatible with the
"i;octet" and "en;ascii-casemap" comparators and may be used with "i;octet" and "i;ascii-casemap" comparators and may be used with
them. them.
It is an error to give more than one of these arguments to a given It is an error to give more than one of these arguments to a given
command. command.
2.7.4. Comparisons Against Addresses 2.7.4. Comparisons Against Addresses
Addresses are one of the most frequent things represented as strings. Addresses are one of the most frequent things represented as strings.
These are structured, and being able to compare against the local- These are structured, and being able to compare against the local-
part or the domain of an address is useful, so some tests that act part or the domain of an address is useful, so some tests that act
exclusively on addresses take an additional optional argument that exclusively on addresses take an additional optional argument that
specifies what the test acts on. specifies what the test acts on.
These optional arguments are ":localpart", ":domain", and ":all", These optional arguments are ":localpart", ":domain", and ":all",
which act on the local-part (left-side), the domain part (right- which act on the local-part (left-side), the domain part (right-
side), and the whole address. side), and the whole address.
If an address is not syntactically valid then it will not be matched
by tests specifying ":localpart" or ":domain".
The kind of comparison done, such as whether or not the test done is The kind of comparison done, such as whether or not the test done is
case-insensitive, is specified as a comparator argument to the test. case-insensitive, is specified as a comparator argument to the test.
If an optional address-part is omitted, the default is ":all". If an optional address-part is omitted, the default is ":all".
It is an error to give more than one of these arguments to a given It is an error to give more than one of these arguments to a given
command. command.
For convenience, the "ADDRESS-PART" syntax element is defined here as For convenience, the "ADDRESS-PART" syntax element is defined here as
follows: follows:
skipping to change at page 20, line 14 skipping to change at page 20, line 23
section 2.10.4). section 2.10.4).
4.1. Action fileinto 4.1. Action fileinto
Usage: fileinto <folder: string> Usage: fileinto <folder: string>
The "fileinto" action delivers the message into the specified folder. The "fileinto" action delivers the message into the specified folder.
Implementations SHOULD support fileinto, but in some environments Implementations SHOULD support fileinto, but in some environments
this may be impossible. Implementations MAY place restrictions on this may be impossible. Implementations MAY place restrictions on
folder names; use of an invalid folder name MAY be treated as an folder names; use of an invalid folder name MAY be treated as an
error or result in delivery to an implementation-defined folder. error or result in delivery to an implementation-defined folder. If
the implementation uses a different encoding scheme than UTF-8 for
folder names, it SHOULD reencode the folder name from UTF-8 to its
encoding scheme. For example, the Internet Message Access Protocol
[IMAP] uses modified UTF-7, such that a folder argument of "odds &
ends" would appear in IMAP as "odds &- ends".
The capability string for use with the require command is "fileinto". The capability string for use with the require command is "fileinto".
In the following script, message A is filed into folder In the following script, message A is filed into folder
"INBOX.harassment". "INBOX.harassment".
Example: require "fileinto"; Example: require "fileinto";
if header :contains ["from"] "coyote" { if header :contains ["from"] "coyote" {
fileinto "INBOX.harassment"; fileinto "INBOX.harassment";
} }
skipping to change at page 20, line 43 skipping to change at page 21, line 9
headers, but it may add new headers. The "redirect" modifies the headers, but it may add new headers. The "redirect" modifies the
envelope recipient. envelope recipient.
The redirect command performs an MTA-style "forward"--that is, what The redirect command performs an MTA-style "forward"--that is, what
you get from a .forward file using sendmail under UNIX. The address you get from a .forward file using sendmail under UNIX. The address
on the [SMTP] envelope is replaced with the one on the redirect on the [SMTP] envelope is replaced with the one on the redirect
command and the message is sent back out. (This is not an MUA-style command and the message is sent back out. (This is not an MUA-style
forward, which creates a new message with a different sender and forward, which creates a new message with a different sender and
message ID, wrapping the old message in a new one.) message ID, wrapping the old message in a new one.)
The envelope sender address on the outgoing message is chosen by the
sieve implementation. It MAY be copied from the original message.
A simple script can be used for redirecting all mail: A simple script can be used for redirecting all mail:
Example: redirect "bart@example.edu"; Example: redirect "bart@example.edu";
Implementations SHOULD take measures to implement loop control, Implementations SHOULD take measures to implement loop control,
possibly including adding headers to the message or counting received possibly including adding headers to the message or counting received
headers. If an implementation detects a loop, it causes an error. headers. If an implementation detects a loop, it causes an error.
4.3. Action keep 4.3. Action keep
Usage: keep Usage: keep
The "keep" action is whatever action is taken in lieu of all other The "keep" action is whatever action is taken in lieu of all other
actions, if no filtering happens at all; generally, this simply means actions, if no filtering happens at all; generally, this simply means
to file the message into the user's main mailbox. This command to file the message into the user's main mailbox. This command
provides a way to execute this action without needing to know the provides a way to execute this action without needing to know the
name of the user's main mailbox, providing a way to call it without name of the user's main mailbox, providing a way to call it without
needing to understand the user's setup, or the underlying mail needing to understand the user's setup, or the underlying mail
system. system.
skipping to change at page 21, line 14 skipping to change at page 21, line 32
Usage: keep Usage: keep
The "keep" action is whatever action is taken in lieu of all other The "keep" action is whatever action is taken in lieu of all other
actions, if no filtering happens at all; generally, this simply means actions, if no filtering happens at all; generally, this simply means
to file the message into the user's main mailbox. This command to file the message into the user's main mailbox. This command
provides a way to execute this action without needing to know the provides a way to execute this action without needing to know the
name of the user's main mailbox, providing a way to call it without name of the user's main mailbox, providing a way to call it without
needing to understand the user's setup, or the underlying mail needing to understand the user's setup, or the underlying mail
system. system.
For instance, in an implementation where the Internet Message Access For instance, in an implementation where the IMAP server is running
Protocol (IMAP) server is running scripts on behalf of the user at scripts on behalf of the user at time of delivery, a keep command is
time of delivery, a keep command is equivalent to a fileinto "INBOX". equivalent to a fileinto "INBOX".
Example: if size :under 1M { keep; } else { discard; } Example: if size :under 1M { keep; } else { discard; }
Note that the above script is identical to the one below. Note that the above script is identical to the one below.
Example: if not size :under 1M { discard; } Example: if not size :under 1M { discard; }
4.4. Action discard 4.4. Action discard
Usage: discard Usage: discard
skipping to change at page 22, line 20 skipping to change at page 22, line 37
Implementations MUST support these tests: "address", "allof", Implementations MUST support these tests: "address", "allof",
"anyof", "exists", "false", "header", "not", "size", and "true". "anyof", "exists", "false", "header", "not", "size", and "true".
Implementations SHOULD support the "envelope" test. Implementations SHOULD support the "envelope" test.
5.1. Test address 5.1. Test address
Usage: address [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE] Usage: address [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE]
<header-list: string-list> <key-list: string-list> <header-list: string-list> <key-list: string-list>
The address test matches Internet addresses in structured headers The "address" test matches Internet addresses in structured headers
that contain addresses. It returns true if any header contains any that contain addresses. It returns true if any header contains any
key in the specified part of the address, as modified by the key in the specified part of the address, as modified by the
comparator and the match keyword. Whether there are other addresses comparator and the match keyword. Whether there are other addresses
present in the header doesn't affect this test; this test does not present in the header doesn't affect this test; this test does not
provide any way to determine whether an address is the only address provide any way to determine whether an address is the only address
in a header. in a header.
Like envelope and header, this test returns true if any combination Like envelope and header, this test returns true if any combination
of the header-list and key-list arguments match and false otherwise. of the header-list and key-list arguments match and false otherwise.
skipping to change at page 23, line 4 skipping to change at page 23, line 22
Implementations MUST restrict the address test to headers that Implementations MUST restrict the address test to headers that
contain addresses, but MUST include at least From, To, Cc, Bcc, contain addresses, but MUST include at least From, To, Cc, Bcc,
Sender, Resent-From, Resent-To, and SHOULD include any other header Sender, Resent-From, Resent-To, and SHOULD include any other header
that utilizes an "address-list" structured header body. that utilizes an "address-list" structured header body.
Example: if address :is :all "from" "tim@example.com" { Example: if address :is :all "from" "tim@example.com" {
discard; discard;
} }
5.2. Test allof 5.2. Test allof
Usage: allof <tests: test-list> Usage: allof <tests: test-list>
The allof test performs a logical AND on the tests supplied to it. The "allof" test performs a logical AND on the tests supplied to it.
Example: allof (false, false) => false Example: allof (false, false) => false
allof (false, true) => false allof (false, true) => false
allof (true, true) => true allof (true, true) => true
The allof test takes as its argument a test-list. The allof test takes as its argument a test-list.
5.3. Test anyof 5.3. Test anyof
Usage: anyof <tests: test-list> Usage: anyof <tests: test-list>
The anyof test performs a logical OR on the tests supplied to it. The "anyof" test performs a logical OR on the tests supplied to it.
Example: anyof (false, false) => false Example: anyof (false, false) => false
anyof (false, true) => true anyof (false, true) => true
anyof (true, true) => true anyof (true, true) => true
5.4. Test envelope 5.4. Test envelope
Usage: envelope [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE] Usage: envelope [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE]
<envelope-part: string-list> <key-list: string-list> <envelope-part: string-list> <key-list: string-list>
The "envelope" test is true if the specified part of the SMTP (or The "envelope" test is true if the specified part of the SMTP (or
equivalent) envelope matches the specified key. This specification equivalent) envelope matches the specified key. This specification
defines the interpretation of the (case insensitive) "from" and "to" defines the interpretation of the (case insensitive) "from" and "to"
envelope-parts. Additional envelope-parts may be defined by other envelope-parts. Additional envelope-parts may be defined by other
extensions; implementations SHOULD consider unknown envelope parts an extensions; implementations SHOULD consider unknown envelope parts an
error. error.
If one of the envelope-part strings is (case insensitive) "from", If one of the envelope-part strings is (case insensitive) "from",
then matching occurs against the FROM address used in the SMTP MAIL then matching occurs against the FROM address used in the SMTP MAIL
command. command. The null reverse-path is matched against as the empty
string, regardless of the ADDRESS-PART argument specified.
If one of the envelope-part strings is (case insensitive) "to", then If one of the envelope-part strings is (case insensitive) "to", then
matching occurs against the TO address used in the SMTP RCPT command matching occurs against the TO address used in the SMTP RCPT command
that resulted in this message getting delivered to this user. Note that resulted in this message getting delivered to this user. Note
that only the most recent TO is available, and only the one relevant that only the most recent TO is available, and only the one relevant
to this user. to this user.
The envelope-part is a string list and may contain more than one The envelope-part is a string list and may contain more than one
parameter, in which case all of the strings specified in the key-list parameter, in which case all of the strings specified in the key-list
are matched against all parts given in the envelope-part list. are matched against all parts given in the envelope-part list.
skipping to change at page 27, line 12 skipping to change at page 27, line 33
envelope The string "envelope" indicates that the implementation envelope The string "envelope" indicates that the implementation
supports the "envelope" command. supports the "envelope" command.
fileinto The string "fileinto" indicates that the implementation fileinto The string "fileinto" indicates that the implementation
supports the "fileinto" command. supports the "fileinto" command.
comparator- The string "comparator-elbonia" is provided if the comparator- The string "comparator-elbonia" is provided if the
implementation supports the "elbonia" comparator. implementation supports the "elbonia" comparator.
Therefore, all implementations have at least the Therefore, all implementations have at least the
"comparator-i;octet", "comparator-en;ascii-casemap", "comparator-i;octet"
and "comparator-i;ascii-casemap" capabilities. However, and "comparator-i;ascii-casemap" capabilities. However,
these comparators may be used without being declared these comparators may be used without being declared
with require. with require.
6.2. IANA Considerations 6.2. IANA Considerations
In order to provide a standard set of extensions, a registry is In order to provide a standard set of extensions, a registry is
provided by IANA. Capability names may be registered on a first- provided by IANA. Capability names may be registered on a first-
come, first-served basis. Extensions designed for interoperable use come, first-served basis. Extensions designed for interoperable use
SHOULD be defined as standards track or IESG approved experimental SHOULD be defined as standards track or IESG approved experimental
RFCs. RFCs.
6.2.1. Template for Capability Registrations 6.2.1. Template for Capability Registrations
The following template is to be used for registering new Sieve The following template is to be used for registering new Sieve
extensions with IANA. extensions with IANA.
To: iana@iana.org To: iana@iana.org
Subject: Registration of new Sieve extension Subject: Registration of new Sieve extension
Capability name: Capability name: [the string for use in the 'require' statement]
Capability keyword: Description: [a brief description of what the extension adds
Capability arguments: or changes]
Standards Track/IESG-approved experimental RFC number: RFC number: [for extensions published as RFCs]
Person and email address to contact for further information: Contact address: [email and/or physical address to contact for
additional information]
6.2.2. Initial Capability Registrations 6.2.2. Initial Capability Registrations
This RFC updates the the following entries in the IANA registry for This RFC updates the the following entries in the IANA registry for
Sieve extensions. Sieve extensions.
Capability name: fileinto Capability name: fileinto
Capability keyword: fileinto Description: adds the 'fileinto' action
Capability arguments: fileinto <folder: string> RFC number: this RFC (Sieve base spec)
Standards Track/IESG-approved experimental RFC number: Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
This RFC (Sieve base spec)
Person and email address to contact for further information:
The Sieve discussion list <ietf-mta-filters@imc.org>
Capability name: envelope Capability name: envelope
Capability keyword: envelope Description: adds the 'envelope' test
Capability arguments: RFC number: this RFC (Sieve base spec)
envelope [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE] Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
<envelope-part: string-list> <key-list: string-list>
Standards Track/IESG-approved experimental RFC number:
This RFC (Sieve base spec)
Person and email address to contact for further information:
The Sieve discussion list <ietf-mta-filters@imc.org>
Capability name: comparator-* Capability name: comparator-* (anything starting with "comparator-")
Capability keyword: Description: adds the indication comparator for use with the
comparator-* (anything starting with "comparator-") :comparator argument
Capability arguments: (none) RFC number: this RFC (Sieve base spec)
Standards Track/IESG-approved experimental RFC number: Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
This RFC, Sieve, by reference to [COLLATION]
Person and email address to contact for further information:
The Sieve discussion list <ietf-mta-filters@imc.org>
6.3. Capability Transport 6.3. Capability Transport
As the range of mail systems that this document is intended to apply As the range of mail systems that this document is intended to apply
to is quite varied, a method of advertising which capabilities an to is quite varied, a method of advertising which capabilities an
implementation supports is difficult due to the wide range of implementation supports is difficult due to the wide range of
possible implementations. Such a mechanism, however, should have the possible implementations. Such a mechanism, however, should have the
property that the implementation can advertise the complete set of property that the implementation can advertise the complete set of
extensions that it supports. extensions that it supports.
7. Transmission 7. Transmission
The MIME type for a Sieve script is "application/sieve". The [MIME] type for a Sieve script is "application/sieve".
The registration of this type for RFC 2048 requirements is updated as The registration of this type for RFC 2048 requirements is updated as
follows: follows:
Subject: Registration of MIME media type application/sieve Subject: Registration of MIME media type application/sieve
MIME media type name: application MIME media type name: application
MIME subtype name: sieve MIME subtype name: sieve
Required parameters: none Required parameters: none
Optional parameters: none Optional parameters: none
Encoding considerations: Most sieve scripts will be textual, Encoding considerations: Most sieve scripts will be textual,
written in UTF-8. When non-7bit characters are used, written in UTF-8. When non-7bit characters are used,
quoted-printable is appropriate for transport systems quoted-printable is appropriate for transport systems
that require 7bit encoding. that require 7bit encoding.
Security considerations: Discussed in section 10 of this RFC. Security considerations: Discussed in section 10 of this RFC.
skipping to change at page 30, line 7 skipping to change at page 30, line 18
The lexical structure of sieve is defined in the following grammar The lexical structure of sieve is defined in the following grammar
(as described in [ABNF]): (as described in [ABNF]):
bracket-comment = "/*" *not-star 1*STAR bracket-comment = "/*" *not-star 1*STAR
*(not-star-slash *not-star 1*STAR) "/" *(not-star-slash *not-star 1*STAR) "/"
; No */ allowed inside a comment. ; No */ allowed inside a comment.
; (No * is allowed unless it is the last ; (No * is allowed unless it is the last
; character, or unless it is followed by a ; character, or unless it is followed by a
; character that isn't a slash.) ; character that isn't a slash.)
STAR = "*" comment = bracket-comment / hash-comment
not-star = CRLF / %x01-09 / %x0b-0c / %x0e-29 / %x2b-7f / hash-comment = "#" *not-crlf CRLF
identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_")
multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF)
*(multiline-literal / multiline-dotstuff)
"." CRLF
multiline-literal = [octet-not-period *octet-not-crlf] CRLF
multiline-dotstuff = "." 1*octet-not-crlf CRLF
; A line containing only "." ends the
; multi-line. Remove a leading '.' if
; followed by another '.'.
not-crlf = %x01-09 / %x0B-0C / %x0E-7F /
UTF8-2 / UTF8-3 / UTF8-4
; a single UTF-8 character other than NUL,
; CR, or LF
not-star = CRLF / %x01-09 / %x0B-0C / %x0E-29 / %x2B-7F /
UTF8-2 / UTF8-3 / UTF8-4 UTF8-2 / UTF8-3 / UTF8-4
; either a CRLF pair, OR a single UTF-8 ; either a CRLF pair, OR a single UTF-8
; character other than NUL, CR, LF, or star ; character other than NUL, CR, LF, or star
not-star-or-slash = CRLF / %x01-09 / %x0b-0c / %x0e-29 / %x2b-2e / not-star-or-slash = CRLF / %x01-09 / %x0B-0C / %x0E-29 / %x2B-2E /
%x30-7f / UTF8-2 / UTF8-3 / UTF8-4 %x30-7F / UTF8-2 / UTF8-3 / UTF8-4
; either a CRLF pair, OR a single UTF-8 ; either a CRLF pair, OR a single UTF-8
; character other than NUL, CR, LF, star, ; character other than NUL, CR, LF, star,
; or slash ; or slash
UTF8-NOT-CRLF = %x01-09 / %x0b-0c / %x0e-7f / number = 1*DIGIT [ QUANTIFIER ]
UTF8-2 / UTF8-3 / UTF8-4 octet-not-crlf = %x01-09 / %x0B-0C / %x0E-FF
; a single UTF-8 character other than NUL, ; a single octet other than NUL, CR, or LF
; CR, or LF
UTF8-NOT-PERIOD = %x01-09 / %x0b-0c / %x0e-2d / %x2f-7f / octet-not-period = %x01-09 / %x0B-0C / %x0E-2D / %x2F-FF
UTF8-2 / UTF8-3 / UTF8-4 ; a single octet other than NUL,
; a single UTF-8 character other than NUL,
; CR, LF, or period ; CR, LF, or period
UTF8-NOT-NUL = %x01-7f / UTF8-2 / UTF8-3 / UTF8-4 octet-not-qspecial = %x01-09 / %x0B-0C / %x0E-21 / %x23-5B / %x5D-FF
; a single UTF-8 character other than NUL ; a single octet other than NUL,
UTF8-NOT-QSPECIAL = %x01-09 / %x0b-0c / %x0e-21 / %x23-5b /
%x5d-7f / UTF8-2 / UTF8-3 / UTF8-4
; a single UTF-8 character other than NUL,
; CR, LF, double-quote, or backslash ; CR, LF, double-quote, or backslash
comment = bracket-comment / hash-comment
hash-comment = "#" *UTF8-NOT-CRLF CRLF
identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_")
tag = ":" identifier
number = 1*DIGIT [QUANTIFIER]
QUANTIFIER = "K" / "M" / "G" QUANTIFIER = "K" / "M" / "G"
quoted-safe = CRLF / UTF8-NOT-QSPECIAL quoted-other = "\" octet-not-qspecial
; represents just the octet-no-qspecial
; character. SHOULD NOT be used
quoted-safe = CRLF / octet-not-qspecial
; either a CRLF pair, OR a single UTF-8 ; either a CRLF pair, OR a single UTF-8
; character other than NUL, CR, LF, ; character other than NUL, CR, LF,
; double-quote, or backslash ; double-quote, or backslash
quoted-special = "\" ( DQUOTE / "\" ) quoted-special = "\" ( DQUOTE / "\" )
; represents just a double-quote or backslash ; represents just a double-quote or backslash
quoted-other = "\" UTF8-NOT-QSPECIAL
; represents just the UTF8-NOT-QSPECIAL
; character. SHOULD NOT be used
quoted-text = *(quoted-safe / quoted-special / quoted-other)
quoted-string = DQUOTE quoted-text DQUOTE quoted-string = DQUOTE quoted-text DQUOTE
multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF) quoted-text = *(quoted-safe / quoted-special / quoted-other)
*(multiline-literal / multiline-dotstuff)
"." CRLF
multiline-literal = [UTF8-NOT-PERIOD *UTF8-NOT-CRLF] CRLF STAR = "*"
multiline-dotstuff = "." 1*UTF8-NOT-CRLF CRLF tag = ":" identifier
; A line containing only "." ends the
; multi-line. Remove a leading '.' if
; followed by another '.'.
white-space = 1*(SP / CRLF / HTAB) / comment white-space = 1*(SP / CRLF / HTAB) / comment
8.2. Grammar 8.2. Grammar
The following is the grammar of Sieve after it has been lexically The following is the grammar of Sieve after it has been lexically
interpreted. No white space or comments appear below. The start interpreted. No white space or comments appear below. The start
symbol is "start". Non-terminals for MATCH-TYPE, COMPARATOR, and symbol is "start". Non-terminals for MATCH-TYPE, COMPARATOR, and
ADDRESS-PART are provided for use by extensions. ADDRESS-PART are provided for use by extensions.
ADDRESS-PART = ":localpart" / ":domain" / ":all"
argument = string-list / number / tag argument = string-list / number / tag
arguments = *argument [test / test-list] arguments = *argument [test / test-list]
block = "{" commands "}" block = "{" commands "}"
command = identifier arguments ( ";" / block ) command = identifier arguments ( ";" / block )
commands = *command commands = *command
COMPARATOR = ":comparator" string
MATCH-TYPE = ":is" / ":contains" / ":matches"
start = commands start = commands
string = quoted-string / multi-line string = quoted-string / multi-line
string-list = "[" string *("," string) "]" / string string-list = "[" string *("," string) "]" / string
; if there is only a single string, the brackets ; if there is only a single string, the brackets
; are optional ; are optional
test = identifier arguments test = identifier arguments
test-list = "(" test *("," test) ")" test-list = "(" test *("," test) ")"
ADDRESS-PART = ":localpart" / ":domain" / ":all"
COMPARATOR = ":comparator" string
MATCH-TYPE = ":is" / ":contains" / ":matches"
9. Extended Example 9. Extended Example
The following is an extended example of a Sieve script. Note that it The following is an extended example of a Sieve script. Note that it
does not make use of the implicit keep. does not make use of the implicit keep.
# #
# Example Sieve Filter # Example Sieve Filter
# Declare any optional features or extension used by the script # Declare any optional features or extension used by the script
# #
require ["fileinto"]; require ["fileinto"];
skipping to change at page 33, line 33 skipping to change at page 33, line 40
It is equally important that implementations sanity-check the user's It is equally important that implementations sanity-check the user's
scripts, and not allow users to create on-demand mailbombs. For scripts, and not allow users to create on-demand mailbombs. For
instance, an implementation that allows a user to redirect a message instance, an implementation that allows a user to redirect a message
multiple times might also allow a user to create a mailbomb triggered multiple times might also allow a user to create a mailbomb triggered
by mail from a specific user. Site- or implementation-defined limits by mail from a specific user. Site- or implementation-defined limits
on actions are useful for this. on actions are useful for this.
Several commands, such as "discard", "redirect", and "fileinto" allow Several commands, such as "discard", "redirect", and "fileinto" allow
for actions to be taken that are potentially very dangerous. for actions to be taken that are potentially very dangerous.
Use of the "redirect" command to generate notifications may easily
overwhelm the target address, especially if it was not designed to
handle large messages.
Implementations SHOULD take measures to prevent languages from Implementations SHOULD take measures to prevent languages from
looping. looping.
As with any filter on a message stream, if the sieve implementation As with any filter on a message stream, if the sieve implementation
and the mail agents 'behind' sieve in the message stream differ in and the mail agents 'behind' sieve in the message stream differ in
their interpretation of the messages, it may be possible for an their interpretation of the messages, it may be possible for an
attacker to subvert the filter. Of particular note are differences attacker to subvert the filter. Of particular note are differences
in the interpretation of malformed messages (e.g., missing or extra in the interpretation of malformed messages (e.g., missing or extra
syntax characters) or those that exhibit corner cases (e.g., NUL syntax characters) or those that exhibit corner cases (e.g., NUL
octects encoded via [MIME3]). octets encoded via [MIME3]).
11. Acknowledgments 11. Acknowledgments
This document has been revised in part based on comments and This document has been revised in part based on comments and
discussions that took place on and off the SIEVE mailing list. discussions that took place on and off the SIEVE mailing list.
Thanks to Cyrus Daboo, Ned Freed, Michael Haardt, Kjetil Torgrim Thanks to Cyrus Daboo, Ned Freed, Michael Haardt, Kjetil Torgrim
Homme, Barry Leiba, Mark E. Mallett, Alexey Melnikov, Rob Siemborski, Homme, Barry Leiba, Mark E. Mallett, Alexey Melnikov, Rob Siemborski,
and Nigel Swinson for reviews and suggestions. and Nigel Swinson for reviews and suggestions.
12. Editors' Addresses 12. Editors' Addresses
skipping to change at page 36, line 26 skipping to change at page 36, line 37
Funding for the RFC Editor function is currently provided by the Funding for the RFC Editor function is currently provided by the
Internet Society. Internet Society.
Append A. Change History Append A. Change History
This section will be replaced with a summary of the changes since RFC This section will be replaced with a summary of the changes since RFC
3028 when this document leaves the Internet-Draft stage. 3028 when this document leaves the Internet-Draft stage.
Open Issues: Open Issues:
1. Merge reject back in with textual changes to permit MDNs and - all existing IANA registrations need to be updated to match the
protocol level rejection modified template; just list them all here?
2. Should this recommend/require that fileinto map UTF-8 to mUTF-7 - does the MIME registration for application/sieve need to be
when working with an IMAP store? updated?
Changes from draft-ietf-sieve-3028bis-06.txt
1. Tweak wording of how :matches uses character definition
of comparator
2. Add security consideration regarding "redirect" as a notification
method
3. fileinto SHOULD reencode; mention IMAP's mUTF-7
4. en;ascii-casemap is gone; switch back to i;ascii-casemap
5. Permit non-UTF-8 octet sequences in strings
6. Sort grammar non-terminals
7. Syntactically invalid addresses don't match :localpart or :domain
8. The null return-path has empty address parts
9. Treat comparator result of "undefined" the same as "no-match"
10. Envelope sender on redirects is implementation defined
11. Change IANA registration template
Changes from draft-ietf-sieve-3028bis-05.txt Changes from draft-ietf-sieve-3028bis-05.txt
1. The specifics of what names are acceptable for fileinto and 1. The specifics of what names are acceptable for fileinto and
the handling of invalid names are both implementation-defined. the handling of invalid names are both implementation-defined
2. Update to draft-newman-i18n-comparator-07.txt 2. Update to draft-newman-i18n-comparator-07.txt
3. Adjust the example in 5.7 again 3. Adjust the example in 5.7 again
Changes from draft-ietf-sieve-3028bis-04.txt Changes from draft-ietf-sieve-3028bis-04.txt
1. Change "Syntax:" to "Usage:" 1. Change "Syntax:" to "Usage:"
2. Update ABNF reference to RFC 4234 2. Update ABNF reference to RFC 4234
3. Add non-terminals for MATCH-TYPE, COMPARATOR, and ADDRESS-PART 3. Add non-terminals for MATCH-TYPE, COMPARATOR, and ADDRESS-PART
4. Strip leading and trailing whitespace in the value being matched 4. Strip leading and trailing whitespace in the value being matched
by header by header
5. Collations operate on octets, not characters, and for character 5. Collations operate on octets, not characters, and for character
 End of changes. 50 change blocks. 
119 lines changed or deleted 144 lines changed or added

This html diff was produced by rfcdiff 1.32. The latest version is available from http://www.levkowetz.com/ietf/tools/rfcdiff/