7Network Working Group                                         P. Resnick
 
8Request for Comments: 4469                         QUALCOMM Incorporated
 
9Updates: 3501, 3502                                           April 2006
 
10Category: Standards Track
 
13       Internet Message Access Protocol (IMAP) CATENATE Extension
 
17   This document specifies an Internet standards track protocol for the
 
18   Internet community, and requests discussion and suggestions for
 
19   improvements.  Please refer to the current edition of the "Internet
 
20   Official Protocol Standards" (STD 1) for the standardization state
 
21   and status of this protocol.  Distribution of this memo is unlimited.
 
25   Copyright (C) The Internet Society (2006).
 
29   The CATENATE extension to the Internet Message Access Protocol (IMAP)
 
30   extends the APPEND command to allow clients to create messages on the
 
31   IMAP server that may contain a combination of new data along with
 
32   parts of (or entire) messages already on the server.  Using this
 
33   extension, the client can catenate parts of an already existing
 
34   message onto a new message without having to first download the data
 
35   and then upload it back to the server.
 
58Resnick                     Standards Track                     [Page 1]
 
60RFC 4469                IMAP CATENATE Extension               April 2006
 
65   The CATENATE extension to the Internet Message Access Protocol (IMAP)
 
66   [1] allows the client to create a message on the server that can
 
67   include the text of messages (or parts of messages) that already
 
68   exist on the server without having to FETCH them and APPEND them back
 
69   to the server.  The CATENATE extension extends the APPEND command so
 
70   that, instead of a single message literal, the command can take as
 
71   arguments any combination of message literals (as described in IMAP
 
72   [1]) and message URLs (as described in the IMAP URL Scheme [2]
 
73   specification).  The server takes all the pieces and catenates them
 
74   into the output message.  The CATENATE extension can also coexist
 
75   with the MULTIAPPEND extension [3] to APPEND multiple messages in a
 
78   There are some obvious uses for the CATENATE extension.  The
 
79   motivating use case was to provide a way for a resource-constrained
 
80   client to compose a message for subsequent submission that contains
 
81   data that already exists in that client's IMAP store.  Because the
 
82   client does not have to download and re-upload potentially large
 
83   message parts, bandwidth and processing limitations do not have as
 
84   much impact.  In addition, since the client can create a message in
 
85   its own IMAP store, the command also addresses the desire of the
 
86   client to archive a copy of a sent message without having to upload
 
87   the message twice.  (Mechanisms for sending the message are outside
 
88   the scope of this document.)
 
90   The extended APPEND command can also be used to copy parts of a
 
91   message to another mailbox for archival purposes while getting rid of
 
92   undesired parts.  In environments where server storage is limited, a
 
93   client could get rid of large message parts by copying over only the
 
94   necessary parts and then deleting the original message.  The
 
95   mechanism could also be used to add data to a message (such as
 
96   prepending message header fields) or to include other data by making
 
97   a copy of the original and catenating the new data.
 
992.  The CATENATE Capability
 
101   A server that supports this extension returns "CATENATE" as one of
 
102   the responses to the CAPABILITY command.
 
114Resnick                     Standards Track                     [Page 2]
 
116RFC 4469                IMAP CATENATE Extension               April 2006
 
121   Arguments:  mailbox name
 
122               (The following can be repeated in the presence of the
 
123               MULTIAPPEND extension [3])
 
124               OPTIONAL flag parenthesized list
 
125               OPTIONAL date/time string
 
126               a single message literal or one or more message parts to
 
127               catenate, specified as:
 
130                           message (or message part) URL
 
132   Responses:  OPTIONAL NO responses: BADURL, TOOBIG
 
134   Result:     OK -  append completed
 
135               NO -  append error: can't append to that mailbox, error
 
136                     in flags or date/time or message text, or can't
 
138               BAD - command unknown or arguments invalid
 
140   The APPEND command concatenates all the message parts and appends
 
141   them as a new message to the end of the specified mailbox.  The
 
142   parenthesized flag list and date/time string set the flags and the
 
