draft-ietf-sieve-convert-00.txt   draft-ietf-sieve-convert-01.txt 
Network Working Group A. Melnikov Sieve Working Group A. Melnikov
Internet-Draft Isode Limited Internet-Draft Isode Limited
Intended status: Standards Track Q. Sun Intended status: Standards Track Q. Sun
Expires: December 26, 2010 Huawei Technologies Expires: January 9, 2012 B. Leiba
June 24, 2010 K. Li
Huawei Technologies
July 8, 2011
Sieve Extension for converting messages before delivery Sieve Extension for converting messages before delivery
draft-ietf-sieve-convert-00 draft-ietf-sieve-convert-01
Abstract Abstract
This document describes how Lemonade CONVERT can be used to transform This document describes how IMAP CONVERT can be used within Sieve to
messages before final delivery. transform messages before final delivery.
Status of this Memo Status of this Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
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."
This Internet-Draft will expire on December 26, 2010. This Internet-Draft will expire on January 9, 2012.
Copyright Notice Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Conventions Used in this Document . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Conventions Used in this Document . . . . . . . . . . . . . . 3
2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. "convert" action . . . . . . . . . . . . . . . . . . . . . . 3
2.1. Interaction with other actions . . . . . . . . . . . . . . . 4
3. :converted tagged argument to the 'fileinto' action . . . . . . 3 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2. Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3. Example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.4. Example 4 . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4. Security Considerations . . . . . . . . . . . . . . . . . . . 7
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 4 7. Normative References . . . . . . . . . . . . . . . . . . . . 7
8. Normative References . . . . . . . . . . . . . . . . . . . . . 4 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 7
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction
1. Conventions Used in this Document The IMAP CONVERT extension [RFC5259] adds an IMAP command for
performing client-controlled conversions on whole messages or their
body parts. This document defines a similar extension to the Sieve
mail filtering language [RFC5228], which reuses the conversion
parameters and framework established by IMAP CONVERT.
1.1. Conventions Used in this Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
Conventions for notations are as in [SIEVE] section 1.1, including Conventions for notations are as in Sieve [RFC5228] section 1.1,
the use of [ABNF]. including the use of ABNF [RFC5234].
2. Introduction
The [CONVERT] extension adds an IMAP command for performing client
controlled conversions on whole messages or their body parts. This
document defines a similar extension to the SIEVE [SIEVE] mail
filtering language, which reuses conversion parameters and framework
established by [CONVERT].
3. :converted tagged argument to the 'fileinto' action 2. "convert" action
Usage: :converted <quoted-from-mime-type: string> Usage: convert <quoted-from-mime-type: string>
<quoted-to-mime-type: string> <quoted-to-mime-type: string>
<transcoding-params: string-list> <transcoding-params: string-list>
The :converted tag specifies that all body parts with "quoted-from- The "convert" action specifies that body parts with "quoted-from-
mime-type" MIME type should be converted to "quoted-to-mime-type" mime-type" MIME type be converted to "quoted-to-mime-type" MIME type
MIME type using conversion parameters specified in "transcoding- using conversion parameters specified in "transcoding-params". Each
params". Each conversion parameter value has the following syntax: conversion parameter value has the following syntax: "<transcoding-
"<transcoding-param>=<transcoding-param-value>", where <transcoding- param>=<transcoding-param-value>", where <transcoding-param> and
param> and <transcoding-param-value> are defined in [CONVERT]. <transcoding-param-value> are defined in CONVERT [RFC5259]. Messages
Messages which don't have any body part with the "quoted-from-mime- that don't have any body parts with the "quoted-from-mime-type" MIME
type" MIME type are not affected by the conversion. type are not affected by the conversion.
[[anchor3: Should there be a way to specify/restrict which specific The "convert" action can be used with Sieve MIME Part Tests
body parts need to be converted (e.g. only the second body part)? [RFC5703], in the case that some, but not all of the body parts need
Should there be a way to specify multiple conversions (on different to be converted, or where different body parts might require
body parts of the same message)?]] different conversions. When the "convert" action appears in a
"foreverypart" loop, it applies only to the body part being
processed, and not to any other body parts (see Section 3.2 for an
example).
[[anchor4: Interaction with MIME Loops (e.g. if :converted is When the "convert" action appears outside a "foreverypart" loop, the
applicable to the replace action) should be specified.]] conversion applies equally to all body parts -- that is, all body
parts that have the "quoted-from-mime-type" are converted, using the
same transcoding parameters.
4. Examples Implementations ought to defer any actual conversion until the final
resolution of other actions, to avoid doing conversions unnecessarily
in cases where the message is not retained (such as where the
resolution is "discard").
In the following examples all "image/tiff" body parts of the message 2.1. Interaction with other actions
are converted to "image/jpeg" with image resolution of 320x480
pixels.
require ["fileinto", "convert"]; Whether the actual conversion has been done yet or not, a "convert"
action effectively changes the message, and all subsequent actions,
including any other "convert" actions, apply to the changed message.
The "convert" action does not affect the applicability of other
actions; any action that was applicable before the "convert" is
equally applicable to the changed message afterward.
fileinto :converted "image/tiff" "image/jpeg" "pix-x" "320" All conversions are performed before any disposition-type actions.
"pix-y" "480" "INBOX"; Therefore, the sequence "convert, fileinto, convert" is the same as
"convert, convert, fileinto": in both cases, all conversions are done
before the message is filed.
Messages which don't have image/tiff body parts are delivered to Repeating for emphasis: note that disposition-type actions, such as
INBOX as is. "fileinto" and "redirect", will work on the converted message, filing
or redirecting it after all conversions are done.
5. Security Considerations See Section 3.4 for an example of how this might be tricky.
[[anchor6: TBD]] 3. Examples
6. IANA Considerations 3.1. Example 1
IANA is requested to add the following registrations to the list of In the following example, all "image/tiff" body parts of the message
Sieve extensions: are converted to "image/jpeg" with image resolution of 320x240
pixels. The message is then subject to the implicit keep.
require ["convert"];
convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240";
3.2. Example 2
In the following example, all "image/tiff" body parts of the message
are converted to "image/jpeg", as in Example 1. Those messages are
then filed into a mailbox called "INBOX.pics". Other messages (those
with no image/tiff body parts) are subject to the implicit keep.
require ["mime", "fileinto", "convert"];
if header :mime :anychild :contenttype
"Content-Type" "image/tiff"
{
convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240";
fileinto "INBOX.pics";
}
3.3. Example 3
In the following example, only "image/tiff" body parts with a
Content-Disposition of "inline" are converted. Matching parts that
are larger than 500 kilobytes are converted using an image resolution
of 640x480 pixels, and those smaller are converted to 320x240 pixels.
The message disposition is not changed, so the implicit keep will be
in effect unless something else in the script changes that.
require ["mime", "foreverypart", "fileinto", "convert"];
foreverypart
{
if header :mime :param "filename" :contains
"Content-Disposition" "inline"
{
if size :over "500K"
{
convert "image/tiff" "image/jpeg"
"pix-x" "640" "pix-y" "480";
} else {
convert "image/tiff" "image/jpeg"
"pix-x" "320" "pix-y" "240";
}
}
}
[... script continues ...]
3.4. Example 4
The following example shows some tricky interactions between multiple
"convert" actions and other disposition-type actions.
require ["mime", "foreverypart",
"fileinto", "redirect" "convert"];
# The first "if" block will convert all image/tiff body parts
# to 640x480 jpegs, and will register the message to be filed
# into the "INBOX.pics" mailbox. But the rest of the script
# will be run before the "fileinto" is done.
if header :mime :anychild :contenttype
"Content-Type" "image/tiff"
{
convert "image/tiff" "image/jpeg" "pix-x" "640" "pix-y" "480";
fileinto "INBOX.pics";
}
# The second block, the "foreverypart" loop, will convert all
# inline jpegs to 320x240 resolution... including any tiff body
# parts that had been converted in the first block, above.
# Therefore, any tiff that had been converted to a 640x480 jpeg
# will be re-converted to a 320x240 jpeg here if its
# Content-Disposition is specified as "inline".
foreverypart
{
if header :mime :param "filename" :contains
"Content-Disposition" "inline"
{
convert "image/jpeg" "image/jpeg"
"pix-x" "320" "pix-y" "240";
}
}
# The third block will redirect the message to Joe if it
# contains any tiff body parts. But because of the earlier
# conversion (in the first block), there will never be any
# tiff body parts, so the message will never be redirected.
if header :mime :anychild :contenttype
"Content-Type" "image/tiff"
{
redirect "joe@example.com";
}
# Now, at the end of the script processing, after all
# conversions, the message will be filed into "INBOX.pics"
# if the first "if" block was taken, or will be implicitly
# kept if not.
4. Security Considerations
Security considerations given in IMAP CONVERT [RFC5259] and Sieve
[RFC5228] are relevant to this document. There are no additional
security considerations resulting from combining the two.
5. IANA Considerations
IANA is requested to add the following registration to the Sieve
Extensions registry, as defined in RFC 5228:
Capability name: convert Capability name: convert
Description: adds a new tag to the fileinto action that enables Description: adds a new tag to the fileinto action that enables
Sieve script to perform a conversion on the message being Sieve script to perform a conversion on the message being
delivered. delivered.
RFC number: this RFC RFC number: this RFC
Contact address: The Sieve discussion list Contact address: The Sieve discussion list <sieve@ietf.org>
<ietf-mta-filters@imc.org>
7. Acknowledgements 6. Acknowledgements
[[anchor9: TBD]]. The authors also want to thank all who have contributed key insight
and extensively reviewed and discussed the concepts of CONVERT.
8. Normative References 7. Normative References
[ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Specifications: ABNF", RFC 5234, January 2008. Requirement Levels", BCP 14, RFC 2119, March 1997.
[CONVERT] Melnikov, A., Ed. and P. Coates, Ed., "Internet Message [RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering
Access Protocol - CONVERT Extension", RFC 5259, July 2008. Language", RFC 5228, January 2008.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Requirement Levels", RFC 2119, BCP 14, March 1997. Specifications: ABNF", STD 68, RFC 5234, January 2008.
[SIEVE] Guenther, P., Ed. and T. Showalter, Ed., "Sieve: An Email [RFC5259] Melnikov, A. and P. Coates, "Internet Message Access
Filtering Language", RFC 5228, January 2008. Protocol - CONVERT Extension", RFC 5259, July 2008.
[RFC5703] Hansen, T. and C. Daboo, "Sieve Email Filtering: MIME Part
Tests, Iteration, Extraction, Replacement, and Enclosure",
RFC 5703, October 2009.
Authors' Addresses Authors' Addresses
Alexey Melnikov Alexey Melnikov
Isode Limited Isode Limited
5 Castle Business Village 5 Castle Business Village
36 Station Road 36 Station Road
Hampton, Middlesex TW12 2BX Hampton, Middlesex TW12 2BX
UK UK
skipping to change at line 177 skipping to change at page 8, line 25
URI: http://www.melnikov.ca/ URI: http://www.melnikov.ca/
Qian Sun Qian Sun
Huawei Technologies Huawei Technologies
Bantian Longgang Bantian Longgang
Shenzhen, Guandong 518129 Shenzhen, Guandong 518129
P.R China P.R China
Phone: +86 755 28780808 Phone: +86 755 28780808
Email: sunqian@huawei.com Email: sunqian@huawei.com
Barry Leiba
Huawei Technologies
Phone: +1 646 827 0648
Email: barryleiba@computer.org
URI: http://internetmessagingtechnology.org/
Kepeng Li
Huawei Technologies
Huawei Base, Bantian, Longgang District
Shenzhen, Guangdong 518129
P. R. China
Phone: +86-755-28974289
Email: likepeng@huawei.com
 End of changes. 40 change blocks. 
72 lines changed or deleted 205 lines changed or added

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