draft-ietf-sieve-mime-loop-01.txt   draft-ietf-sieve-mime-loop-02.txt 
Internet Engineering Task Force T. Hansen Internet Engineering Task Force T. Hansen
Internet-Draft AT&T Laboratories Internet-Draft AT&T Laboratories
Intended status: Standards Track C. Daboo Intended status: Standards Track C. Daboo
Expires: April 25, 2007 Apple Computer Expires: September 19, 2007 Apple Computer
October 22, 2006 March 18, 2007
SIEVE Email Filtering: MIME part Tests, Iteration, Replacement and SIEVE Email Filtering: MIME part Tests, Iteration, Replacement and
Enclosure Enclosure
draft-ietf-sieve-mime-loop-01.txt draft-ietf-sieve-mime-loop-02.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 1, line 36 skipping to change at page 1, line 36
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
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.
This Internet-Draft will expire on April 25, 2007. This Internet-Draft will expire on September 19, 2007.
Copyright Notice Copyright Notice
Copyright (C) The Internet Society (2006). Copyright (C) The IETF Trust (2007).
Abstract Abstract
The SIEVE email filtering language has no way to examine individual The SIEVE email filtering language has no way to examine individual
MIME parts or any way to manipulate those individual parts. However, MIME parts or any way to manipulate those individual parts. However,
being able to filter based on MIME content is important. This being able to filter based on MIME content is important. This
document defines extensions for these needs. document defines extensions for these needs.
Note Note
skipping to change at page 4, line 35 skipping to change at page 4, line 35
:param parses the header looking for MIME parameters in the header. :param parses the header looking for MIME parameters in the header.
The supplied string-list lists the names of any parameters to be The supplied string-list lists the names of any parameters to be
tested. If any one named parameter value matches the test string tested. If any one named parameter value matches the test string
value, the test will return true. value, the test will return true.
Example: Example:
require ["mime", "fileinto"]; require ["mime", "fileinto"];
if header :mime :type :comparator "Content-Type" "image" if header :mime :type "Content-Type" "image"
{ {
fileinto "INBOX.images"; fileinto "INBOX.images";
} }
In this example, any message that contains a MIME image type part at In this example, any message that contains a MIME image type part at
the top-level is saved to the mailbox "INBOX.images". the top-level is saved to the mailbox "INBOX.images".
Example: Example:
require ["mime", "fileinto"]; require ["mime", "fileinto"];
skipping to change at page 5, line 19 skipping to change at page 5, line 19
require ["mime", "for_every_part", "fileinto"]; require ["mime", "for_every_part", "fileinto"];
for_every_part for_every_part
{ {
if header :mime :param "filename" :comparator if header :mime :param "filename" :comparator
"Content-Disposition" "important" "Content-Disposition" "important"
{ {
fileinto "INBOX.important"; fileinto "INBOX.important";
break; break;
} }
}
In this example, any message that contains any MIME part with a In this example, any message that contains any MIME part with a
content-disposition with a filename parameter containing the text content-disposition with a filename parameter containing the text
"important" is saved to the mailbox "INBOX.important". "important" is saved to the mailbox "INBOX.important".
4.2. Test "address" 4.2. Test "address"
The "address" test is extended with the addition of a new ":mime" The "address" test is extended with the addition of a new ":mime"
tagged argument, which takes a number of other arguments. tagged argument, which takes a number of other arguments.
skipping to change at page 6, line 48 skipping to change at page 6, line 49
The "replace" command is defined to allow a MIME part to be replaced The "replace" command is defined to allow a MIME part to be replaced
with the text supplied in the command. with the text supplied in the command.
When used in the context of a "for_every_part" iterator, the MIME When used in the context of a "for_every_part" iterator, the MIME
part to be replaced is the "current" MIME part. If the current MIME part to be replaced is the "current" MIME part. If the current MIME
context is a multipart MIME part, the entire multipart MIME part is context is a multipart MIME part, the entire multipart MIME part is
replaced, which would alter the MIME structure of the message by replaced, which would alter the MIME structure of the message by
eliminating all of the children of the multipart part. (Replacing a eliminating all of the children of the multipart part. (Replacing a
non-multipart MIME part within a "for_every_part" loop context does non-multipart MIME part within a "for_every_part" loop context does
not alter the overall message structure.) not alter the overall message structure.) If the MIME structure is
altered, the change takes effect immediately: the "for_every_part"
iterator that is executing does not go into the no-longer existing
body parts, and subsequent "for_every_part" iterators would use the
new message structure.
When used outside the context of a "for_every_part" loop, the MIME When used outside the context of a "for_every_part" loop, the MIME
part to be replaced is the entire message. part to be replaced is the entire message.
If the :mime parameter is not specified, the replacement string is a If the :mime parameter is not specified, the replacement string is a
text/plain part. text/plain part.
If the :mime parameter is specified, then the replacement string is, If the :mime parameter is specified, then the replacement string is,
in fact, a MIME entity as defined in [RFC2045] section 2.4, including in fact, a MIME entity as defined in [RFC2045] section 2.4, including
both MIME headers and content. If the optional :mime parameter is both MIME headers and content. If the optional :mime parameter is
skipping to change at page 7, line 29 skipping to change at page 7, line 34
previous Subject header as an Original-Subject header. previous Subject header as an Original-Subject header.
If the entire message is being replaced, a ":from" parameter may be If the entire message is being replaced, a ":from" parameter may be
used to specify an alternate address to use in the From field of the used to specify an alternate address to use in the From field of the
message that is generated. The string must specify a valid [RFC2822] message that is generated. The string must specify a valid [RFC2822]
mailbox-list. Implementations SHOULD check the syntax and generate mailbox-list. Implementations SHOULD check the syntax and generate
an error when a syntactically invalid ":from" parameter is specified. an error when a syntactically invalid ":from" parameter is specified.
Implementations MAY also impose restrictions on what addresses can be Implementations MAY also impose restrictions on what addresses can be
specified in a ":from" parameter; it is suggested that values that specified in a ":from" parameter; it is suggested that values that
fail such a validity check simply be ignored rather than causing the fail such a validity check simply be ignored rather than causing the
vacation action to fail. Implementations MUST preserve the previous replace action to fail. Implementations MUST preserve the previous
From header as an Original-From header. From header as an Original-From header.
6. Action Enclose 6. Action Enclose
Usage: enclose <:subject string> <:headers string-list> string Usage: enclose <:subject string> <:headers string-list> string
A new SIEVE action command is defined to allow an entire message to A new SIEVE action command is defined to allow an entire message to
be enclosed as an attachment to a new message. This enclose action be enclosed as an attachment to a new message. NB: The following
takes precedence over all other message modifications, such as statement may be controversial: This enclose action takes precedence
"replace". If multiple "enclose" actions are executed by a script, over all other message modifications, such as "replace". If multiple
only the text specified on the last one is used when creating the "enclose" actions are executed by a script, only the text specified
enclosed message. This action does not affect messages that are on the last one is used when creating the enclosed message. This
forwarded via a "redirect" action. action does not affect messages that are forwarded via a "redirect"
action.
Specifically, the original message becomes a multipart/mixed message Specifically, the original message becomes a multipart/mixed message
with two parts: a text/plain portion with the string argument as its with two parts: a text/plain portion with the string argument as its
body, and a message/rfc822 portion with the original message body, and a message/rfc822 portion with the original message
enclosed. The Content-Type: header field becomes multipart/mixed. enclosed. The Content-Type: header field becomes multipart/mixed.
The Subject: header is specified by the :subject argument. Any The Subject: header is specified by the :subject argument. Any
headers specified by :headers are copied from the old message into headers specified by :headers are copied from the old message into
the new message. the new message. NB: The following statement may be controversial:
If not specified by :headers, Date: and From: headers should be
synthesized to reflect the current date and the user running the
SIEVE action.
7. SIEVE Capability Strings 7. SIEVE Capability Strings
A SIEVE implementation that defines the "for_every_part" and "break" A SIEVE implementation that defines the "for_every_part" and "break"
actions will advertise the capability string "for_every_part". actions will advertise the capability string "for_every_part".
A SIEVE implementation that defines the ":mime" tagged arguments to A SIEVE implementation that defines the ":mime" tagged arguments to
the "header", "address" and "exists" commands will advertise the the "header", "address" and "exists" commands will advertise the
capability string "mime". capability string "mime".
skipping to change at page 8, line 30 skipping to change at page 8, line 39
8. Examples 8. Examples
8.1. Example 1 8.1. Example 1
A SIEVE script to replace all the Windows executable attachments in a A SIEVE script to replace all the Windows executable attachments in a
message would be: message would be:
require [ "for_every_part", "mime", "replace" ]; require [ "for_every_part", "mime", "replace" ];
for_every_part for_every_part
{ {
if ( anyof ( header :mime :subtype :is "Content-Type" "exe", if ( anyof (
header :mime :contenttype :is "Content-Type" "application/exe",
header :mime :param "filename" header :mime :param "filename"
["Content-Type" "Content-Disposition"] :matches "*.com" ) ["Content-Type", "Content-Disposition"] :matches "*.com" )
{ {
replace "Executable attachment removed by user filter"; replace "Executable attachment removed by user filter";
} }
} }
8.2. Example 2 8.2. Example 2
A SIEVE script to warn the user about executable attachment types A SIEVE script to warn the user about executable attachment types
would be: would be:
require [ "for_every_part", "mime", "enclose" ]; require [ "for_every_part", "mime", "enclose" ];
for_every_part for_every_part
{ {
if header :mime :param "filename" if header :mime :param "filename"
["Content-Type" "Content-Disposition"] :matches ["Content-Type", "Content-Disposition"] :matches
["*.com", "*.exe", "*.vbs", "*.scr", ["*.com", "*.exe", "*.vbs", "*.scr",
"*.pif", "*.hta", "*.bat", "*.zip" ] "*.pif", "*.hta", "*.bat", "*.zip" ]
{ {
# these attachment types are executable # these attachment types are executable
enclose :subject "Warning" " enclose :subject "Warning" "
WARNING! The enclosed message contains executable attachments. WARNING! The enclosed message contains executable attachments.
These attachments types may contain a computer virus program These attachments types may contain a computer virus program
that can infect your computer and potentently damage your data that can infect your computer and potentently damage your data
Before clicking on these message attachments, you should verify Before clicking on these message attachments, you should verify
skipping to change at page 9, line 40 skipping to change at page 9, line 45
Comments from members of the MTA Filters Working Group, in particular Comments from members of the MTA Filters Working Group, in particular
Ned Freed, Nigel Swinson and Mark Mallett, are gratefully Ned Freed, Nigel Swinson and Mark Mallett, are gratefully
acknowledged. acknowledged.
10. Security Considerations 10. Security Considerations
To be provided To be provided
11. IANA Considerations 11. IANA Considerations
To be provided The Original-Subject: and Original-From: headers are to be registered
in the Permanent Message Header Fields table.
12. Change History (to be removed prior to publication as an RFC) 12. Change History (to be removed prior to publication as an RFC)
12.1. draft-ietf-sieve-mime-01 12.1. draft-ietf-sieve-mime-02
minor syntax glitches in examples
Add clarification on "replace" affecting subsequent for_every_part
loops?
Add IANA considerations for Original-Subject: and Original-From:.
Add note on "enclose" creating From: and Date: headers.
12.2. draft-ietf-sieve-mime-01
what happens when nested for_every_loop's what happens when nested for_every_loop's
a "mime" shorthand for testing the type/subtype, without requiring a "mime" shorthand for testing the type/subtype, without requiring
interactions with variables notifications notifications to calendar
service address tests, exists tests mimeheader, mimeparameter tests
12.2. draft-ietf-sieve-mime-00 interactions with variables
notifications
notifications to calendar service
address tests, exists tests
mimeheader, mimeparameter tests
12.3. draft-ietf-sieve-mime-00
Changed title and text to emphasize MIME Tests. Changed title and text to emphasize MIME Tests.
Changed for.every.part to for_every_part. Changed for.every.part to for_every_part.
Added :anychild to mime test. Default is to use the current context Added :anychild to mime test. Default is to use the current context
or outer envelope; specifying :anychild will look at all children. or outer envelope; specifying :anychild will look at all children.
Added clarifications to replacing parts affecting the structure. Added clarifications to replacing parts affecting the structure.
Added :mime option to replace, ala draft-ietf-sieve-vacation-06. Added :mime option to replace, ala draft-ietf-sieve-vacation-06.
Various other minor nit fixes. Various other minor nit fixes.
12.3. draft-hansen-sieve-loop-01 12.4. draft-hansen-sieve-loop-01
Merged with draft-daboo-sieve-mime-00.txt. Merged with draft-daboo-sieve-mime-00.txt.
12.4. draft-hansen-sieve-loop-02 12.5. draft-hansen-sieve-loop-02
Update to 3028bis reference. Update to 3028bis reference.
Added 2119 conventions section. Added 2119 conventions section.
Terminology/title tweaks. Terminology/title tweaks.
Added informative references to body and editheader extensions. Added informative references to body and editheader extensions.
Added description of nested loops. Added description of nested loops.
Replaced mime test by extensions to header, address and exists Replaced mime test by extensions to header, address and exists
tests. tests.
13. References 13. References
13.1. Normative References 13.1. Normative References
[I-D.ietf-sieve-3028bis] [I-D.ietf-sieve-3028bis]
Showalter, T. and P. Guenther, "Sieve: An Email Filtering Showalter, T. and P. Guenther, "Sieve: An Email Filtering
Language", draft-ietf-sieve-3028bis-09 (work in progress), Language", draft-ietf-sieve-3028bis-12 (work in progress),
August 2006. February 2007.
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [RFC2045] 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.
[RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
Part Three: Message Header Extensions for Non-ASCII Text", Part Three: Message Header Extensions for Non-ASCII Text",
RFC 2047, November 1996. RFC 2047, November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] 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.
[RFC2822] Resnick, P., "Internet Message Format", RFC 2822, [RFC2822] Resnick, P., "Internet Message Format", RFC 2822,
April 2001. April 2001.
13.2. Informative References 13.2. Informative References
[I-D.ietf-sieve-body] [I-D.ietf-sieve-body]
Guenther, P. and J. Degener, "Sieve Email Filtering: Body Guenther, P. and J. Degener, "Sieve Email Filtering: Body
Extension", draft-ietf-sieve-body-04 (work in progress), Extension", draft-ietf-sieve-body-06 (work in progress),
August 2006. February 2007.
[I-D.ietf-sieve-editheader] [I-D.ietf-sieve-editheader]
Guenther, P. and J. Degener, "Sieve Email Filtering: Guenther, P. and J. Degener, "Sieve Email Filtering:
Editheader Extension", draft-ietf-sieve-editheader-06 Editheader Extension", draft-ietf-sieve-editheader-08
(work in progress), August 2006. (work in progress), March 2007.
Authors' Addresses Authors' Addresses
Tony Hansen Tony Hansen
AT&T Laboratories AT&T Laboratories
200 Laurel Ave. 200 Laurel Ave.
Middletown, NJ 07748 Middletown, NJ 07748
USA USA
Email: tony+sieveloop@maillennium.att.com Email: tony+sieveloop@maillennium.att.com
skipping to change at page 12, line 7 skipping to change at page 13, line 7
Apple Computer, Inc. Apple Computer, Inc.
1 Infinite Loop 1 Infinite Loop
Cupertino, CA 95014 Cupertino, CA 95014
USA USA
Email: cyrus@daboo.name Email: cyrus@daboo.name
URI: http://www.apple.com/ URI: http://www.apple.com/
Full Copyright Statement Full Copyright Statement
Copyright (C) The Internet Society (2006). Copyright (C) The IETF Trust (2007).
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 an This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property Intellectual Property
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 to Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information made any independent effort to identify any such rights. Information
 End of changes. 24 change blocks. 
37 lines changed or deleted 62 lines changed or added

This html diff was produced by rfcdiff 1.33. The latest version is available from http://tools.ietf.org/tools/rfcdiff/