draft-ietf-sieve-3028bis-00.txt   draft-ietf-sieve-3028bis-01.txt 
Network Working Group P. Guenther, Editor
Internet-Draft Sendmail, Inc. Internet-Draft Sendmail, Inc.
Expires: November 2005 May 2005 Expires: November 2005 May 2005
Sieve: An Email Filtering Language Sieve: An Email Filtering Language
draft-ietf-sieve-3028bis-00.txt draft-ietf-sieve-3028bis-01.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 8, line 18 skipping to change at page 7, line 32
matching, addresses, textual bodies, etc. Typically, short quoted matching, addresses, textual bodies, etc. Typically, short quoted
strings suffice for most uses, but a more convenient form is provided strings suffice for most uses, but a more convenient form is provided
for longer strings such as bodies of messages. for longer strings such as bodies of messages.
A quoted string starts and ends with a single double quote (the <"> A quoted string starts and ends with a single double quote (the <">
character, ASCII 34). A backslash ("\", ASCII 92) inside of a quoted character, ASCII 34). A backslash ("\", ASCII 92) inside of a quoted
string is followed by either another backslash or a double quote. string is followed by either another backslash or a double quote.
This two-character sequence represents a single backslash or double- This two-character sequence represents a single backslash or double-
quote within the string, respectively. quote within the string, respectively.
No other characters should be escaped with a single backslash. Scripts SHOULD NOT escape other characters with a backslash.
An undefined escape sequence (such as "\a" in a context where "a" has An undefined escape sequence (such as "\a" in a context where "a" has
no special meaning) is interpreted as if there were no backslash (in no special meaning) is interpreted as if there were no backslash (in
this case, "\a" is just "a"). this case, "\a" is just "a").
Non-printing characters such as tabs, CR and LF, and control Non-printing characters such as tabs, CR and LF, and control
characters are permitted in quoted strings. Quoted strings MAY span characters are permitted in quoted strings. Quoted strings MAY span
multiple lines. NUL (ASCII 0) is not allowed in strings. multiple lines. NUL (ASCII 0) is not allowed in strings.
For entering larger amounts of text, such as an email message, a For entering larger amounts of text, such as an email message, a
skipping to change at page 9, line 18 skipping to change at page 8, line 33
email addresses "me@example.com" or "me00@landru.example.edu". email addresses "me@example.com" or "me00@landru.example.edu".
Conversely, in any case where a list of strings is appropriate, a Conversely, in any case where a list of strings is appropriate, a
single string is allowed without being a member of a list: it is single string is allowed without being a member of a list: it is
equivalent to a list with a single member. This means that the test equivalent to a list with a single member. This means that the test
`exists "To"' is equivalent to the test `exists ["To"]'. `exists "To"' is equivalent to the test `exists ["To"]'.
2.4.2.2. Headers 2.4.2.2. Headers
Headers are a subset of strings. In the Internet Message Headers are a subset of strings. In the Internet Message
Specification [IMAIL] [RFC1123], each header line is allowed to have Specification [IMAIL], each header line is allowed to have whitespace
whitespace nearly anywhere in the line, including after the field nearly anywhere in the line, including after the field name and
name and before the subsequent colon. Extra spaces between the before the subsequent colon. Extra spaces between the header name
header name and the ":" in a header field are ignored. and the ":" in a header field are ignored.
A header name never contains a colon. The "From" header refers to a A header name never contains a colon. The "From" header refers to a
line beginning "From:" (or "From :", etc.). No header will match line beginning "From:" (or "From :", etc.). No header will match
the string "From:" due to the trailing colon. the string "From:" due to the trailing colon.
Folding of long header lines (as described in [IMAIL] 3.4.8) is Folding of long header lines (as described in [IMAIL] 2.2.3) is
removed prior to interpretation of the data. The folding syntax (the removed prior to interpretation of the data. The folding syntax (the
CRLF that ends a line plus any leading whitespace at the beginning of CRLF that ends a line plus any leading whitespace at the beginning of
the next line that indicates folding) are interpreted as if they were the next line that indicates folding) are interpreted as if they were
a single space. a single space.
2.4.2.3. Addresses 2.4.2.3. Addresses
A number of commands call for email addresses, which are also a A number of commands call for email addresses, which are also a
subset of strings. When these addresses are used in outbound subset of strings. When these addresses are used in outbound
contexts, addresses must be compliant with [IMAIL], but are further contexts, addresses must be compliant with [IMAIL], but are further
constrained. Using the symbols defined in [IMAIL], section 6.1, the constrained. Using the symbols defined in [IMAIL], section 3, the
syntax of an address is: syntax of an address is:
sieve-address = addr-spec ; simple address sieve-address = addr-spec ; simple address
/ phrase "<" addr-spec ">" ; name & addr-spec / phrase "<" addr-spec ">" ; name & addr-spec
That is, routes and group syntax are not permitted. If multiple That is, routes and group syntax are not permitted. If multiple
addresses are required, use a string list. Named groups are not used addresses are required, use a string list. Named groups are not used
here. here.
Implementations MUST ensure that the addresses are syntactically Implementations MUST ensure that the addresses are syntactically
skipping to change at page 12, line 22 skipping to change at page 11, line 38
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 "i;ascii-casemap" operator, i.e., case-insensitive done with the "en;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 12, line 46 skipping to change at page 12, line 13
The ":contains" match type describes a substring match. If the value The ":contains" match type describes a substring match. If the value
argument contains the key argument as a substring, the match is true. argument contains the key argument as a substring, the match is true.
For instance, the string "frobnitzm" contains "frob" and "nit", but For instance, the string "frobnitzm" contains "frob" and "nit", but
not "fbm". The null key ("") is contained in all values. not "fbm". The null 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 null key ":is" and only ":is" the null value. "frobnitzm". The null key ":is" and only ":is" the null value.
The ":matches" version specifies a wildcard match using the The ":matches" match type specifies a wildcard match using the
characters "*" and "?". "*" matches zero or more characters, and "?" characters "*" and "?"; the entire value must be matched. "*"
matches a single character. "?" and "*" may be escaped as "\\?" and matches zero or more characters, and "?" matches a single character.
"\\*" in strings to match against themselves. The first backslash "?" and "*" may be escaped as "\\?" and "\\*" in strings to match
escapes the second backslash; together, they escape the "*". This is against themselves. The first backslash escapes the second
awkward, but it is commonplace in several programming languages that backslash; together, they escape the "*". This is awkward, but it is
use globs and regular expressions. 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 may interact with comparators; in particular, some modifiers may interact with comparators; in particular, some
comparators are not suitable for matching with ":contains" or comparators are not suitable for matching with ":contains" or
":matches". It is an error to use a comparator with ":contains" or ":matches". It is an error to use a comparator with ":contains" or
":matches" that is not compatible with it. ":matches" that is not compatible with it.
skipping to change at page 13, line 51 skipping to change at page 13, line 19
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.
<< The [COLLATION] draft defines "en;ascii-casemap" and then notes
that Sieve and ACAP use "i;ascii-casemap" as a synonym. Should that
be removed from [1] and added here? Should Sieve do more to match
that draft? >>
While multiple comparator types are defined, only equality types are While multiple comparator types are defined, only equality types are
used in this specification. used in this specification.
All implementations MUST support the "i;octet" comparator (simply All implementations MUST support the "i;octet" comparator (simply
compares octets) and the "i;ascii-casemap" comparator (which treats compares octets), the "en;ascii-casemap" comparator (which treats
uppercase and lowercase characters in the ASCII subset of UTF-8 as uppercase and lowercase characters in the ASCII subset of UTF-8 as
the same). If left unspecified, the default is "i;ascii-casemap". the same), as well as the "i;ascii-casemap" comparator, which is a
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.
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
skipping to change at page 15, line 34 skipping to change at page 14, line 5
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 and i;ascii-casemap must be declared Comparators other than "i;octet", "en;ascii-casemap", and "i;ascii-
with require, as they are extensions. If a comparator declared with casemap" must be declared with require, as they are extensions. If a
require is not known, it is an error, and execution fails. If the comparator declared with require is not known, it is an error, and
comparator is not declared with require, it is also an error, even if execution fails. If the comparator is not declared with require, it
the comparator is supported. (See 2.10.5.) is also an 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 "i;ascii-casemap" comparators and may be used with "i;octet" and "en;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
skipping to change at page 17, line 33 skipping to change at page 15, line 51
Previous experience with filtering systems suggests that cases tend Previous experience with filtering systems suggests that cases tend
to be missed in scripts. To prevent errors, Sieve has an "implicit to be missed in scripts. To prevent errors, Sieve has an "implicit
keep". keep".
An implicit keep is a keep action (see 4.4) performed in absence of An implicit keep is a keep action (see 4.4) performed in absence of
any action that cancels the implicit keep. any action that cancels the implicit keep.
An implicit keep is performed if a message is not written to a An implicit keep is performed if a message is not written to a
mailbox, redirected to a new address, rejected, or explicitly thrown mailbox, redirected to a new address, rejected, or explicitly thrown
out. That is, if a fileinto, a keep, a redirect, or a discard is out. That is, if a fileinto, a keep, a redirect, a reject, or a
performed, an implicit keep is not. discard is performed, an implicit keep is not.
Some actions may be defined to not cancel the implicit keep. These Some actions may be defined to not cancel the implicit keep. These
actions may not directly affect the delivery of a message, and are actions may not directly affect the delivery of a message, and are
used for their side effects. None of the actions specified in this used for their side effects. None of the actions specified in this
document meet that criteria, but extension actions will. document meet that criteria, but extension actions will.
For instance, with any of the short messages offered above, the For instance, with any of the short messages offered above, the
following script produces no actions. following script produces no actions.
Example: if size :over 500K { discard; } Example: if size :over 500K { discard; }
skipping to change at page 23, line 27 skipping to change at page 21, line 40
Syntax: redirect <address: string> Syntax: redirect <address: string>
The "redirect" action is used to send the message to another user at The "redirect" action is used to send the message to another user at
a supplied address, as a mail forwarding feature does. The a supplied address, as a mail forwarding feature does. The
"redirect" action makes no changes to the message body or existing "redirect" action makes no changes to the message body or existing
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 command on the [SMTP] envelope is replaced with the one on the redirect
and the message is sent back out. (This is not an MUA-style forward, command and the message is sent back out. (This is not an MUA-style
which creates a new message with a different sender and message ID, forward, which creates a new message with a different sender and
wrapping the old message in a new one.) message ID, wrapping the old message in a new one.)
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.4. Action keep 4.4. Action keep
skipping to change at page 25, line 13 skipping to change at page 23, line 24
Implementations SHOULD support the "envelope" test. Implementations SHOULD support the "envelope" test.
5.1. Test address 5.1. Test address
Syntax: address [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE] Syntax: 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. comparator and the match keyword. Whether there are other addresses
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
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. of the header-list and key-list arguments match.
Internet email addresses [IMAIL] have the somewhat awkward Internet email addresses [IMAIL] have the somewhat awkward
characteristic that the local-part to the left of the at-sign is characteristic that the local-part to the left of the at-sign is
considered case sensitive, and the domain-part to the right of the considered case sensitive, and the domain-part to the right of the
at-sign is case insensitive. The "address" command does not deal at-sign is case insensitive. The "address" command does not deal
with this itself, but provides the ADDRESS-PART argument for allowing with this itself, but provides the ADDRESS-PART argument for allowing
users to deal with it. users to deal with it.
skipping to change at page 29, line 44 skipping to change at page 27, line 51
fileinto The string "fileinto" indicates that the implementation fileinto The string "fileinto" indicates that the implementation
supports the "fileinto" command. supports the "fileinto" command.
reject The string "reject" indicates that the implementation reject The string "reject" indicates that the implementation
supports the "reject" command. supports the "reject" 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" and "comparator-i;ascii-casemap" "comparator-i;octet", "comparator-en;ascii-casemap",
capabilities. However, these comparators may be used and "comparator-i;ascii-casemap" capabilities. However,
without being declared with require. these comparators may be used without being declared
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
skipping to change at page 30, line 29 skipping to change at page 28, line 31
Subject: Registration of new Sieve extension Subject: Registration of new Sieve extension
Capability name: Capability name:
Capability keyword: Capability keyword:
Capability arguments: Capability arguments:
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
Person and email address to contact for further information: Person and email address to contact for further information:
6.2.2. Initial Capability Registrations 6.2.2. Initial Capability Registrations
The following are to be added to the IANA registry for Sieve This RFC updates the the following entries in the IANA registry for
extensions as the initial contents of the capability registry. Sieve extensions.
Capability name: fileinto Capability name: fileinto
Capability keyword: fileinto Capability keyword: fileinto
Capability arguments: fileinto <folder: string> Capability arguments: fileinto <folder: string>
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
RFC 3028 (Sieve base spec) This RFC (Sieve base spec)
Person and email address to contact for further information: Person and email address to contact for further information:
Tim Showalter Tim Showalter
tjs@mirapoint.com tjs@mirapoint.com
Capability name: reject Capability name: reject
Capability keyword: reject Capability keyword: reject
Capability arguments: reject <reason: string> Capability arguments: reject <reason: string>
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
RFC 3028 (Sieve base spec) This RFC (Sieve base spec)
Person and email address to contact for further information: Person and email address to contact for further information:
Tim Showalter Tim Showalter
tjs@mirapoint.com tjs@mirapoint.com
Capability name: envelope Capability name: envelope
Capability keyword: envelope Capability keyword: envelope
Capability arguments: Capability arguments:
envelope [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE] envelope [COMPARATOR] [ADDRESS-PART] [MATCH-TYPE]
<envelope-part: string-list> <key-list: string-list> <envelope-part: string-list> <key-list: string-list>
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
RFC 3028 (Sieve base spec) This RFC (Sieve base spec)
Person and email address to contact for further information: Person and email address to contact for further information:
Tim Showalter Tim Showalter
tjs@mirapoint.com tjs@mirapoint.com
Capability name: comparator-* Capability name: comparator-*
Capability keyword: Capability keyword:
comparator-* (anything starting with "comparator-") comparator-* (anything starting with "comparator-")
Capability arguments: (none) Capability arguments: (none)
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
RFC 3028, Sieve, by reference of This RFC, Sieve, by reference to [COLLATION]
RFC 2244, Application Configuration Access Protocol
Person and email address to contact for further information: Person and email address to contact for further information:
Tim Showalter Tim Showalter
tjs@mirapoint.com tjs@mirapoint.com
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 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 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 RFC 3028. Security considerations: Discussed in section 10 of this RFC.
Interoperability considerations: Discussed in section 2.10.5 Interoperability considerations: Discussed in section 2.10.5
of RFC 3028. of this RFC.
Published specification: RFC 3028. Published specification: this RFC.
Applications which use this media type: sieve-enabled mail servers Applications which use this media type: sieve-enabled mail servers
Additional information: Additional information:
Magic number(s): Magic number(s):
File extension(s): .siv File extension(s): .siv
Macintosh File Type Code(s): Macintosh File Type Code(s):
Person & email address to contact for further information: Person & email address to contact for further information:
See the discussion list at ietf-mta-filters@imc.org. See the discussion list at ietf-mta-filters@imc.org.
Intended usage: Intended usage:
COMMON COMMON
Author/Change controller: Author/Change controller:
See Author information in RFC 3028. See Author information in this RFC.
8. Parsing 8. Parsing
The Sieve grammar is separated into tokens and a separate grammar as The Sieve grammar is separated into tokens and a separate grammar as
most programming languages are. most programming languages are.
8.1. Lexical Tokens 8.1. Lexical Tokens
Sieve scripts are encoded in UTF-8. The following assumes a valid Sieve scripts are encoded in UTF-8. The following assumes a valid
UTF-8 encoding; special characters in Sieve scripts are all ASCII. UTF-8 encoding; special characters in Sieve scripts are all ASCII.
skipping to change at page 32, line 43 skipping to change at page 30, line 43
- identifiers - identifiers
- tags - tags
- numbers - numbers
- quoted strings - quoted strings
- multi-line strings - multi-line strings
- other separators - other separators
Blanks, horizontal tabs, CRLFs, and comments ("white space") are Blanks, horizontal tabs, CRLFs, and comments ("white space") are
ignored except as they separate tokens. Some white space is required ignored except as they separate tokens. Some white space is required
to separate otherwise adjacent tokens and in specific places in the to separate otherwise adjacent tokens and in specific places in the
multi-line strings. multi-line strings. CR and LF can only appear in CRLF pairs.
The other separators are single individual characters, and are The other separators are single individual characters, and are
mentioned explicitly in the grammar. mentioned explicitly in the grammar.
The lexical structure of sieve is defined in the following BNF (as The lexical structure of sieve is defined in the following grammar
described in [ABNF]): (as described in [ABNF]):
bracket-comment = "/*" *(CHAR-NOT-STAR / ("*" CHAR-NOT-SLASH)) "*/" bracket-comment = "/*" *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 = "*"
Currently, bracketed comments can contain bare CRs and NLs. Should
that be banned?
Also, the syntax doesn't actually permit asterisks at the end, such
as "/***/"; that will change once I work out a concise way to express
it.
>>
CHAR-NOT-DOT = %x01-09 / %x0b-0c / %x0e-2d / %x2f-7f / not-star = CRLF / %x01-09 / %x0b-0c / %x0e-29 / %x2b-7f /
UTF8-2 / UTF8-3 / UTF8-4 UTF8-2 / UTF8-3 / UTF8-4
; no dots, no CRLFs ; either a CRLF pair, OR a single UTF-8 character
; other than NUL, CR, LF, or star
CHAR-NOT-CRLF = %x01-09 / %x0b-0c / %x0e-7f / not-star-or-slash = CRLF / %x01-09 / %x0b-0c / %x0e-29 / %x2b-2e /
UTF8-2 / UTF8-3 / UTF8-4 %x30-7f / UTF8-2 / UTF8-3 / UTF8-4
; either a CRLF pair, OR a single UTF-8 character
; other than NUL, CR, LF, star, or slash
CHAR-NOT-SLASH = %x00-2e / %x30-7f / UTF8-NOT-CRLF = %x01-09 / %x0b-0c / %x0e-7f /
UTF8-2 / UTF8-3 / UTF8-4 UTF8-2 / UTF8-3 / UTF8-4
; a single UTF-8 character other than NUL,
; CR, or LF
CHAR-NOT-STAR = %x00-29 / %x2b-7f / UTF8-NOT-PERIOD = %x01-09 / %x0b-0c / %x0e-2d / %x2f-7f /
UTF8-2 / UTF8-3 / UTF8-4 UTF8-2 / UTF8-3 / UTF8-4
; a single UTF-8 character other than NUL,
; CR, LF, or period
UTF8-NOT-NUL = %x01-7f / UTF8-2 / UTF8-3 / UTF8-4
; a single UTF-8 character 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
comment = bracket-comment / hash-comment comment = bracket-comment / hash-comment
hash-comment = ( "#" *CHAR-NOT-CRLF CRLF ) hash-comment = "#" *UTF8-NOT-CRLF CRLF
identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_") identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_")
tag = ":" identifier tag = ":" identifier
number = 1*DIGIT [QUANTIFIER] number = 1*DIGIT [QUANTIFIER]
QUANTIFIER = "K" / "M" / "G" QUANTIFIER = "K" / "M" / "G"
quoted-string = DQUOTE *CHAR DQUOTE quoted-safe = CRLF / UTF8-NOT-QSPECIAL
; in general, \ CHAR inside a string maps ; either a CRLF pair, OR a single UTF-8
; to CHAR so \" maps to " and \\ maps ; character other than NUL, CR, LF,
; to \ note that newlines and other characters ; double-quote, or backslash
; are all allowed strings
<<need to move the escaping into the grammar>> quoted-special = "\" ( DQUOTE / "\" )
; 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
multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF) multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF)
*(multi-line-literal / multi-line-dotstuff) *(multiline-literal / multiline-dotstuff)
"." CRLF "." CRLF
multi-line-literal = [CHAR-NOT-DOT *CHAR-NOT-CRLF] CRLF
multi-line-dotstuff = "." 1*CHAR-NOT-CRLF CRLF multiline-literal = [UTF8-NOT-PERIOD *UTF8-NOT-CRLF] CRLF
;; A line containing only "." ends the multi-line.
;; Remove a leading '.' if followed by another '.'. multiline-dotstuff = "." 1*UTF8-NOT-CRLF CRLF
; 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". symbol is "start".
argument = string-list / number / tag argument = string-list / number / tag
skipping to change at page 34, line 31 skipping to change at page 33, line 4
block = "{" commands "}" block = "{" commands "}"
command = identifier arguments ( ";" / block ) command = identifier arguments ( ";" / block )
commands = *command commands = *command
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 ; if there is only a single string, the brackets
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) ")"
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.
skipping to change at page 36, line 26 skipping to change at page 34, line 47
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.
Implementations SHOULD take measures to prevent languages from Implementations SHOULD take measures to prevent languages from
looping. looping.
11. Acknowledgments 11. Acknowledgments
This document has been revised in part based on comments and
discussions that took place on and off the SIEVE mailing list.
Thanks to Cyrus Daboo, Ned Freed, Kjetil Torgrim Homme, Barry Leiba,
Mark E. Mallett, Alexey Melnikov, Rob Siemborski, and Nigel Swinson
for reviews and suggestions.
The editor gratefully acknowledges the extensive work of Tim The editor gratefully acknowledges the extensive work of Tim
Showalter as the author of the RFC 3028. Showalter as the author of the RFC 3028.
12. Author's Addresses 12. Editor's Addresses
Philip Guenther Philip Guenther
Sendmail, Inc. Sendmail, Inc.
6425 Christie St. Ste 400 6425 Christie St. Ste 400
Emeryville, CA 94608 Emeryville, CA 94608
Email: guenther+mtafilters@sendmail.com Email: guenther@sendmail.com
13. Normative References 13. Normative References
[ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", RFC 2234, November 1997. Specifications: ABNF", RFC 2234, November 1997.
[COLLATION] Newman, C. and M. Duerst, "Internet Application Protocol [COLLATION] Newman, C. and M. Duerst, "Internet Application Protocol
Collation Registry" draft-newman-i18n-comparator-03.txt Collation Registry" draft-newman-i18n-comparator-03.txt
(work in progress), October 2004. (work in progress), October 2004.
[IMAIL] Crocker, D., "Standard for the Format of ARPA Internet [IMAIL] P. Resnick, Ed., "Internet Message Format", RFC 2822,
Text Messages", STD 11, RFC 822, August 1982. April 2001.
[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message Extensions (MIME) Part One: Format of Internet Message
Bodies", RFC 2045, November 1996. Bodies", RFC 2045, November 1996.
[MDN] T. Hansen, Ed., G. Vaudreuil, Ed., "Message Disposition [MDN] T. Hansen, Ed., G. Vaudreuil, Ed., "Message Disposition
Notification", RFC 3798, May 2004. Notification", RFC 3798, May 2004.
[RFC1123] Braden, R., "Requirements for Internet Hosts -- [SMTP] J. Klensin, Ed., "Simple Mail Transfer Protocol", RFC
Application and Support", STD 3, RFC 1123, November 1989. 2821, April 2001.
[SMTP] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC
821, August 1982.
[UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO
10646", RFC 3629, November 2003. 10646", RFC 3629, November 2003.
14. Informative References 14. Informative References
[BINARY-SI] "Standard IEC 60027-2: Letter symbols to be used in [BINARY-SI] "Standard IEC 60027-2: Letter symbols to be used in
electrical technology - Part 2: Telecommunications and electrical technology - Part 2: Telecommunications and
electronics", January 1999. electronics", January 1999.
skipping to change at page 38, line 52 skipping to change at page 37, line 18
this standard. Please address the information to the IETF at ietf- this standard. Please address the information to the IETF at ietf-
ipr@ietf.org. ipr@ietf.org.
Acknowledgement Acknowledgement
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
Open Issues:
- pull 'reject' out of this doc? Whether or not that happens, the
security considerations for 'reject' need to be updated to
document the "joe job" problem
- should 'redirect' provide an argument for specifying the envelope sender
Changes from draft-ietf-sieve-3028bis-00.txt
1. More grammar corrections:
- permit /***/,
- remove ambiguity in finding end of bracket comment,
- require valid UTF-8,
- express quoting in the grammar
- ban bare CR and LF in all locations
2. Correct a bunch of whitespace and linewrapping nits
3. Update IMAIL and SMTP references RFC 2822 and RFC 2821
4. Require support for en;ascii-casemap comparator as well as the
old i;ascii-casemap. As with the old one, you do not need to
use 'require' to use the new comparator.
5. Update IANA considerations to update the existing registrations
to point at this doc instead of 3028.
6. Scripts SHOULD NOT contain superfluous backslashes
7. Update Acknowledgments
Changes from RFC 3028 Changes from RFC 3028
1. Split references into normative and informative 1. Split references into normative and informative
2. Update references to current versions of DSN, IMAP, MDN, and 2. Update references to current versions of DSN, IMAP, MDN, and
UTF-8 RFCs UTF-8 RFCs
3. Replace "e-mail" with "email" 3. Replace "e-mail" with "email"
4. Incorporate RFC 3028 errata 4. Incorporate RFC 3028 errata
5. The "reject" action cancels the implicit keep 5. The "reject" action cancels the implicit keep
6. Replace references to ACAP with references to the 6. Replace references to ACAP with references to the i18n-comparator
i18n-comparator draft. Further work is needed to completely draft. Further work is needed to completely sync with that draft.
sync with that draft.
7. Start to update grammar to only permit legal UTF-8 (incomplete) 7. Start to update grammar to only permit legal UTF-8 (incomplete)
and correct various other errors and typos and correct various other errors and typos
8. Update IPR broilerplate 8. Update IPR broilerplate to RFC 3978/3979
 End of changes. 

This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/