idnits 2.17.1 draft-ietf-sieve-mime-loop-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** The document seems to lack a License Notice according IETF Trust Provisions of 28 Dec 2009, Section 6.b.i or Provisions of 12 Sep 2009 Section 6.b -- however, there's a paragraph with a matching beginning. Boilerplate error? (You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Feb 2009 rather than one of the newer Notices. See https://trustee.ietf.org/license-info/.) Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 223 has weird spacing: '... :type for a...' == Line 229 has weird spacing: '...subtype for a...' == Line 234 has weird spacing: '...enttype for a...' == Line 240 has weird spacing: '... :param parse...' -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 13, 2009) is 5398 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: 'MIMEOPTS' is mentioned on line 184, but not defined == Missing Reference: 'COMPARATOR' is mentioned on line 305, but not defined == Missing Reference: 'MATCH-TYPE' is mentioned on line 306, but not defined == Missing Reference: 'ADDRESS-PART' is mentioned on line 306, but not defined == Missing Reference: 'MODIFIER' is mentioned on line 482, but not defined -- Obsolete informational reference (is this intentional?): RFC 1991 (Obsoleted by RFC 4880) -- Obsolete informational reference (is this intentional?): RFC 3851 (Obsoleted by RFC 5751) -- Obsolete informational reference (is this intentional?): RFC 4871 (Obsoleted by RFC 6376) Summary: 1 error (**), 0 flaws (~~), 11 warnings (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force T. Hansen 3 Internet-Draft AT&T Laboratories 4 Intended status: Standards Track C. Daboo 5 Expires: January 14, 2010 Apple Inc. 6 July 13, 2009 8 Sieve Email Filtering: MIME part Tests, Iteration, Extraction, 9 Replacement and Enclosure 10 draft-ietf-sieve-mime-loop-09 12 Status of this Memo 14 This Internet-Draft is submitted to IETF in full conformance with the 15 provisions of BCP 78 and BCP 79. This document may contain material 16 from IETF Documents or IETF Contributions published or made publicly 17 available before November 10, 2008. The person(s) controlling the 18 copyright in some of this material may not have granted the IETF 19 Trust the right to allow modifications of such material outside the 20 IETF Standards Process. Without obtaining an adequate license from 21 the person(s) controlling the copyright in such materials, this 22 document may not be modified outside the IETF Standards Process, and 23 derivative works of it may not be created outside the IETF Standards 24 Process, except to format it for publication as an RFC or to 25 translate it into languages other than English. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF), its areas, and its working groups. Note that 29 other groups may also distribute working documents as Internet- 30 Drafts. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 The list of current Internet-Drafts can be accessed at 38 http://www.ietf.org/ietf/1id-abstracts.txt. 40 The list of Internet-Draft Shadow Directories can be accessed at 41 http://www.ietf.org/shadow.html. 43 This Internet-Draft will expire on January 14, 2010. 45 Copyright Notice 47 Copyright (c) 2009 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents in effect on the date of 52 publication of this document (http://trustee.ietf.org/license-info). 53 Please review these documents carefully, as they describe your rights 54 and restrictions with respect to this document. 56 Abstract 58 This document defines extensions to the Sieve email filtering 59 language to permit analysis and manipulation of the MIME body parts 60 of an email message. 62 Note 64 This document is being discussed on the MTA-FILTERS mailing list, 65 ietf-mta-filters@imc.org. 67 Table of Contents 69 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 70 2. Conventions Used in This Document . . . . . . . . . . . . . . 4 71 3. Sieve Loops: Actions "foreverypart" and "break" . . . . . . . 4 72 4. Changes to Sieve Tests . . . . . . . . . . . . . . . . . . . . 5 73 4.1. Test "header" . . . . . . . . . . . . . . . . . . . . . . 5 74 4.2. Test "address" . . . . . . . . . . . . . . . . . . . . . 8 75 4.3. Test "exists" . . . . . . . . . . . . . . . . . . . . . . 9 76 5. Action "replace" . . . . . . . . . . . . . . . . . . . . . . . 9 77 6. Action "enclose" . . . . . . . . . . . . . . . . . . . . . . . 11 78 7. Action "extracttext" . . . . . . . . . . . . . . . . . . . . . 12 79 8. Sieve Capability Strings . . . . . . . . . . . . . . . . . . . 12 80 9. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 81 9.1. Example 1 . . . . . . . . . . . . . . . . . . . . . . . . 13 82 9.2. Example 2 . . . . . . . . . . . . . . . . . . . . . . . . 13 83 9.3. Example 3 . . . . . . . . . . . . . . . . . . . . . . . . 14 84 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 14 85 11. Security Considerations . . . . . . . . . . . . . . . . . . . 14 86 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 87 12.1. foreverypart capability . . . . . . . . . . . . . . . . . 15 88 12.2. mime capability . . . . . . . . . . . . . . . . . . . . . 16 89 12.3. replace capability . . . . . . . . . . . . . . . . . . . 16 90 12.4. enclose capability . . . . . . . . . . . . . . . . . . . 16 91 12.5. extracttext capability . . . . . . . . . . . . . . . . . 17 92 13. Change History . . . . . . . . . . . . . . . . . . . . . . . . 17 93 13.1. draft-ietf-sieve-mime-09 . . . . . . . . . . . . . . . . 17 94 13.2. draft-ietf-sieve-mime-08 . . . . . . . . . . . . . . . . 17 95 13.3. draft-ietf-sieve-mime-07 . . . . . . . . . . . . . . . . 18 96 13.4. draft-ietf-sieve-mime-06 . . . . . . . . . . . . . . . . 18 97 13.5. draft-ietf-sieve-mime-05 . . . . . . . . . . . . . . . . 18 98 13.6. draft-ietf-sieve-mime-04 . . . . . . . . . . . . . . . . 18 99 13.7. draft-ietf-sieve-mime-03 . . . . . . . . . . . . . . . . 19 100 13.8. draft-ietf-sieve-mime-02 . . . . . . . . . . . . . . . . 19 101 13.9. draft-ietf-sieve-mime-01 . . . . . . . . . . . . . . . . 19 102 13.10. draft-ietf-sieve-mime-00 . . . . . . . . . . . . . . . . 19 103 13.11. draft-sieve-mime-loop-04 . . . . . . . . . . . . . . . . 20 104 13.12. draft-hansen-sieve-loop-03 . . . . . . . . . . . . . . . 20 105 13.13. draft-hansen-sieve-loop-02 . . . . . . . . . . . . . . . 20 106 13.14. draft-hansen-sieve-loop-01 . . . . . . . . . . . . . . . 20 107 14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 21 108 14.1. Normative References . . . . . . . . . . . . . . . . . . 21 109 14.2. Informative References . . . . . . . . . . . . . . . . . 21 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 22 112 1. Introduction 114 MIME messages ([RFC2045]) are often complex objects, consisting of 115 many parts and sub-parts. This extension defines mechanisms for 116 performing tests on MIME body parts, looping through the MIME body 117 parts, extracting information from a MIME body part, changing the 118 contents of a MIME body part, and enclosing the entire message within 119 a wrapper. 121 2. Conventions Used in This Document 123 Conventions for notations are as in [RFC5228] section 1.1. 125 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 126 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 127 document are to be interpreted as described in [RFC2119]. 129 3. Sieve Loops: Actions "foreverypart" and "break" 131 The base Sieve language has no looping mechanism. Given that 132 messages may contain multiple parts, in order to support filters that 133 apply to any and all parts, we introduce a new control command: 134 "foreverypart", which is an iterator that walks though every MIME 135 part of a message, including nested parts, depth first, and applies 136 the commands in the specified block to each of them. The iterator 137 will start with the first MIME part (as its current context) and will 138 execute a command block (Sieve commands enclosed by {...}). Upon 139 completion of this command block, the iterator advances to the next 140 MIME part (as its current context) and executes the same command 141 block again. 143 The iterator can be terminated prematurely by a new Sieve command, 144 "break". 146 Usage: foreverypart [":name" string] block 148 Usage: break [":name" string]; 150 "foreverypart" commands can be nested inside other "foreverypart" 151 commands. When this occurs, the nested "foreverypart" iterates over 152 the MIME parts contained within the MIME part currently being 153 targeted by the nearest enclosing "foreverypart" command. (That is, 154 the inner loop only operates on children of the bodypart currently 155 accessed by the outer loop.) If that MIME part is a terminal MIME 156 part (i.e. does not contain other MIME parts) then the nested 157 "foreverypart" loop is simply ignored. 159 Sieve implementations MAY limit the number of nested loops that occur 160 within one another, however they MUST support at least one nested 161 loop inside another loop. 163 If a name is given to a "break" command, it terminates the closest 164 enclosing loop with the identical matching name. (If a nested 165 "foreverypart" name is the same as a "foreverpart" name in an outer 166 level, the outer level name is hidden.) It is an error if there is 167 no enclosing loop with that name. 169 4. Changes to Sieve Tests 171 This specification extends the base Sieve "header", "address" and 172 "exists" tests to support targeting those tests at a specific MIME 173 part or at all MIME parts in the enclosing scope. 175 4.1. Test "header" 177 The "header" test is extended with the addition of new ":mime" and 178 ":anychild" tagged arguments and their associated options. 180 Usage: header [":mime"] [":anychild"] [MIMEOPTS] 181 [COMPARATOR] [MATCH-TYPE] 182 184 Usage: The definition of [MIMEOPTS] is: 186 Syntax: ":type" / ":subtype" / ":contenttype" / 187 ":param" 189 When the ":mime" tagged argument is present in the "header" test, it 190 will parse the MIME header lines in the message so that tests can be 191 performed on specific elements. 193 When used outside the context of a "foreverypart" iterator, and 194 without an ":anychild" tagged argument, the "header" test will 195 examine only the outer top-level [RFC5322] headers of the message. 197 When used inside the context of a "foreverypart" iterator, and 198 without an ":anychild" tagged argument, the "header" test will 199 examine the headers associated with the current MIME part context 200 from the loop. 202 When used outside the context of a "foreverypart" iterator, and with 203 an ":anychild" tagged argument, the "header" test will examine all 204 MIME body parts and return true if any of them satisfies the test. 206 When used inside the context of a "foreverypart" iterator, and with 207 an ":anychild" tagged argument, the "header" test will examine the 208 current MIME part context and all its nested MIME body parts, 209 returning true if any of them satisfies the test. 211 The "header" test with the ":mime" tagged argument can test various 212 aspects of certain structured MIME headers. Implementations SHOULD 213 support desegmentation, decoding, and charset translation of 214 parameter values encoded according to [RFC2231] as part of this test. 215 Additionally, [RFC2047] describes a process whereby [RFC5322] headers 216 can be encoded in various ways. That encoding is not strictly 217 allowed in MIME parameters, however in practice it has been used in 218 many email implementations. So, SIEVE implementations MAY decode 219 [RFC2047] encoded words in parameter values as part of this test. 221 These options are available: 223 :type for a "Content-Type" MIME header field, parses and tests the 224 value of the MIME type specified in the header; for a "Content- 225 Disposition" MIME header field, parses and tests the value of the 226 disposition specified in the header; for other MIME headers, uses 227 a blank string for the test 229 :subtype for a "Content-Type" MIME header field, parses and tests 230 the value of the MIME subtype specified in the header; for a 231 "Content-Disposition" MIME header field, uses a blank string for 232 the test; for other MIME headers, uses a blank string for the test 234 :contenttype for a "Content-Type" MIME header field, parses and 235 tests the combined value of the MIME type and subtype specified in 236 the header; for a "Content-Disposition" MIME header field, behaves 237 the same as the :type option; for other MIME headers, uses a blank 238 string for the test 240 :param parses the header looking for MIME parameters in the header. 241 The supplied string-list lists the names of any parameters to be 242 tested. If any one named parameter value matches any of the test 243 string values, the test will return true. 245 When the :count option from [RFC5231] is used, the following applies: 247 a. for :type, :subtype or :contenttype, return a count of the number 248 of headers that parsed successfully 250 b. for :param, return a count of the number of parameters with the 251 given name that were found 253 Example: 255 require ["mime", "fileinto"]; 257 if header :mime :type "Content-Type" "image" 258 { 259 fileinto "INBOX.images"; 260 } 262 In this example, any message that contains a MIME image type part at 263 the top-level is saved to the mailbox "INBOX.images". 265 Example: 267 require ["mime", "fileinto"]; 269 if header :mime :anychild :contenttype 270 "Content-Type" "text/html" 271 { 272 fileinto "INBOX.html"; 273 } 275 In this example, any message that contains any MIME part with a 276 content-type of "text/html" is saved to the mailbox "INBOX.html". 278 Example: 280 require ["mime", "foreverypart", "fileinto"]; 282 foreverypart 283 { 284 if allof ( 285 header :mime :param "filename" :contains 286 "Content-Disposition" "important", 287 header :mime :subtype "Content-Type" "pdf", 288 size :over "100K") 289 { 290 fileinto "INBOX.important"; 291 break; 292 } 293 } 295 In this example, any message that contains a MIME part that has a 296 content-disposition with a filename parameter containing the text 297 "important", has a content-subtype of "pdf" and is bigger than 100 Kb 298 is saved to the mailbox "INBOX.important". 300 4.2. Test "address" 302 The "address" test is extended with the addition of new ":mime" and 303 ":anychild" tagged arguments and their associated options. 305 Usage: address [":mime"] [":anychild"] [COMPARATOR] 306 [ADDRESS-PART] [MATCH-TYPE] 307 309 When the ":mime" tagged argument is present in the "address" test, it 310 will parse the MIME header lines as if they were standard address 311 header lines in a message so that tests can be performed on specific 312 elements. 314 The behavior of the ":anychild" tagged argument and the interaction 315 with the "foreverypart" iterator is the same as for the extended 316 "header" test Section 4.1. 318 That is, 320 the use of "address" with no ":mime" and ":anychild" tagged 321 argument is the test defined in [RFC5228], i.e. it will *only* 322 operate on top level header fields, whether it is inside 323 "foreverypart" or not. 325 the use of "address" with ":mime" and no ":anychild" operates on 326 the current MIME part only (or on the top level header fields, if 327 outside "foreverypart") 329 the use of "address" with ":mime" and ":anychild" operates on the 330 current MIME part and all of its descendants 332 Example: 334 require ["mime", "fileinto"]; 336 if address :mime :is :all "content-from" "tim@example.com" 337 { 338 fileinto "INBOX.part-from-tim"; 339 } 341 In this example, any message that contains a MIME Content-From header 342 at the top-level matching the text "tim@example.com" is saved to the 343 mailbox "INBOX.part-from-tim". 345 4.3. Test "exists" 347 The "exists" test is extended with the addition of the new ":mime" 348 and ":anychild" tagged arguments and their associated options. 350 Usage: exists [":mime"] [":anychild"] 352 When the ":mime" tagged argument is present in the "exists" test, the 353 test is extended to check for the existence of MIME headers in MIME 354 parts. 356 The behavior of the ":anychild" tagged argument and the interaction 357 with the "foreverypart" iterator is the same as for the extended 358 "header" test Section 4.1. 360 That is, 362 the use of "exists" with no ":mime" and ":anychild" tagged 363 argument is the test defined in [RFC5228], i.e. it will *only* 364 operate on top level header fields, whether it is inside 365 "foreverypart" or not. 367 the use of "exists" with ":mime" and no ":anychild" operates on 368 the current MIME part only (or on the top level header fields, if 369 outside "foreverypart") 371 the use of "exists" with ":mime" and ":anychild" operates on the 372 current MIME part and all of its descendants 374 Example: 376 require ["mime", "fileinto"]; 378 if exists :mime :anychild "content-md5" 379 { 380 fileinto "INBOX.md5"; 381 } 383 In this example, any message that contains a MIME Content-MD5 header 384 in any MIME part is saved to the mailbox "INBOX.md5". 386 5. Action "replace" 387 Usage: replace [":mime"] [":subject" string] [":from" string] 388 390 The "replace" command is defined to allow a MIME part to be replaced 391 with the text supplied in the command. 393 When used in the context of a "foreverypart" iterator, the MIME part 394 to be replaced is the "current" MIME part. If the current MIME 395 context is a multipart MIME part, the entire multipart MIME part is 396 replaced, which would alter the MIME structure of the message by 397 eliminating all of the children of the multipart part. (Replacing a 398 non-multipart MIME part within a "foreverypart" loop context does not 399 alter the overall message structure.) If the MIME structure is 400 altered, the change takes effect immediately: the "foreverypart" 401 iterator that is executing does not go into the no-longer existing 402 body parts, and subsequent "foreverypart" iterators would use the new 403 message structure. 405 When used outside the context of a "foreverypart" loop, the MIME part 406 to be replaced is the entire message. 408 If the :mime parameter is not specified, the replacement string is a 409 text/plain part in UTF-8 [RFC3629]. 411 If the :mime parameter is specified, then the replacement string is, 412 in fact, a MIME entity as defined in [RFC2045] section 2.4, including 413 both MIME headers and content. 415 If the entire message is being replaced, the optional ":subject" 416 parameter specifies a subject line to attach to the message that is 417 generated. UTF-8 characters can be used in the string argument; 418 implementations MUST convert the string to [RFC2047] encoded words if 419 and only if non-ASCII characters are present. Implementations MUST 420 preserve the previous Subject header as an Original-Subject header. 421 Implementations MUST preserve all other header fields from the 422 original message with the exception of those relating to the MIME 423 structure that is being replaced. 425 If the entire message is being replaced, as an indication that the 426 message is no longer as created by the original author of the 427 message, the optional ":from" parameter may be used to specify an 428 alternate address to use in the From field of the message that is 429 generated. The string must specify a valid [RFC5322] mailbox-list. 430 Implementations SHOULD check the syntax and generate an error when a 431 syntactically invalid ":from" parameter is specified. 432 Implementations MAY also impose restrictions on what addresses can be 433 specified in a ":from" parameter; it is suggested that values that 434 fail such a validity check simply be ignored rather than causing the 435 replace action to fail. Implementations MUST preserve the previous 436 From header as an Original-From header. 438 Implementations that support the "editheader" extension [RFC5293] 439 MUST ensure that any Original-Subject or Original-From headers added 440 by the system cannot be modified or removed. Implementations MAY 441 prevent the addition of Original-Subject and Orignal-From headers via 442 the "editheader" extension. 444 If ":mime" is specified and either ":subject" or ":from" is 445 specified, the ":subject:" or ":from" parameter MUST be ignored. 446 This SHOULD be flagged as a compilation error. 448 6. Action "enclose" 450 Usage: enclose <:subject string> <:headers string-list> string 452 A new Sieve action command is defined to allow an entire message to 453 be enclosed as an attachment to a new message. After enclosure, 454 subsequent actions affecting the message header or content, as well 455 as tests operating on the MIME structure or accessing MIME header 456 fields, use the newly created message instead of the original 457 message; this means that any use of a "replace" action or other 458 similar actions should be executed before the "enclose" action. 460 If multiple "enclose" actions are executed by a script, the message 461 is enclosed multiple times. (If a Sieve script desires to choose 462 between different enclosures, or wants to delay the enclosure to the 463 end of the script, it can use variables with appropriate tests 464 [RFC5229].) 466 This action does not affect messages that are forwarded via a 467 "redirect" action. 469 Specifically, the original message becomes a multipart/mixed message 470 with two parts: a text/plain portion with the string argument as its 471 body, and a message/rfc822 portion with the original message 472 enclosed. The Content-Type: header field becomes multipart/mixed. 473 The optional Subject: header is specified by the :subject argument; 474 if not present the subject will be taken from the enclosed message. 475 Any headers specified by :headers are copied from the old message 476 into the new message. If not specified by :headers, Date: and From: 477 headers should be synthesized to reflect the current date and the 478 user running the Sieve action. 480 7. Action "extracttext" 482 Usage: extracttext [MODIFIER] [":first" number] 484 The "extracttext" action may be used within the context of a 485 "foreverypart" loop and is used to store text into a variable as 486 defined by [RFC5229]. Servers MUST support transcoding of any 487 textual body part into UTF-8 for use with this action. This requires 488 decoding any transfer encoding as well as transcoding from the 489 indicated character set into UTF-8. It stores at most :first 490 characters of the transcoded content of the current MIME body part in 491 the variable identified by varname. If the :first parameter is not 492 present, the whole content of the current MIME body part is stored. 493 In either case the actually stored data MAY be truncated to conform 494 to implementation specific limit on variable length and/or on MIME 495 body part length. If the transfer encoding or character set is 496 unrecognized by the implementation or recognized but invalid, an 497 empty string will result. 499 If "extracttext" is used outside the context of a "foreverypart" 500 loop, the action will set the variable identified by varname to the 501 empty string. This SHOULD be flagged as a compilation error. 503 Modifiers are applied on the extracted text before it is stored in 504 the variable. 506 8. Sieve Capability Strings 508 A Sieve implementation that defines the "foreverypart" and "break" 509 actions will advertise the capability string "foreverypart". 511 A Sieve implementation that defines the ":mime" and ":anychild" 512 tagged arguments to the "header", "address" and "exists" commands 513 will advertise the capability string "mime". 515 A Sieve implementation that defines the "replace" action will 516 advertise the capability string "replace". 518 A Sieve implementation that defines the "enclose" action will 519 advertise the capability string "enclose". 521 A Sieve implementation that defines the "extracttext" action will 522 advertise the capability string "extracttext". Note that to be 523 useful, the "extracttext" action also requires the "variables" 524 [RFC5229] and "foreverypart" capabilities. 526 9. Examples 528 9.1. Example 1 530 A Sieve script to replace all the Windows executable attachments in a 531 message would be: 533 require [ "foreverypart", "mime", "replace" ]; 534 foreverypart 535 { 536 if anyof ( 537 header :mime :contenttype :is 538 "Content-Type" "application/exe", 539 header :mime :param "filename" 540 :matches ["Content-Type", "Content-Disposition"] "*.com" ) 541 { 542 replace "Executable attachment removed by user filter"; 543 } 544 } 546 9.2. Example 2 548 A Sieve script to warn the user about executable attachment types 549 would be: 551 require [ "foreverypart", "mime", "enclose" ]; 553 foreverypart 554 { 555 if header :mime :param "filename" 556 :matches ["Content-Type", "Content-Disposition"] 557 ["*.com", "*.exe", "*.vbs", "*.scr", 558 "*.pif", "*.hta", "*.bat", "*.zip" ] 559 { 560 # these attachment types are executable 561 enclose :subject "Warning" :text 562 WARNING! The enclosed message contains executable attachments. 563 These attachments types may contain a computer virus program 564 that can infect your computer and potentially damage your data. 566 Before clicking on these message attachments, you should verify 567 with the sender that this message was sent by them and not a 568 computer virus. 569 . 570 ; 571 break; 572 } 573 } 575 9.3. Example 3 577 A Sieve script to extract subject and text out of messages from the 578 boss: 580 require ["mime", "variables", "extracttext"]; 582 if header :contains "from" "boss@example.org" 583 { 584 # :matches is used to get the value of the Subject header 585 if header :matches "Subject" "*" 586 { 587 set "subject" "${1}"; 588 } 590 # extract the first 100 characters of the first text/* part 591 foreverypart 592 { 593 if header :mime :type :is "Content-Type" "text" 594 { 595 extracttext :first 100 "msgcontent"; 596 break; 597 } 598 } 600 # if it's not a 'for your information' message 601 if not header :contains "subject" "FYI:" 602 { 603 # do something using ${subject} and ${msgcontent} 604 # such as sending a notification using a 605 # notification extension 606 } 607 } 609 10. Acknowledgements 611 Comments from members of the MTA Filters Working Group, in particular 612 Ned Freed, Kjetil Torgrim Homme, Mark Mallett, Alexey Melnikov, Aaron 613 Stone and Nigel Swinson are gratefully acknowledged. 615 11. Security Considerations 617 The "enclose" action creates an entirely new message, as compared to 618 just redirecting or forwarding the existing message. Therefore, any 619 site policies applicable to message submission should be enforced. 621 The looping specification specified here provides easier access to 622 information about the message contents, which may also be achieved 623 through other sieve tests. This is not believed to raise any 624 additional security issues beyond those for the Sieve "envelope" and 625 "body" [RFC5173] tests. 627 Any change in message content may interfere with digital signature 628 mechanisms that include that content in the signed material. In 629 particular, using "replace" makes direct changes to the body content 630 and will affect the body hash included in DKIM signatures [RFC4871], 631 or the message signature used for S/MIME [RFC3851], PGP [RFC1991] or 632 OpenPGP [RFC4880]. 634 It is not possible to examine the MIME structure of decrypted content 635 in a multipart/encrypted MIME part. 637 When "enclose" is used on a message containing a multipart/signed 638 MIME part, the SIEVE implementation MUST ensure that the original 639 message is copied octet-for-octet to maintain the validity of the 640 digital signature. 642 The system MUST be sized and restricted in such a manner that even 643 malicious use of mime part matching does not deny service to other 644 users of the host system. 646 All of the security considerations given in the base Sieve 647 specification also apply to these extensions. 649 12. IANA Considerations 651 The Original-Subject: and Original-From: headers are to be registered 652 in the Permanent Message Header Fields registry. 654 The following templates specify the IANA registrations of the Sieve 655 extensions specified in this document. This information should be 656 added to the IANA registry of Sieve Extensions (currently found at 657 http://www.iana.org/assignments/sieve-extensions). 659 [[ RFC Editor Note: replace RFC XXXX with a reference to this RFC. ]] 661 12.1. foreverypart capability 663 To: iana@iana.org 664 Subject: Registration of new Sieve extension 666 Capability name: foreverypart 667 Description: adds the "foreverypart" and "break" actions for 668 iterating through MIME parts of a message. 670 RFC number: RFC XXXX 671 Contact address: The Sieve discussion list 672 . 674 12.2. mime capability 676 To: iana@iana.org 677 Subject: Registration of new Sieve extension 679 Capability name: mime 680 Description: adds the ":mime" and ":anychild" tagged arguments to the 681 "header", "address" and "exists" tests. Adds the :type, :subtype, 682 :contenttype and :param options when ":mime" is used with the 683 "header" test. 685 RFC number: RFC XXXX 686 Contact address: The Sieve discussion list 687 . 689 12.3. replace capability 691 To: iana@iana.org 692 Subject: Registration of new Sieve extension 694 Capability name: replace 695 Description: adds the "replace" action for replacing a MIME body part 696 of a message. 698 RFC number: RFC XXXX 699 Contact address: The Sieve discussion list 700 . 702 12.4. enclose capability 704 To: iana@iana.org 705 Subject: Registration of new Sieve extension 706 Capability name: enclose 707 Description: adds the "enclose" action for enclosing a message with a 708 wrapper. 710 RFC number: RFC XXXX 711 Contact address: The Sieve discussion list 712 . 714 12.5. extracttext capability 716 To: iana@iana.org 717 Subject: Registration of new Sieve extension 718 Capability name: extracttext 719 Description: adds the "extracttext" action for extracting text from a 720 MIME body part. 722 RFC number: RFC XXXX 723 Contact address: The Sieve discussion list 724 . 726 13. Change History 728 [[ RFC Editor NOTE: This section is to be removed prior to 729 publication as an RFC. ]] 731 13.1. draft-ietf-sieve-mime-09 733 Allow for 2231 processing. 735 Optional 2047 decoding. 737 Explain what test options do against a Content-Disposition header. 739 Explain interaction with :count. 741 Updated to SIEVE body reference. 743 Updated IANA section for :mime to also indicate the four options are 744 added. 746 Added comments on the interaction of editheader and replace action. 748 Made variables normative as extracttext requires it. 750 Fixed some examples. 752 13.2. draft-ietf-sieve-mime-08 754 enhance description of enclose and multiple enclose. 756 Minor nits 758 13.3. draft-ietf-sieve-mime-07 760 List :anychild parameter next to :mime, where it was added. 762 Expand description of "address" and "exists". 764 In replace, discuss interaction of :mime with :subject/:from. 766 In enclose, expand discussion o fmultiple enclosures. 768 Mention compilation error if extracttext is used outside of a 769 foreverypart loop. 771 13.4. draft-ietf-sieve-mime-06 773 Added note to foreverypart about nested identical names hiding outer 774 names. 776 Added notes to Security Considerations section about it not working 777 on multipart/signed sections, and how replace/enclose may affect 778 signatures. 780 13.5. draft-ietf-sieve-mime-05 782 Changed for_every_part to foreverypart, and extract_text to 783 extracttext. 785 Add option :name parameter to foreverypart and break. break :name 786 "string" will break out of closest enclosing foreverypart loop 787 with that name. 789 Clarify nesting a bit more. 791 Minor consistency nit picking. 793 13.6. draft-ietf-sieve-mime-04 795 loops are depth first 797 :anychild clarifications 799 update examples 801 grammar nits 803 transcoding for extract_text 805 13.7. draft-ietf-sieve-mime-03 807 add extraction 809 add security considerations 811 fill in iana considerations 813 13.8. draft-ietf-sieve-mime-02 815 minor syntax glitches in examples 817 Add clarification on "replace" affecting subsequent for_every_part 818 loops? 820 Add IANA considerations for Original-Subject: and Original-From:. 822 Add note on "enclose" creating From: and Date: headers. 824 13.9. draft-ietf-sieve-mime-01 826 what happens when nested for_every_part loop's 828 a "mime" shorthand for testing the type/subtype, without requiring 830 interactions with variables 831 notifications 832 notifications to calendar service 833 address tests, exists tests 834 mimeheader, mimeparameter tests 836 13.10. draft-ietf-sieve-mime-00 838 Changed title and text to emphasize MIME Tests. 840 Changed for.every.part to for_every_part. 842 Added :anychild to mime test. Default is to use the current 843 context or outer envelope; specifying :anychild will look at all 844 children. 846 Added clarifications to replacing parts affecting the structure. 848 Added :mime option to replace, ala draft-ietf-sieve-vacation-06. 850 Various other minor nit fixes. 852 13.11. draft-sieve-mime-loop-04 854 update reference for recent published rfcs 856 extract-text now required to do decode transfer encoding and 857 transcode to UTF-8 859 removed editheader reference since its not actually used 861 several text changes as suggested by Nigel Swinson, including re- 862 writes to abstract and introduction 864 13.12. draft-hansen-sieve-loop-03 866 after enclosure, subsequent actions affect newly created message 868 synthesis of Date/From headers by the enclose action is no longer 869 controversial 871 Filled in Security Considerations 873 Picked up extract_text action from draft-ietf-sieve-notify 875 Expanded the IANA considerations section 877 13.13. draft-hansen-sieve-loop-02 879 Update to 3028bis reference. 881 Added 2119 conventions section. 883 Terminology/title tweaks. 885 Added informative references to body and editheader extensions. 887 Added description of nested loops. 889 Replaced mime test by extensions to header, address and exists 890 tests. 892 13.14. draft-hansen-sieve-loop-01 894 Merged with draft-daboo-sieve-mime-00.txt. 896 14. References 897 14.1. Normative References 899 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 900 Extensions (MIME) Part One: Format of Internet Message 901 Bodies", RFC 2045, November 1996. 903 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 904 Part Three: Message Header Extensions for Non-ASCII Text", 905 RFC 2047, November 1996. 907 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 908 Requirement Levels", BCP 14, RFC 2119, March 1997. 910 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 911 Word Extensions: 912 Character Sets, Languages, and Continuations", RFC 2231, 913 November 1997. 915 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 916 10646", STD 63, RFC 3629, November 2003. 918 [RFC5173] Degener, J. and P. Guenther, "Sieve Email Filtering: Body 919 Extension", RFC 5173, April 2008. 921 [RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering 922 Language", RFC 5228, January 2008. 924 [RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", 925 RFC 5229, January 2008. 927 [RFC5231] Segmuller, W. and B. Leiba, "Sieve Email Filtering: 928 Relational Extension", RFC 5231, January 2008. 930 [RFC5293] Degener, J. and P. Guenther, "Sieve Email Filtering: 931 Editheader Extension", RFC 5293, August 2008. 933 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 934 October 2008. 936 14.2. Informative References 938 [RFC1991] Atkins, D., Stallings, W., and P. Zimmermann, "PGP Message 939 Exchange Formats", RFC 1991, August 1996. 941 [RFC3851] Ramsdell, B., "Secure/Multipurpose Internet Mail 942 Extensions (S/MIME) Version 3.1 Message Specification", 943 RFC 3851, July 2004. 945 [RFC4871] Allman, E., Callas, J., Delany, M., Libbey, M., Fenton, 946 J., and M. Thomas, "DomainKeys Identified Mail (DKIM) 947 Signatures", RFC 4871, May 2007. 949 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 950 Thayer, "OpenPGP Message Format", RFC 4880, November 2007. 952 Authors' Addresses 954 Tony Hansen 955 AT&T Laboratories 956 200 Laurel Ave. 957 Middletown, NJ 07748 958 USA 960 Email: tony+sieveloop@maillennium.att.com 962 Cyrus Daboo 963 Apple Inc. 964 1 Infinite Loop 965 Cupertino, CA 95014 966 USA 968 Email: cyrus@daboo.name 969 URI: http://www.apple.com/