143   internal date, respectively, as described in IMAP [1].  The
 
144   subsequent command parameters specify the message parts that are
 
145   appended sequentially to the output message.
 
147   If the original form of APPEND is used, a message literal follows the
 
148   optional flag list and date/time string, which is appended as
 
149   described in IMAP [1].  If the extended form is used, "CATENATE" and
 
150   a parenthesized list of message literals and message URLs follows,
 
151   each of which is appended to the new message.  If a message literal
 
152   is specified (indicated by "TEXT"), the octets following the count
 
153   are appended.  If a message URL is specified (indicated by "URL"),
 
154   the octets of the body part pointed to by that URL are appended, as
 
155   if the literal returned in a FETCH BODY response were put in place of
 
156   the message part specifier.  The APPEND command does not cause the
 
157   \Seen flag to be set for any catenated body part.  The APPEND command
 
158   does not change the selected mailbox.
 
160   In the extended APPEND command, the string following "URL" is an IMAP
 
161   URL [2] and is interpreted according to the rules of [2].  The
 
162   present document only describes the behavior of the command using
 
163   IMAP URLs that refer to specific messages or message parts on the
 
164   current IMAP server from the current authenticated IMAP session.
 
165   Because of that, only relative IMAP message or message part URLs
 
166   (i.e., those having no scheme or <iserver>) are used.  The base URL
 
170Resnick                     Standards Track                     [Page 3]
 
172RFC 4469                IMAP CATENATE Extension               April 2006
 
175   for evaluating the relative URL is considered "imap://user@server/",
 
176   where "user" is the user name of the currently authenticated user and
 
177   "server" is the domain name of the current server.  When in the
 
178   selected state, the base URL is considered
 
179   "imap://user@server/mailbox", where "mailbox" is the encoded name of
 
180   the currently selected mailbox.  Additionally, since the APPEND
 
181   command is valid in the authenticated state of an IMAP session, no
 
182   further LOGIN or AUTHENTICATE command is performed for URLs specified
 
183   in the extended APPEND command.
 
185      Note: Use of an absolute IMAP URL or any URL that refers to
 
186      anything other than a message or message part from the current
 
187      authenticated IMAP session is outside the scope of this document
 
188      and would require an extension to this specification, and a server
 
189      implementing only this specification would return NO to such a
 
192   The client is responsible for making sure that the catenated message
 
193   is in the format of an Internet Message Format (RFC 2822) [4] or
 
194   Multipurpose Internet Mail Extension (MIME) [5] message.  In
 
195   particular, when a URL is catenated, the server copies octets,
 
196   unchanged, from the indicated message or message part to the
 
197   catenated message.  It does no data conversion (e.g., MIME transfer
 
198   encodings) nor any verification that the data is appropriate for the
 
199   MIME part of the message into which it is inserted.  The client is
 
200   also responsible for inserting appropriate MIME boundaries between
 
201   body parts, and writing MIME Content-Type and Content-Transfer-
 
202   Encoding lines as needed in the appropriate places.
 
204   Responses behave just as the original APPEND command described in
 
205   IMAP [1].  If the server implements the IMAP UIDPLUS extension [6],
 
206   it will also return an APPENDUID response code in the tagged OK
 
207   response.  Two response codes are provided in Section 4 that can be
 
208   used in the tagged NO response if the APPEND command fails.
 
212   When a APPEND command fails, it may return a response code that
 
213   describes a reason for the failure.
 
217   The BADURL response code is returned if the APPEND fails to process
 
218   one of the specified URLs.  Possible reasons for this are bad URL
 
219   syntax, unrecognized URL schema, invalid message UID, or invalid body
 
220   part.  The BADURL response code contains the first URL specified as a
 
221   parameter to the APPEND command that has caused the operation to
 
226Resnick                     Standards Track                     [Page 4]
 
228RFC 4469                IMAP CATENATE Extension               April 2006
 
233   The TOOBIG response code is returned if the resulting message will
 
