idnits 2.17.1 draft-ietf-sieve-imapflags-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 13. -- Found old boilerplate from RFC 3978, Section 5.5 on line 581. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 551. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 558. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 564. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 1 longer page, the longest (page 1) being 616 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** There is 1 instance of too long lines in the document, the longest one being 1 character in excess of 72. ** The abstract seems to contain references ([IMAP]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 2006) is 6668 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'MATCH-TYPE' is mentioned on line 356, but not defined ** Obsolete normative reference: RFC 3501 (ref. 'IMAP') (Obsoleted by RFC 9051) -- No information found for draft-ietf-sieve-variables-XX - is the name correct? -- Possible downref: Normative reference to a draft: ref. 'VARIABLES' Summary: 7 errors (**), 0 flaws (~~), 5 warnings (==), 10 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group 2 Internet Draft: Sieve -- IMAP flag Extension A. Melnikov 3 Document: draft-ietf-sieve-imapflags-03.txt Isode Limited 4 Expires: July 2006 January 2006 6 SIEVE Email Filtering: IMAP flag Extension 8 Status of this memo 10 By submitting this Internet-Draft, each author represents that any 11 applicable patent or other IPR claims of which he or she is aware 12 have been or will be disclosed, and any of which he or she becomes 13 aware will be disclosed, in accordance with Section 6 of BCP 79. 15 Internet-Drafts are working documents of the Internet Engineering 16 Task Force (IETF), its areas, and its working groups. Note that 17 other groups may also distribute working documents as Internet-Drafts. 19 Internet-Drafts are draft documents valid for a maximum of six 20 months and may be updated, replaced, or obsoleted by other documents 21 at any time. It is inappropriate to use Internet-Drafts as reference 22 material or to cite them other than as "work in progress". 24 The list of current Internet-Drafts can be accessed at 25 http://www.ietf.org/ietf/1id-abstracts.txt 27 The list of Internet-Draft Shadow Directories can be accessed at 28 http://www.ietf.org/shadow.html. 30 Abstract 32 Recent discussions have shown that it is desirable to set different 33 [IMAP] flags on message delivery. This can be done, for example, 34 by a Sieve interpreter that works as a part of a Mail Delivery 35 Agent. 37 This document describes an extension to the Sieve mail filtering 38 language for setting [IMAP] flags. The extension allows to set both 39 [IMAP] system flags and [IMAP] keywords. 41 0. Meta-information on this draft 43 This information is intended to facilitate discussion. It will be 44 removed when this document leaves the Internet-Draft stage. 46 0.1. Discussion 48 This draft defines an extension to the Sieve mail filtering 49 language (RFC 3028) being discussed on the MTA Filters 50 mailing list at . Subscription requests 51 can be sent to (send an email 52 message with the word "subscribe" in the body). More information on 53 the mailing list along with a WWW archive of back messages is 54 available at . 56 0.2. Changes from the version submitted to the Sieve mailing list 58 1. Added addflag and removeflag actions 60 2. Changed the semantics of setflag (setflag is not additive any 61 more) 63 3. Corrected section "Interaction with Other Sieve Actions". 64 Removed incorrect reference to the forward action as to an 65 action that prohibits setflag. 67 4. Added paragraph about the mutual order of "fileinto"/"keep" and 68 "setflag"/"addflag"/"removeflag" actions. 70 0.3. Changes from the revision 00 72 1. Corrected Capability Identifier section (Section 2) 74 2. Corrected "Interaction with Other Sieve Actions" section 75 (Section 4) 77 3. Examples were updated to be compatible with Sieve-07 draft 79 4. Added "mark" and "unmark" actions 81 0.4. Changes from the revision 01 83 1. Some language fixes based on Tony Hansen comments 85 2. Clarified that the extension allows to set both IMAP System 86 Flags and Keywords 88 0.5. Changes from the revision 02 90 1. BugFix: all backslashes must be escaped 92 2. Added extended example and more detailed description of 93 "addflag"/"removeflag" additivity. 95 3. Minor example bugfixes 97 0.6. Changes from the revision 03 99 1. Added second way to specify flags to be set (via optional tagged 100 arguments). [Tim Showalter] 102 2. Rules for using Reject with imapflags relaxed. [Randall Gellens] 104 3. Removed ABNF section completely, added syntax description to 105 action definition. [Tim Showalter] 107 4. Cleaned up the example. [Ken Murchison] 109 5. Added FM (Flag Manupulation) acronym. 111 6. Clarified "mark"/"unmark" bahavior. [Randall Gellens] 113 0.7. Changes from the revision 04 115 1. "Interaction with Other Sieve Actions" was simplified based on 116 comments from Tim Showalter. Added sentence saying that 117 imapflags doesn't change an implicit keep. 119 2. Several editorial comments from Tim Showalter. 121 0.8. Changes from the revision 05 123 1. Updated copyright, author address, section numbers and references. 125 2. Added dependency on Sieve "variables" extension. 127 3. Several editorial comments from Matthew Elvey. 129 4. Removed "mark" and "unmark" actions. 131 5. Added "hasflag" test. 133 6. Dropped ":globalflags" 135 7. An invalid flag name doesn't cause a script execution failure 136 anymore, as imapflags now depends on variables and a variable 137 can have an arbitrary value. 139 0.9. Changes from the revision 06 (draft-ietf-sieve-imapflags-00.txt) 141 1. Updated boilerplate and references. 143 2. Fixed capability string in the extended example. 145 3. Improved implementation using macros (section 6). 147 0.10. Changes from draft-ietf-sieve-imapflags-00.txt 149 1. Added back the internal variable, made the variable parameter 150 to all actions optional. 152 2. Some editorial suggestions from Mark E. Mallett. 154 3. Updated boilerplate once again. 156 0.11. Changes from draft-ietf-sieve-imapflags-01.txt 158 1. Clarified that if "variables" is not available, then usage of 159 the explicit variable parameter causes a runtime error. 161 2. Clarified handling of spaces, in particular that leading/ 162 trailing spaces in a flag variable are to be ignored. 164 3. Clarified that the extension can't be used to set the \Recent 165 flag. 167 4. Made the variable list parameter to hasflag test optional, for 168 consistency with all actions. 170 5. Dropped the "Implementation Notes" section. 172 6. Fixed an error in section 5: when the :flags tagged argument is 173 not specified, the correct behavior is to use flags from the 174 internal variable. 176 7. Other minor editorial changes. 178 0.12. Changes from draft-ietf-sieve-imapflags-02.txt 180 1. Changed "Syntax:" label to "Usage:". 182 2. Updated the Introduction section to mention that hasflag also has 183 an optional parameter. 185 3. Clarified that a failure to store flags for a message is not 186 a runtime error. 188 4. Minor editorial nits from Philip 190 1. Introduction 192 This is an extension to the Sieve language defined by [SIEVE] for 193 setting [IMAP] flags. It adds a new tagged argument to "keep" and 194 "fileinto" that describes the list of flags that have to be set 195 when the message is delivered to the specified mailbox. It also 196 adds several actions to help manipulate list of flags and a test 197 to check if a flag belongs to a list. 199 The capability string associated with extension defined in this 200 document is "imap4flags". 202 The "imap4flags" extension can be used with or without the 203 "variables" extension [VARIABLES]. When the "variables" extension 204 is enabled in a script using , the script can 205 use explicit variable names in setflag/addflag/removeflag actions 206 and hasflag test. See also section 3 for more details. When the 207 "variables" extension is not enabled the explicit variable name 208 parameter to setflag/addflag/removeflag/hasflag MUST NOT be used 209 and MUST cause an error according to [SIEVE]. 211 2. Conventions used. 213 Conventions for notations are as in [SIEVE] section 1.1, including 214 use of [KEYWORDS] and "Usage:" label for the definition of action 215 and tagged arguments syntax. 217 2.1. General requirements for flag handling 219 The following notes apply to processing of Addflag and Removeflag 220 actions, hasflag test and :flags tagged argument. 222 A Sieve interpreter MUST ignore empty strings (i.e. "") in a 223 list-of-flags parameter. 225 The Sieve interpreter SHOULD check the list of flags for validity as 226 described by [IMAP] ABNF. In particular non-ASCII characters are not 227 allowed in flag names. However spaces MUST be always allowed. 228 Multiple spaces between flag names MUST be treated as a single space 229 character, leading and trailing spaces MUST be ignored. 230 A string containing a space-separated list of flags is equivalent to 231 a string list consisting of the flags. The last requirement is to 232 simplify amalgamation of multiple flag lists. 234 If a flag validity check fails the flag MUST be ignored. 236 Note that it is not possible to use this extension to set or clear 237 the \Recent flag or any other special system flag which is not 238 settable in [IMAP]. Any such flags MUST be ignored if included in 239 a flag list. 241 3. Actions 243 All actions described in this specification (setflag, addflag, 244 removeflag) operate on string variables that contain a set of [IMAP] 245 flags. On variable substitution a set of flags is represented as 246 a string containing space-separated list of flag names. 248 Any of setflag/addflag/removeflag action MAY alter the flag list in 249 any way that leaves its semantics as a set of case-insensitive words 250 unaltered. For example, it may reorder the flags, alter the case of 251 the letters in them, or add or remove duplicates or extraneous 252 spaces. Scripts MUST NOT make assumptions about the ordering of 253 flags in lists or the preservation of their case. 255 Note that the parameter specifying a variable name to setflag/ 256 addflag/removeflag actions and the hasflag test is optional. If the 257 parameter is not specified the actions operate on the internal 258 variable, which has the empty value when the script starts execution. 259 If the SIEVE interpreter doesn't support the "variables" extension 260 [VARIABLES], the present variable name parameter MUST cause runtime 261 error. 263 The "addflag" action adds flags to an existing set. The "removeflag" 264 action removes flags from an existing set. The "setflag" action 265 replaces an existing set of flags with a new set. The "set" action 266 defined in [VARIABLES] can be used to replace an existing set of 267 flags with a new set as well. However it should be noted that the 268 "set" action can't perform any flag reordering, duplicate 269 elimination, etc. 271 The :flags tagged argument to "keep" and "fileinto" 272 actions is used to associate a set of flags 273 with the current message. If the :flags tagged argument is not 274 specified with those 2 actions, the current value of the internal 275 variable is used instead. The value also applies to the implicit 276 keep. 278 Note that when keep/fileinto is used multiple times in a script and 279 duplicate message elimination is performed, the last flag list value 280 MUST win. 282 3.1. Setflag Action 284 Usage: setflag [] 285 287 Setflag is used for setting [IMAP] system flags or keywords. 288 Setflag replaces any previously set flags. 290 Example: if size :over 500K { 291 setflag "flags" "\\Deleted"; 292 } 294 A more substantial example is: 296 Example: 297 if header :contains "from" "boss@frobnitzm.example.edu" { 298 setflag "flagvar" "\\Flagged"; 299 fileinto :flags "${flagvar}" "INBOX.From Boss"; 300 } 302 3.2. Addflag action 304 Usage: addflag [] 305 307 Addflag is used to add flags to a list of [IMAP] flags. It doesn't 308 replace any previously set flags. This means that multiple 309 occurrences of addflag are treated additively. 311 The following examples demonstrate requirements described in 2.1. 312 The following two actions 314 addflag "flagvar" "\\Deleted"; 315 addflag "flagvar" "\\Answered"; 317 produce the same result as the single action 319 addflag "flagvar" ["\\Deleted", "\\Answered"]; 321 or 323 addflag "flagvar" "\\Deleted \\Answered"; 325 or 327 addflag "flagvar" "\\Answered \\Deleted"; 329 3.3. Removeflag Action 331 Usage: removeflag [] 332 334 Removeflag is used to remove flags from a list of [IMAP] flags. 335 Removeflag clears flags previously set by "set"/"addflag". Calling 336 removeflag with a flag that wasn't set before is not an error and 337 is ignored. Note, that if an implementation doesn't perform automatic 338 duplicate elimination, it MUST remove all occurences of the flags 339 specified in the second parameter to removeflag. Empty strings in the 340 list-of-flags MUST be ignored. Also note, that flag names are 341 case-insensitive, as described in [IMAP]. 342 Multiple removeflag actions are treated additively. 344 Example: 345 if header :contains "Disposition-Notification-To" 346 "mel@example.com" { 347 addflag "flagvar" "$MDNRequired"; 348 } 349 if header :contains "from" "imap@cac.washington.example.edu" { 350 removeflag "flagvar" "$MDNRequired"; 351 fileinto :flags "${flagvar}" "INBOX.imap-list"; 352 } 354 4. Test hasflag 356 Usage: hasflag [MATCH-TYPE] [] 357 359 The "hasflag" test evaluates to true if any of the variables matches 360 any flag name. The type of match defaults to ":is". 361 If the list of variables is omitted, value of the internal variable 362 is used instead. 364 Flagname comparisons is always done with the "i;ascii-casemap" 365 operator, i.e., case-insensitive comparisons, as defined in [IMAP]. 367 Example: 368 If the variable "MyFlags" has the value "A B", the following test 370 hasflag :is "MyFlags" "b A" 372 evaluates to true. The above test can be also written as 374 hasflag "MyFlags" ["b","A"] 376 5. Tagged argument :flags 378 This specification adds a new optional tagged argument ":flags" that 379 alter the behavior of actions "keep" and "fileinto". 381 The :flags tagged argument specifies that the flags provided in the 382 subsequent argument should be set when fileinto/keep delivers the 383 message to the target mailbox/user's main mailbox. If the :flags 384 tagged argument is not specified, "keep" or "fileinto" will use 385 the current value of the internal variable when delivering message 386 to the target mailbox. 388 Usage: ":flags" 390 The copy of the message filed into mailbox will have only flags 391 listed after the ":flags" tagged argument. 393 The Sieve interpreter MUST ignore all flags that it can't store 394 permanently. This means that the interpreter MUST NOT treat failure 395 to store any flag as a runtime failure to execute the Sieve 396 script. For example, if the mailbox "INBOX.From Boss" can't store any 397 flags, then 399 fileinto :flags "\\Deleted" "INBOX.From Boss"; 401 and 403 fileinto "INBOX.From Boss"; 405 are equivalent. 407 This document doesn't dictate how the Sieve interpreter will set 408 the [IMAP] flags. In particular, the Sieve interpreter may work as 409 an IMAP client, or may have direct access to the mailstore. 411 6. Interaction with Other Sieve Actions 413 This extension work only on the message that is currently being 414 processed by Sieve, it doesn't affect another message generated 415 as a side affect of any action. 417 The extension decribed in this document doesn't change the implicit 418 keep (see section 2.10.2 of [SIEVE]). 420 7. Other Considerations 422 This extension intentionally doesn't allow setting [IMAP] flags on 423 an arbitrary message in the [IMAP] message store. 425 8. Security Considerations 427 Security considerations are discussed in the [IMAP], [SIEVE] and 428 [VARIABLES]. 429 It is believed that this extension doesn't introduce any additional 430 security concerns. 432 9. Extended example 434 # 435 # Example Sieve Filter 436 # Declare any optional features or extension used by the script 437 # 438 require ["fileinto", "imap4flags", "variables"]; 440 # 441 # Move large messages to a special mailbox 442 # 443 if size :over 1M 444 { 445 addflag "MyFlags" "Big"; 446 if header :is "From" "boss@company.example.com" 447 { 448 # The message will be marked as "\Flagged Big" when filed into 449 # mailbox "Big messages" 450 addflag "MyFlags" "\\Flagged"; 451 } 452 fileinto :flags "${MyFlags}" "Big messages"; 453 } 455 if header :is "From" "grandma@example.net" 456 { 457 addflag "MyFlags" ["\\Answered", "$MDNSent"]; 458 # If the message is bigger than 1Mb it will be marked as 459 # "Big \Answered $MDNSent" when filed into mailbox "grandma". 460 # If the message is shorter than 1Mb it will be marked as 461 # "\Answered $MDNSent" 462 fileinto :flags "${MyFlags}" "GrandMa"; 463 } 465 # 466 # Handle messages from known mailing lists 467 # Move messages from IETF filter discussion list to filter folder 468 # 469 if header :is "Sender" "owner-ietf-mta-filters@example.org" 470 { 471 set "MyFlags" "\\Flagged $Work"; 472 # Message will have both "\Flagged" and $Work flags 473 keep :flags "${MyFlags}"; 474 } 476 # 477 # Keep all messages to or from people in my company 478 # 479 elsif anyof address :domain :is ["From", "To"] "company.example.com" 480 { 481 keep :flags "${MyFlags}"; # keep in "Inbox" folder 482 } 483 # 484 # Try and catch unsolicited email. If a message is not to me, 485 # or it contains a subject known to be spam, file it away. 486 # 487 elsif anyof (not address :all :contains 488 ["To", "Cc"] "me@company.example.com", 489 header :matches "subject" 490 ["*make*money*fast*", "*university*dipl*mas*"]) 491 { 492 remove "MyFlags" "\\Flagged"; 493 fileinto :flags "${MyFlags}" "spam"; 494 } 495 else 496 { 497 # Move all other external mail to "personal" 498 # folder. 499 fileinto :flags "${MyFlags}" "personal"; 500 } 502 10. Acknowledgments 504 This document has been revised in part based on comments and 505 discussions which took place on and off the Sieve mailing list. 507 The help of those who took the time to review the draft and make 508 suggestions is appreciated, especially that of Tim Showalter, 509 Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo, 510 Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson, 511 Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland, 512 Arnt Gulbrandsen and Philip Guenther. 514 Special thanks to Tony Hansen and David Lamb for helping me 515 better explain the concept. 517 11. Author's Address 519 Alexey Melnikov 520 Isode Limited 522 5 Castle Business Village 523 Hampton, Middlesex 524 United Kingdom, TW12 2BX 526 Email: alexey.melnikov@isode.com 528 12. Normative References 530 [SIEVE] Guenther, P. and T. Showalter, "Sieve: An Email Filtering 531 Language", work in progress, I-D draft-ietf-sieve-3028bis. 533 [KEYWORDS] Bradner, S., "Keywords for use in RFCs to Indicate 534 Requirement Levels", Harvard University, RFC 2119, March 1997. 536 [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 537 4rev1", University of Washington, RFC 3501, March 2003. 539 [VARIABLES] Homme, K. T., "Sieve -- Variables Extension", University 540 of Oslo, work in progress, draft-ietf-sieve-variables-XX.txt 542 13. Intellectual Property Statement 544 The IETF takes no position regarding the validity or scope of any 545 Intellectual Property Rights or other rights that might be claimed 546 to pertain to the implementation or use of the technology 547 described in this document or the extent to which any license 548 under such rights might or might not be available; nor does it 549 represent that it has made any independent effort to identify any 550 such rights. Information on the procedures with respect to rights 551 in RFC documents can be found in BCP 78 and BCP 79. 553 Copies of IPR disclosures made to the IETF Secretariat and any 554 assurances of licenses to be made available, or the result of an 555 attempt made to obtain a general license or permission for the use 556 of such proprietary rights by implementers or users of this 557 specification can be obtained from the IETF on-line IPR repository 558 at http://www.ietf.org/ipr. 560 The IETF invites any interested party to bring to its attention 561 any copyrights, patents or patent applications, or other 562 proprietary rights that may cover technology that may be required 563 to implement this standard. Please address the information to the 564 IETF at ietf-ipr@ietf.org. 566 14. Full Copyright Statement 568 Copyright (C) The Internet Society (2006). 570 This document is subject to the rights, licenses and restrictions 571 contained in BCP 78, and except as set forth therein, the authors 572 retain all their rights. 574 This document and the information contained herein are provided on 575 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 576 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND 577 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, 578 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT 579 THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR 580 ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 581 PARTICULAR PURPOSE. 583 Acknowledgement 585 Funding for the RFC Editor function is currently provided by the 586 Internet Society.