One document matched: draft-ietf-sieve-convert-01.xml
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
<!ENTITY RFC5228 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5228.xml'>
<!ENTITY RFC5234 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml'>
<!ENTITY RFC5259 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5259.xml'>
<!ENTITY RFC5703 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5703.xml'>
]>
<?xml-stylesheet type='text/xsl' href='http://xml.resource.org/authoring/rfc2629.xslt' ?>
<?rfc toc="yes" ?>
<?rfc tocompact="no" ?>
<?rfc tocindent="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="yes"?>
<rfc
docName="draft-ietf-sieve-convert-01"
category="std"
ipr="trust200902"
xml:lang="en">
<front>
<title abbrev="Sieve CONVERT">Sieve Extension for
converting messages before delivery</title>
<author initials='A.' surname="Melnikov" fullname='Alexey Melnikov'>
<organization>Isode Limited</organization>
<address>
<postal>
<street>5 Castle Business Village</street>
<street>36 Station Road</street>
<city>Hampton</city>
<region>Middlesex</region>
<code>TW12 2BX</code>
<country>UK</country>
</postal>
<email>Alexey.Melnikov@isode.com</email>
<uri>http://www.melnikov.ca/</uri>
</address>
</author>
<author initials="Q." surname="Sun" fullname="Qian Sun">
<organization>Huawei Technologies</organization>
<address>
<postal>
<street>Bantian Longgang</street>
<city>Shenzhen</city>
<region>Guandong</region>
<code>518129</code>
<country>P.R China</country>
</postal>
<phone>+86 755 28780808</phone>
<email>sunqian@huawei.com</email>
</address>
</author>
<author initials='B.' surname="Leiba" fullname='Barry Leiba'>
<organization>Huawei Technologies</organization>
<address>
<phone>+1 646 827 0648</phone>
<email>barryleiba@computer.org</email>
<uri>http://internetmessagingtechnology.org/</uri>
</address>
</author>
<author initials="K." surname="Li" fullname="Kepeng Li">
<organization abbrev="Huawei Technologies">Huawei Technologies</organization>
<address>
<postal>
<street>Huawei Base, Bantian, Longgang District</street>
<city>Shenzhen</city>
<region>Guangdong</region>
<code>518129</code>
<country>P. R. China</country>
</postal>
<phone>+86-755-28974289</phone>
<email>likepeng@huawei.com</email>
</address>
</author>
<date year="2011"/>
<area>Applications</area>
<workgroup>Sieve Working Group</workgroup>
<keyword>Sieve</keyword>
<keyword>CONVERT</keyword>
<abstract>
<t>
This document describes how IMAP CONVERT can be used within Sieve
to transform messages before final delivery.
</t>
</abstract>
</front>
<middle>
<section anchor="Intro" title="Introduction" toc="default">
<t>
The IMAP CONVERT extension <xref target="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
<xref target="RFC5228"/>, which reuses the conversion parameters and framework
established by IMAP CONVERT.
</t>
<section title="Conventions Used in this Document">
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119
<xref target="RFC2119"/>.
</t>
<t>
Conventions for notations are as in Sieve <xref target="RFC5228"/> section 1.1,
including the use of ABNF <xref target="RFC5234"/>.
</t>
</section>
</section>
<section title='"convert" action'>
<t>
<list style="hanging" hangIndent="8">
<t hangText="Usage: convert">
<quoted-from-mime-type: string><vspace/>
<quoted-to-mime-type: string><vspace/>
<transcoding-params: string-list>
</t>
</list>
</t>
<t>
The "convert" action specifies that body parts with "quoted-from-mime-type"
MIME type be converted to "quoted-to-mime-type" MIME type using
conversion parameters specified in "transcoding-params". Each conversion parameter
value has the following syntax: "<transcoding-param>=<transcoding-param-value>",
where <transcoding-param> and <transcoding-param-value> are defined in CONVERT
<xref target="RFC5259"/>.
Messages that don't have any body parts with the "quoted-from-mime-type" MIME type
are not affected by the conversion.
</t>
<t>
The "convert" action can be used with Sieve MIME Part Tests <xref target="RFC5703"/>,
in the case that some, but not all of the body parts need to be converted, or
where different body parts might require 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 <xref target="Example2"/> for an example).
</t>
<t>
When the "convert" action appears outside a "foreverypart" loop, the 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.
</t>
<t>
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").
</t>
<section title='Interaction with other actions'>
<t>
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.
</t>
<t>
All conversions are performed before any disposition-type actions.
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.
</t>
<t>
Repeating for emphasis: note that disposition-type actions, such as
"fileinto" and "redirect", will work on the converted message,
filing or redirecting it after all conversions are done.
</t>
<t>
See <xref target="Example4"/> for an example of how this might be tricky.
</t>
</section>
</section>
<section title="Examples">
<section anchor="Example1" title="Example 1">
<t>
In the following example, all "image/tiff" body parts of the message
are converted to "image/jpeg" with image resolution of 320x240 pixels.
The message is then subject to the implicit keep.
</t>
<figure>
<artwork><![CDATA[
require ["convert"];
convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240";
]]></artwork>
</figure>
</section>
<section anchor="Example2" title="Example 2">
<t>
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.
</t>
<figure>
<artwork><![CDATA[
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";
}
]]></artwork>
</figure>
</section>
<section anchor="Example3" title="Example 3">
<t>
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.
</t>
<figure>
<artwork><![CDATA[
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 ...]
]]></artwork>
</figure>
</section>
<section anchor="Example4" title="Example 4">
<t>
The following example shows some tricky interactions between multiple
"convert" actions and other disposition-type actions.
</t>
<figure>
<artwork><![CDATA[
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.
]]></artwork>
</figure>
</section>
</section>
<section anchor="security" title="Security Considerations" toc="default">
<t>
Security considerations given in IMAP CONVERT <xref target="RFC5259"/>
and Sieve <xref target="RFC5228"/> are relevant to this document.
There are no additional security considerations resulting from combining the two.
</t>
</section>
<section title="IANA Considerations">
<t>
IANA is requested to add the following registration to the
Sieve Extensions registry, as defined in RFC 5228:
</t>
<t>
<list style="hanging">
<t hangText="Capability name:">convert</t>
<t hangText="Description:">adds a new tag to the fileinto action
that enables Sieve script to perform a conversion on the message
being delivered.
</t>
<t hangText="RFC number:">this RFC</t>
<t hangText="Contact address:">
The Sieve discussion list <sieve@ietf.org>
</t>
</list>
</t>
</section>
<section title="Acknowledgements">
<t>
The authors also want to thank all who have contributed key insight
and extensively reviewed and discussed the concepts of CONVERT.
</t>
</section>
</middle>
<back>
<references title="Normative References">
&RFC2119; <!-- Keywords -->
&RFC5228; <!-- Sieve -->
&RFC5234; <!-- ABNF -->
&RFC5259; <!-- CONVERT -->
&RFC5703; <!-- MIME loops -->
</references>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-24 17:01:11 |