234   exceed the 4-GB IMAP message limit.  This might happen, for example,
 
235   if the client specifies 3 URLs for 2-GB messages.  Note that even if
 
236   the server doesn't return TOOBIG, it still has to be defensive
 
237   against misbehaving or malicious clients that try to construct a
 
238   message over the 4-GB limit.  The server may also wish to return the
 
239   TOOBIG response code if the resulting message exceeds a server-
 
240   specific message size limit.
 
244   The following syntax specification uses the Augmented Backus-Naur
 
245   Form (ABNF) [7] notation.  Elements not defined here can be found in
 
246   the formal syntax of the ABNF [7], IMAP [1], and IMAP ABNF extensions
 
247   [8] specifications.  Note that capability and resp-text-code are
 
248   extended from the IMAP [1] specification and append-data is extended
 
249   from the IMAP ABNF extensions [8] specification.
 
251   append-data =/ "CATENATE" SP "(" cat-part *(SP cat-part) ")"
 
253   cat-part = text-literal / url
 
255   text-literal = "TEXT" SP literal
 
257   url = "URL" SP astring
 
259   resp-text-code =/ toobig-response-code / badurl-response-code
 
261   toobig-response-code = "TOOBIG"
 
263   badurl-response-code = "BADURL" SP url-resp-text
 
265   url-resp-text = 1*(%x01-09 /
 
268                      %x5D-FE) ; Any TEXT-CHAR except "]"
 
270   capability =/ "CATENATE"
 
272   The astring in the definition of url and the url-resp-text in the
 
273   definition of badurl-response-code each contain an imapurl as defined
 
282Resnick                     Standards Track                     [Page 5]
 
284RFC 4469                IMAP CATENATE Extension               April 2006
 
289   Thanks to the members of the LEMONADE working group for their input.
 
290   Special thanks to Alexey Melnikov for the examples.
 
2927.  Security Considerations
 
294   The CATENATE extension does not raise any security considerations
 
295   that are not present for the base protocol or in the use of IMAP
 
296   URLs, and these issues are discussed in the IMAP [1] and IMAP URL [2]
 
2998.  IANA Considerations
 
301   IMAP4 capabilities are registered by publishing a standards track or
 
302   IESG approved experimental RFC.  The registry is currently located at
 
303   <http://www.iana.org/assignments/imap4-capabilities>.  This document
 
304   defines the CATENATE IMAP capability.  The IANA has added this
 
305   capability to the registry.
 
338Resnick                     Standards Track                     [Page 6]
 
340RFC 4469                IMAP CATENATE Extension               April 2006
 
345   Lines not starting with "C: " or "S: " are continuations of the
 
348   The original message in examples 1 and 2 below (UID = 20) has the
 
352      multipart/mixed MIME message with two body parts:
 
356      2.  application/x-zip-compressed
 
358   Example 1: The following example demonstrates how a CATENATE client
 
359   can replace an attachment in a draft message, without the need to
 
360   download it to the client and upload it back.
 
362   C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE
 
