draft-ietf-sieve-imapflags-04.txt   draft-ietf-sieve-imapflags-05.txt 
Network Working Group Network Working Group
Internet Draft: Sieve -- IMAP flag Extension A. Melnikov Internet Draft: Sieve -- IMAP flag Extension A. Melnikov
Document: draft-ietf-sieve-imapflags-04.txt Isode Limited Document: draft-ietf-sieve-imapflags-05.txt Isode Limited
Expires: August 2006 February 2006 Expires: November 2006 May 2006
SIEVE Email Filtering: IMAP flag Extension SIEVE Email Filtering: IMAP flag Extension
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.
skipping to change at line 33 skipping to change at line 33
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
Abstract Abstract
Recent discussions have shown that it is desirable to set different Recent discussions have shown that it is desirable to set different
[IMAP] flags on message delivery. This can be done, for example, IMAP (RFC 3501) flags on message delivery. This can be done, for
by a Sieve interpreter that works as a part of a Mail Delivery example, by a Sieve interpreter that works as a part of a Mail
Agent. Delivery Agent.
This document describes an extension to the Sieve mail filtering This document describes an extension to the Sieve mail filtering
language for setting [IMAP] flags. The extension allows to set both language for setting IMAP flags. The extension allows to set both
[IMAP] system flags and [IMAP] keywords. IMAP system flags and IMAP keywords.
0. Meta-information on this draft 0. Meta-information on this draft
This information is intended to facilitate discussion. It will be This information is intended to facilitate discussion. It will be
removed when this document leaves the Internet-Draft stage. removed when this document leaves the Internet-Draft stage.
0.1. Discussion 0.1. Discussion
This draft defines an extension to the Sieve mail filtering This draft defines an extension to the Sieve mail filtering
language (RFC 3028) being discussed on the MTA Filters language (RFC 3028) being discussed on the MTA Filters
skipping to change at line 205 skipping to change at line 205
2. Added IANA Considerations section. 2. Added IANA Considerations section.
3. Clarified "hasflag" behaviour with :matches, :contains, etc. 3. Clarified "hasflag" behaviour with :matches, :contains, etc.
4. Added optional comparator field to "hasflag" test, for 4. Added optional comparator field to "hasflag" test, for
consistency with other extensions. consistency with other extensions.
5. Clarified interaction of hasflag with the relational extension. 5. Clarified interaction of hasflag with the relational extension.
0.14. Changes from draft-ietf-sieve-imapflags-04.txt
1. Extended an example in section 4.
2. Fixed several typos.
3. Changed some examples to show that some parameters are optional
(Cyrus)
4. Addressed comments raised during IESG evaluation, in particular:
Clarified that space is used as delimiter between flag names.
Described capabilities provided by the extension as they are
visible to end users.
1. Introduction 1. Introduction
This is an extension to the Sieve language defined by [SIEVE] for This is an extension to the Sieve language defined by [SIEVE] for
setting [IMAP] flags. It adds a new tagged argument to "keep" and setting [IMAP] flags. It adds a new tagged argument to "keep" and
"fileinto" that describes the list of flags that have to be set "fileinto" that describes the list of flags that have to be set
when the message is delivered to the specified mailbox. It also when the message is delivered to the specified mailbox. It also
adds several actions to help manipulate list of flags and a test adds several actions to help manipulate list of flags and a test
to check if a flag belongs to a list. to check if a flag belongs to a list.
From user's prospective this extension provides several
capabilities. First, it allows manipulation of sets of IMAP flags.
Second, it gives ability to associate a set of IMAP flags with
a message that is delivered to a mailstore using the keep/fileinto
actions. Third, it maintains an internal variable. The internal
variable contains the default flags that will be associated with
a message that is delivered using the keep, implicit keep or fileinto
actions, when the :flags tagged argument is not specified.
When the Sieve [VARIABLES] extension is also supported by the Sieve
engine, it enables support for multiple variables containing sets
of IMAP flags.
The capability string associated with extension defined in this The capability string associated with extension defined in this
document is "imap4flags". document is "imap4flags". All conformant implementations MUST
implement all Sieve actions (Setflag, Addflag, Removeflag),
the hasflag test and the :flags tagged argument described in this
document.
The "imap4flags" extension can be used with or without the The "imap4flags" extension can be used with or without the
"variables" extension [VARIABLES]. When the "variables" extension "variables" extension [VARIABLES]. When the "variables" extension
is enabled in a script using <require "variables">, the script can is enabled in a script using <require "variables">, the script can
use explicit variable names in setflag/addflag/removeflag actions use explicit variable names in setflag/addflag/removeflag actions
and hasflag test. See also section 3 for more details. When the and hasflag test. See also section 3 for more details. When the
"variables" extension is not enabled the explicit variable name "variables" extension is not enabled the explicit variable name
parameter to setflag/addflag/removeflag/hasflag MUST NOT be used parameter to setflag/addflag/removeflag/hasflag MUST NOT be used
and MUST cause an error according to [SIEVE]. and MUST cause an error according to [SIEVE].
2. Conventions used. 2. Conventions used.
Conventions for notations are as in [SIEVE] section 1.1, including Conventions for notations are as in [SIEVE] section 1.1, including
use of [KEYWORDS] and "Usage:" label for the definition of action use of "Usage:" label for the definition of action and tagged
and tagged arguments syntax. arguments syntax.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119.
2.1. General requirements for flag handling 2.1. General requirements for flag handling
The following notes apply to processing of Addflag and Removeflag The following notes apply to processing of Addflag/Removeflag/Setflag
actions, hasflag test and :flags tagged argument. actions, hasflag test and :flags tagged argument.
A Sieve interpreter MUST ignore empty strings (i.e. "") in a A Sieve interpreter MUST ignore empty strings (i.e. "") in a
list-of-flags parameter. list-of-flags parameter.
A string containing a space-separated list of flag names is
equivalent to a string list consisting of the flags. This requirement
is to simplify amalgamation of multiple flag lists.
The Sieve interpreter SHOULD check the list of flags for validity as The Sieve interpreter SHOULD check the list of flags for validity as
described by [IMAP] ABNF. In particular non-ASCII characters are not described by [IMAP] ABNF. In particular according to [IMAP] non-ASCII
allowed in flag names. However spaces MUST be always allowed. characters are not allowed in flag names. However spaces MUST be
Multiple spaces between flag names MUST be treated as a single space always allowed as delimiters in strings representing a list of flags.
character, leading and trailing spaces MUST be ignored. In such strings multiple spaces between flag names MUST be treated as
A string containing a space-separated list of flags is equivalent to a single space character, leading and trailing spaces MUST be
a string list consisting of the flags. The last requirement is to ignored.
simplify amalgamation of multiple flag lists.
If a flag validity check fails the flag MUST be ignored. If a flag validity check fails the flag MUST be ignored.
Note that it is not possible to use this extension to set or clear Note that it is not possible to use this extension to set or clear
the \Recent flag or any other special system flag which is not the \Recent flag or any other special system flag which is not
settable in [IMAP]. Any such flags MUST be ignored if included in settable in [IMAP]. Any such flags MUST be ignored if included in
a flag list. a flag list.
3. Actions 3. Actions
skipping to change at line 275 skipping to change at line 313
unaltered. For example, it may reorder the flags, alter the case of unaltered. For example, it may reorder the flags, alter the case of
the letters in them, or add or remove duplicates or extraneous the letters in them, or add or remove duplicates or extraneous
spaces. Scripts MUST NOT make assumptions about the ordering of spaces. Scripts MUST NOT make assumptions about the ordering of
flags in lists or the preservation of their case. flags in lists or the preservation of their case.
Note that the parameter specifying a variable name to setflag/ Note that the parameter specifying a variable name to setflag/
addflag/removeflag actions and the hasflag test is optional. If the addflag/removeflag actions and the hasflag test is optional. If the
parameter is not specified the actions operate on the internal parameter is not specified the actions operate on the internal
variable, which has the empty value when the script starts execution. variable, which has the empty value when the script starts execution.
If the SIEVE interpreter doesn't support the "variables" extension If the SIEVE interpreter doesn't support the "variables" extension
[VARIABLES], the presence of the variable name parameter MUST cause [VARIABLES], the presence of the variable name parameter will cause
runtime error. a runtime error [SIEVE].
The "addflag" action adds flags to an existing set. The "removeflag" The "addflag" action adds flags to an existing set. The "removeflag"
action removes flags from an existing set. The "setflag" action action removes flags from an existing set. The "setflag" action
replaces an existing set of flags with a new set. The "set" action replaces an existing set of flags with a new set. The "set" action
defined in [VARIABLES] can be used to replace an existing set of defined in [VARIABLES] can be used to replace an existing set of
flags with a new set as well. However it should be noted that the flags with a new set as well. However it should be noted that the
"set" action can't perform any flag reordering, duplicate "set" action can't perform any flag reordering, duplicate
elimination, etc. elimination, etc.
The :flags tagged argument to "keep" and "fileinto" The :flags tagged argument to "keep" and "fileinto"
actions is used to associate a set of flags actions is used to associate a set of flags
with the current message. If the :flags tagged argument is not with the current message. If the :flags tagged argument is not
specified with those 2 actions, the current value of the internal specified with those 2 actions, the current value of the internal
variable is used instead. The value of the internal variable variable is used instead. The value of the internal variable
also applies to the implicit keep. also applies to the implicit keep.
Note that when keep/fileinto is used multiple times in a script and Note that when keep/fileinto is used multiple times in a script and
duplicate message elimination is performed, the last flag list value duplicate message elimination is performed (as described in Section
MUST win. 2.10.3 of [SIEVE]), the last flag list value MUST win.
3.1. Setflag Action 3.1. Setflag Action
Usage: setflag [<variablename: string>] Usage: setflag [<variablename: string>]
<list-of-flags: string-list> <list-of-flags: string-list>
Setflag is used for setting [IMAP] system flags or keywords. Setflag is used for setting [IMAP] system flags or keywords.
Setflag replaces any previously set flags. Setflag replaces any previously set flags.
Example: if size :over 500K { Example: if size :over 500K {
setflag "flags" "\\Deleted"; setflag "\\Deleted";
} }
A more substantial example is: A more substantial example is:
Example: Example:
if header :contains "from" "boss@frobnitzm.example.edu" { if header :contains "from" "boss@frobnitzm.example.edu" {
setflag "flagvar" "\\Flagged"; setflag "flagvar" "\\Flagged";
fileinto :flags "${flagvar}" "INBOX.From Boss"; fileinto :flags "${flagvar}" "INBOX.From Boss";
} }
skipping to change at line 389 skipping to change at line 427
The default comparator is "i;ascii-casemap", which is the same The default comparator is "i;ascii-casemap", which is the same
case-insensitive comparison as defined for IMAP flags by [IMAP]. case-insensitive comparison as defined for IMAP flags by [IMAP].
The "relational" extension [RELATIONAL] adds a match type called The "relational" extension [RELATIONAL] adds a match type called
":count". The :count of a variable returns the number of distinct ":count". The :count of a variable returns the number of distinct
flags in it. The count of a list of variables is the sum of the flags in it. The count of a list of variables is the sum of the
counts of the member variables. counts of the member variables.
Example: Example:
If the variable "MyFlags" has the value "A B", the following test If the internal variable has the value "A B", the following test
hasflag :is "MyFlags" "b A" hasflag :is "b A"
evaluates to true. The above test can be also written as evaluates to true. The above test can be also written as
hasflag "MyFlags" ["b","A"] hasflag ["b","A"]
Example: Example:
If the variable "MyVar" has value "NonJunk Junk gnus-forward If the variable "MyVar" has value "NonJunk Junk gnus-forward
$Forwarded NotJunk JunkRecorded $Junk $NotJunk", the following $Forwarded NotJunk JunkRecorded $Junk $NotJunk", the following
tests evaluate to true: tests evaluate to true:
hasflag :contains "MyVar" "Junk" hasflag :contains "MyVar" "Junk"
hasflag :contains "MyVar" "forward" hasflag :contains "MyVar" "forward"
hasflag :contains "MyVar" ["label", "forward"] hasflag :contains "MyVar" ["label", "forward"]
hasflag :contains "MyVar" ["junk", "forward"] hasflag :contains "MyVar" ["junk", "forward"]
skipping to change at line 418 skipping to change at line 456
as as
hasflag :contains "MyVar" "junk forward" hasflag :contains "MyVar" "junk forward"
or or
hasflag :contains "MyVar" "forward junk" hasflag :contains "MyVar" "forward junk"
However the last two forms are not recommended. However the last two forms are not recommended.
And the following test will evaluate to false: And the following tests will evaluate to false:
hasflag :contains "MyVar" "label" hasflag :contains "MyVar" "label"
hasflag :contains "MyVar" "label" hasflag :contains "MyVar" ["label1", "label2"]
Example: Example:
If the variable "MyFlags" has the value "A B", the following test If the variable "MyFlags" has the value "A B", the following test
hasflag :count "ge" :comparator "i;ascii-numeric" hasflag :count "ge" :comparator "i;ascii-numeric"
"MyFlags" "2" "MyFlags" "2"
evaluates to true, as the variable contains 2 distinct flags. evaluates to true, as the variable contains 2 distinct flags.
5. Tagged argument :flags 5. Tagged argument :flags
skipping to change at line 471 skipping to change at line 509
are equivalent. are equivalent.
This document doesn't dictate how the Sieve interpreter will set This document doesn't dictate how the Sieve interpreter will set
the [IMAP] flags. In particular, the Sieve interpreter may work as the [IMAP] flags. In particular, the Sieve interpreter may work as
an IMAP client, or may have direct access to the mailstore. an IMAP client, or may have direct access to the mailstore.
6. Interaction with Other Sieve Actions 6. Interaction with Other Sieve Actions
This extension works only on the message that is currently being This extension works only on the message that is currently being
processed by Sieve, it doesn't affect another message generated processed by Sieve, it doesn't affect another message generated
as a side affect of any action. as a side effect of any action or any other message already in
the mailstore.
The extension decribed in this document doesn't change the implicit The extension described in this document doesn't change the implicit
keep (see section 2.10.2 of [SIEVE]). keep (see section 2.10.2 of [SIEVE]).
7. Other Considerations 7. Security Considerations
Security considerations are discussed in the [IMAP], [SIEVE] and
[VARIABLES].
This extension intentionally doesn't allow setting [IMAP] flags on This extension intentionally doesn't allow setting [IMAP] flags on
an arbitrary message in the [IMAP] message store. an arbitrary message in the [IMAP] message store.
8. Security Considerations
Security considerations are discussed in the [IMAP], [SIEVE] and
[VARIABLES].
It is believed that this extension doesn't introduce any additional It is believed that this extension doesn't introduce any additional
security concerns. security concerns.
9. IANA Considerations 8. IANA Considerations
The following template specifies the IANA registration of the The following template specifies the IANA registration of the
variables Sieve extension specified in this document: variables Sieve extension specified in this document:
To: iana@iana.org To: iana@iana.org
Subject: Registration of new Sieve extension Subject: Registration of new Sieve extension
Capability name: imap4flags Capability name: imap4flags
Capability keyword: imap4flags Capability keyword: imap4flags
Capability arguments: N/A Capability arguments: N/A
Standards Track/IESG-approved experimental RFC number: Standards Track/IESG-approved experimental RFC number:
this RFC this RFC
Person and email address to contact for further information: Person and email address to contact for further information:
Alexey Melnikov Alexey Melnikov
<alexey.melnikov@isode.com> <alexey.melnikov@isode.com>
This information should be added to the list of sieve extensions This information should be added to the list of sieve extensions
given on http://www.iana.org/assignments/sieve-extensions. given on http://www.iana.org/assignments/sieve-extensions.
10. Extended example 9. Extended example
# #
# 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", "imap4flags", "variables"]; require ["fileinto", "imap4flags", "variables"];
# #
# Move large messages to a special mailbox # Move large messages to a special mailbox
# #
skipping to change at line 578 skipping to change at line 616
remove "MyFlags" "\\Flagged"; remove "MyFlags" "\\Flagged";
fileinto :flags "${MyFlags}" "spam"; fileinto :flags "${MyFlags}" "spam";
} }
else else
{ {
# Move all other external mail to "personal" # Move all other external mail to "personal"
# folder. # folder.
fileinto :flags "${MyFlags}" "personal"; fileinto :flags "${MyFlags}" "personal";
} }
11. Acknowledgments 10. Acknowledgments
This document has been revised in part based on comments and This document has been revised in part based on comments and
discussions which took place on and off the Sieve mailing list. discussions which took place on and off the Sieve mailing list.
The help of those who took the time to review the draft and make The help of those who took the time to review the draft and make
suggestions is appreciated, especially that of Tim Showalter, suggestions is appreciated, especially that of Tim Showalter,
Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo, Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo,
Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson, Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson,
Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland, Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland,
Arnt Gulbrandsen and Philip Guenther. Arnt Gulbrandsen, Philip Guenther, Rob Austein, Sam Hartman,
Eric Gray and Cullen Jennings.
Special thanks to Tony Hansen and David Lamb for helping me Special thanks to Tony Hansen and David Lamb for helping me
better explain the concept. better explain the concept.
12. Author's Address 11. Author's Address
Alexey Melnikov Alexey Melnikov
Isode Limited Isode Limited
5 Castle Business Village 5 Castle Business Village
Hampton, Middlesex Hampton, Middlesex
United Kingdom, TW12 2BX United Kingdom, TW12 2BX
Email: alexey.melnikov@isode.com Email: alexey.melnikov@isode.com
13. Normative References 12. Normative References
[SIEVE] Guenther, P. and T. Showalter, "Sieve: An Email Filtering [SIEVE] Guenther, P. and T. Showalter, "Sieve: An Email Filtering
Language", work in progress, I-D draft-ietf-sieve-3028bis. Language", work in progress, I-D draft-ietf-sieve-3028bis.
[KEYWORDS] Bradner, S., "Keywords for use in RFCs to Indicate [KEYWORDS] Bradner, S., "Keywords for use in RFCs to Indicate
Requirement Levels", Harvard University, RFC 2119, March 1997. Requirement Levels", Harvard University, RFC 2119, March 1997.
[IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
4rev1", University of Washington, RFC 3501, March 2003. 4rev1", University of Washington, RFC 3501, March 2003.
[VARIABLES] Homme, K. T., "Sieve -- Variables Extension", University [VARIABLES] Homme, K. T., "Sieve -- Variables Extension", University
of Oslo, work in progress, draft-ietf-sieve-variables-XX.txt of Oslo, work in progress, draft-ietf-sieve-variables-XX.txt
[RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension: [RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension:
Relational Tests", Work in Progress, draft-ietf-sieve-3431bis-XX.txt Relational Tests", Work in Progress, draft-ietf-sieve-3431bis-XX.txt
14. Intellectual Property Statement 13. Intellectual Property Statement
The IETF takes no position regarding the validity or scope of any The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed Intellectual Property Rights or other rights that might be claimed
to pertain to the implementation or use of the technology to pertain to the implementation or use of the technology
described in this document or the extent to which any license described in this document or the extent to which any license
under such rights might or might not be available; nor does it under such rights might or might not be available; nor does it
represent that it has made any independent effort to identify any represent that it has made any independent effort to identify any
such rights. Information on the procedures with respect to rights such rights. Information on the procedures with respect to rights
in RFC documents can be found in BCP 78 and BCP 79. in RFC documents can be found in BCP 78 and BCP 79.
skipping to change at line 645 skipping to change at line 684
of such proprietary rights by implementers or users of this of such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository specification can be obtained from the IETF on-line IPR repository
at http://www.ietf.org/ipr. at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention The IETF invites any interested party to bring to its attention
any copyrights, patents or patent applications, or other any copyrights, patents or patent applications, or other
proprietary rights that may cover technology that may be required proprietary rights that may cover technology that may be required
to implement this standard. Please address the information to the to implement this standard. Please address the information to the
IETF at ietf-ipr@ietf.org. IETF at ietf-ipr@ietf.org.
15. Full Copyright Statement 14. Full Copyright Statement
Copyright (C) The Internet Society (2006). Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors contained in BCP 78, and except as set forth therein, the authors
retain all their rights. retain all their rights.
This document and the information contained herein are provided on This document and the information contained herein are provided on
an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE
REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND
 End of changes. 30 change blocks. 
43 lines changed or deleted 82 lines changed or added

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