363    (URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=HEADER"
 
365   S: + Ready for literal data
 
367   C: --------------030308070208000400050907
 
368   C:  URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=1.MIME"
 
369    URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=1" TEXT {42}
 
370   S: + Ready for literal data
 
372   C: --------------030308070208000400050907
 
373   C:  URL "/Drafts;UIDVALIDITY=385759045/;UID=30" TEXT {44}
 
374   S: + Ready for literal data
 
376   C: --------------030308070208000400050907--
 
378   S: A003 OK catenate append completed
 
394Resnick                     Standards Track                     [Page 7]
 
396RFC 4469                IMAP CATENATE Extension               April 2006
 
399   Example 2: The following example demonstrates how the CATENATE
 
400   extension can be used to replace edited text in a draft message, as
 
401   well as header fields for the top level message part (e.g., Subject
 
402   has changed).  The previous version of the draft is marked as
 
403   \Deleted.  Note that the server also supports the UIDPLUS extension,
 
404   so the APPENDUID response code is returned in the successful OK
 
405   response to the APPEND command.
 
407   C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE (TEXT {738}
 
408   S: + Ready for literal data
 
409   C: Return-Path: <bar@example.org>
 
410   C: Received: from [127.0.0.2]
 
411   C:           by rufus.example.org via TCP (internal) with ESMTPA;
 
412   C:           Thu, 11 Nov 2004 16:57:07 +0000
 
413   C: Message-ID: <419399E1.6000505@example.org>
 
414   C: Date: Thu, 12 Nov 2004 16:57:05 +0000
 
415   C: From: Bob Ar <bar@example.org>
 
416   C: X-Accept-Language: en-us, en
 
418   C: To: foo@example.net
 
419   C: Subject: About our holiday trip
 
420   C: Content-Type: multipart/mixed;
 
421   C:               boundary="------------030308070208000400050907"
 
423   C: --------------030308070208000400050907
 
424   C: Content-Type: text/plain; charset=us-ascii; format=flowed
 
425   C: Content-Transfer-Encoding: 7bit
 
427   C: Our travel agent has sent the updated schedule.
 
431   C: --------------030308070208000400050907
 
432   C:  URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;Section=2.MIME"
 
433    URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;Section=2" TEXT {44}
 
434   S: + Ready for literal data
 
436   C: --------------030308070208000400050907--
 
438   S: A003 OK [APPENDUID 385759045 45] append Completed
 
439   C: A004 UID STORE 20 +FLAGS.SILENT (\Deleted)
 
440   S: A004 OK STORE completed
 
450Resnick                     Standards Track                     [Page 8]
 
452RFC 4469                IMAP CATENATE Extension               April 2006
 
455   Example 3: The following example demonstrates how the CATENATE
 
456   extension can be used to strip attachments.  Below, a PowerPoint
 
457   attachment was replaced by a small text part explaining that the
 
458   attachment was stripped.
 
460   C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE
 
461    (URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=HEADER"
 
463   S: + Ready for literal data
 
465   C: --------------030308070208000400050903
 
466   C:  URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=1.MIME"
 
467    URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=1" TEXT {255}
 
468   S: + Ready for literal data
 
470   C: --------------030308070208000400050903
 
471   C: Content-type: text/plain; charset="us-ascii"
 
472   C: Content-transfer-encoding: 7bit
 
474   C: This body part contained a Power Point presentation that was
 
475   C: deleted upon your request.
 
476   C: --------------030308070208000400050903--
 
478   S: A003 OK append Completed
 
506Resnick                     Standards Track                     [Page 9]
 
508RFC 4469                IMAP CATENATE Extension               April 2006
 
511   Example 4: The following example demonstrates a failed APPEND
 
512   command.  The server returns the BADURL response code to indicate
 
513   that one of the provided URLs is invalid.  This example also
 
514   demonstrates how the CATENATE extension can be used to construct a
 
515   digest of several messages.
 
517   C: A003 APPEND Sent (\Seen $MDNSent) CATENATE (TEXT {541}
 
518   S: + Ready for literal data
 
519   C: Return-Path: <foo@example.org>
 
520   C: Received: from [127.0.0.2]
 
521   C:           by rufus.example.org via TCP (internal) with ESMTPA;
 
522   C:           Thu, 11 Nov 2004 16:57:07 +0000
 
523   C: Message-ID: <419399E1.6000505@example.org>
 
524   C: Date: Thu, 21 Nov 2004 16:57:05 +0000
 
525   C: From: Farren Oo <foo@example.org>
 
526   C: X-Accept-Language: en-us, en
 
528   C: To: bar@example.org
 
529   C: Subject: Digest of the mailing list for today
 
530   C: Content-Type: multipart/digest;
 
531   C:               boundary="------------030308070208000400050904"
 
533   C: --------------030308070208000400050904
 
534   C:  URL "/INBOX;UIDVALIDITY=785799047/;UID=11467" TEXT {42}
 
535   S: + Ready for literal data
 
537   C: --------------030308070208000400050904
 
538   C:  URL "/INBOX;UIDVALIDITY=785799047/;UID=113330/;section=1.5.9"
 
540   S: + Ready for literal data
 
542   C: --------------030308070208000400050904
 
543   C:  URL "/INBOX;UIDVALIDITY=785799047/;UID=11916" TEXT {44}
 
544   S: + Ready for literal data
 
546   C: --------------030308070208000400050904--
 
548   S: A003 NO [BADURL "/INBOX;UIDVALIDITY=785799047/;UID=113330;
 
549   section=1.5.9"] CATENATE append has failed, one message expunged
 
551   Note that the server could have validated the URLs as they were
 
552   received and therefore could have returned the tagged NO response
 
553   with BADURL response-code in place of any continuation request after
 
554   the URL was received.
 
562Resnick                     Standards Track                    [Page 10]
 
564RFC 4469                IMAP CATENATE Extension               April 2006
 
5679.  Normative References
 
569   [1]  Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1",
 
570        RFC 3501, March 2003.
 
572   [2]  Newman, C., "IMAP URL Scheme", RFC 2192, September 1997.
 
574   [3]  Crispin, M., "Internet Message Access Protocol (IMAP) -
 
575        MULTIAPPEND Extension", RFC 3502, March 2003.
 
577   [4]  Resnick, P., "Internet Message Format", RFC 2822, April 2001.
 
579   [5]  Freed, N. and N. Borenstein, "Multipurpose Internet Mail
 
580        Extensions (MIME) Part One: Format of Internet Message Bodies",
 
581        RFC 2045, November 1996.
 
583   [6]  Crispin, M., "Internet Message Access Protocol (IMAP) - UIDPLUS
 
584        extension", RFC 4315, December 2005.
 
586   [7]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
 
587        Specifications: ABNF", RFC 4234, October 2005.
 
589   [8]  Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4 ABNF",
 
590        RFC 4466, April 2006.
 
618Resnick                     Standards Track                    [Page 11]
 
620RFC 4469                IMAP CATENATE Extension               April 2006
 
626   QUALCOMM Incorporated
 
628   San Diego, CA  92121-1714
 
631   Phone: +1 858 651 4478
 
632   EMail: presnick@qualcomm.com
 
633   URI:   http://www.qualcomm.com/~presnick/
 
674Resnick                     Standards Track                    [Page 12]
 
676RFC 4469                IMAP CATENATE Extension               April 2006
 
679Full Copyright Statement
 
681   Copyright (C) The Internet Society (2006).
 
683   This document is subject to the rights, licenses and restrictions
 
684   contained in BCP 78, and except as set forth therein, the authors
 
685   retain all their rights.
 
687   This document and the information contained herein are provided on an
 
688   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
 
689   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
 
690   ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
 
691   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
 
692   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
 
693   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 
697   The IETF takes no position regarding the validity or scope of any
 
698   Intellectual Property Rights or other rights that might be claimed to
 
699   pertain to the implementation or use of the technology described in
 
700   this document or the extent to which any license under such rights
 
701   might or might not be available; nor does it represent that it has
 
702   made any independent effort to identify any such rights.  Information
 
703   on the procedures with respect to rights in RFC documents can be
 
704   found in BCP 78 and BCP 79.
 
706   Copies of IPR disclosures made to the IETF Secretariat and any
 
707   assurances of licenses to be made available, or the result of an
 
708   attempt made to obtain a general license or permission for the use of
 
709   such proprietary rights by implementers or users of this
 
710   specification can be obtained from the IETF on-line IPR repository at
 
711   http://www.ietf.org/ipr.
 
713   The IETF invites any interested party to bring to its attention any
 
714   copyrights, patents or patent applications, or other proprietary
 
715   rights that may cover technology that may be required to implement
 
716   this standard.  Please address the information to the IETF at
 
721   Funding for the RFC Editor function is provided by the IETF
 
722   Administrative Support Activity (IASA).
 
730Resnick                     Standards Track                    [Page 13]