rfc4469.IMAP_CATENATE_extension.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. Network Working Group P. Resnick
  2. Request for Comments: 4469 QUALCOMM Incorporated
  3. Updates: 3501, 3502 April 2006
  4. Category: Standards Track
  5. Internet Message Access Protocol (IMAP) CATENATE Extension
  6. Status of This Memo
  7. This document specifies an Internet standards track protocol for the
  8. Internet community, and requests discussion and suggestions for
  9. improvements. Please refer to the current edition of the "Internet
  10. Official Protocol Standards" (STD 1) for the standardization state
  11. and status of this protocol. Distribution of this memo is unlimited.
  12. Copyright Notice
  13. Copyright (C) The Internet Society (2006).
  14. Abstract
  15. The CATENATE extension to the Internet Message Access Protocol (IMAP)
  16. extends the APPEND command to allow clients to create messages on the
  17. IMAP server that may contain a combination of new data along with
  18. parts of (or entire) messages already on the server. Using this
  19. extension, the client can catenate parts of an already existing
  20. message onto a new message without having to first download the data
  21. and then upload it back to the server.
  22. Resnick Standards Track [Page 1]
  23. RFC 4469 IMAP CATENATE Extension April 2006
  24. 1. Introduction
  25. The CATENATE extension to the Internet Message Access Protocol (IMAP)
  26. [1] allows the client to create a message on the server that can
  27. include the text of messages (or parts of messages) that already
  28. exist on the server without having to FETCH them and APPEND them back
  29. to the server. The CATENATE extension extends the APPEND command so
  30. that, instead of a single message literal, the command can take as
  31. arguments any combination of message literals (as described in IMAP
  32. [1]) and message URLs (as described in the IMAP URL Scheme [2]
  33. specification). The server takes all the pieces and catenates them
  34. into the output message. The CATENATE extension can also coexist
  35. with the MULTIAPPEND extension [3] to APPEND multiple messages in a
  36. single command.
  37. There are some obvious uses for the CATENATE extension. The
  38. motivating use case was to provide a way for a resource-constrained
  39. client to compose a message for subsequent submission that contains
  40. data that already exists in that client's IMAP store. Because the
  41. client does not have to download and re-upload potentially large
  42. message parts, bandwidth and processing limitations do not have as
  43. much impact. In addition, since the client can create a message in
  44. its own IMAP store, the command also addresses the desire of the
  45. client to archive a copy of a sent message without having to upload
  46. the message twice. (Mechanisms for sending the message are outside
  47. the scope of this document.)
  48. The extended APPEND command can also be used to copy parts of a
  49. message to another mailbox for archival purposes while getting rid of
  50. undesired parts. In environments where server storage is limited, a
  51. client could get rid of large message parts by copying over only the
  52. necessary parts and then deleting the original message. The
  53. mechanism could also be used to add data to a message (such as
  54. prepending message header fields) or to include other data by making
  55. a copy of the original and catenating the new data.
  56. 2. The CATENATE Capability
  57. A server that supports this extension returns "CATENATE" as one of
  58. the responses to the CAPABILITY command.
  59. Resnick Standards Track [Page 2]
  60. RFC 4469 IMAP CATENATE Extension April 2006
  61. 3. The APPEND Command
  62. Arguments: mailbox name
  63. (The following can be repeated in the presence of the
  64. MULTIAPPEND extension [3])
  65. OPTIONAL flag parenthesized list
  66. OPTIONAL date/time string
  67. a single message literal or one or more message parts to
  68. catenate, specified as:
  69. message literal
  70. or
  71. message (or message part) URL
  72. Responses: OPTIONAL NO responses: BADURL, TOOBIG
  73. Result: OK - append completed
  74. NO - append error: can't append to that mailbox, error
  75. in flags or date/time or message text, or can't
  76. fetch that data
  77. BAD - command unknown or arguments invalid
  78. The APPEND command concatenates all the message parts and appends
  79. them as a new message to the end of the specified mailbox. The
  80. parenthesized flag list and date/time string set the flags and the
  81. internal date, respectively, as described in IMAP [1]. The
  82. subsequent command parameters specify the message parts that are
  83. appended sequentially to the output message.
  84. If the original form of APPEND is used, a message literal follows the
  85. optional flag list and date/time string, which is appended as
  86. described in IMAP [1]. If the extended form is used, "CATENATE" and
  87. a parenthesized list of message literals and message URLs follows,
  88. each of which is appended to the new message. If a message literal
  89. is specified (indicated by "TEXT"), the octets following the count
  90. are appended. If a message URL is specified (indicated by "URL"),
  91. the octets of the body part pointed to by that URL are appended, as
  92. if the literal returned in a FETCH BODY response were put in place of
  93. the message part specifier. The APPEND command does not cause the
  94. \Seen flag to be set for any catenated body part. The APPEND command
  95. does not change the selected mailbox.
  96. In the extended APPEND command, the string following "URL" is an IMAP
  97. URL [2] and is interpreted according to the rules of [2]. The
  98. present document only describes the behavior of the command using
  99. IMAP URLs that refer to specific messages or message parts on the
  100. current IMAP server from the current authenticated IMAP session.
  101. Because of that, only relative IMAP message or message part URLs
  102. (i.e., those having no scheme or <iserver>) are used. The base URL
  103. Resnick Standards Track [Page 3]
  104. RFC 4469 IMAP CATENATE Extension April 2006
  105. for evaluating the relative URL is considered "imap://user@server/",
  106. where "user" is the user name of the currently authenticated user and
  107. "server" is the domain name of the current server. When in the
  108. selected state, the base URL is considered
  109. "imap://user@server/mailbox", where "mailbox" is the encoded name of
  110. the currently selected mailbox. Additionally, since the APPEND
  111. command is valid in the authenticated state of an IMAP session, no
  112. further LOGIN or AUTHENTICATE command is performed for URLs specified
  113. in the extended APPEND command.
  114. Note: Use of an absolute IMAP URL or any URL that refers to
  115. anything other than a message or message part from the current
  116. authenticated IMAP session is outside the scope of this document
  117. and would require an extension to this specification, and a server
  118. implementing only this specification would return NO to such a
  119. request.
  120. The client is responsible for making sure that the catenated message
  121. is in the format of an Internet Message Format (RFC 2822) [4] or
  122. Multipurpose Internet Mail Extension (MIME) [5] message. In
  123. particular, when a URL is catenated, the server copies octets,
  124. unchanged, from the indicated message or message part to the
  125. catenated message. It does no data conversion (e.g., MIME transfer
  126. encodings) nor any verification that the data is appropriate for the
  127. MIME part of the message into which it is inserted. The client is
  128. also responsible for inserting appropriate MIME boundaries between
  129. body parts, and writing MIME Content-Type and Content-Transfer-
  130. Encoding lines as needed in the appropriate places.
  131. Responses behave just as the original APPEND command described in
  132. IMAP [1]. If the server implements the IMAP UIDPLUS extension [6],
  133. it will also return an APPENDUID response code in the tagged OK
  134. response. Two response codes are provided in Section 4 that can be
  135. used in the tagged NO response if the APPEND command fails.
  136. 4. Response Codes
  137. When a APPEND command fails, it may return a response code that
  138. describes a reason for the failure.
  139. 4.1. BADURL Response
  140. The BADURL response code is returned if the APPEND fails to process
  141. one of the specified URLs. Possible reasons for this are bad URL
  142. syntax, unrecognized URL schema, invalid message UID, or invalid body
  143. part. The BADURL response code contains the first URL specified as a
  144. parameter to the APPEND command that has caused the operation to
  145. fail.
  146. Resnick Standards Track [Page 4]
  147. RFC 4469 IMAP CATENATE Extension April 2006
  148. 4.2. TOOBIG Response
  149. The TOOBIG response code is returned if the resulting message will
  150. exceed the 4-GB IMAP message limit. This might happen, for example,
  151. if the client specifies 3 URLs for 2-GB messages. Note that even if
  152. the server doesn't return TOOBIG, it still has to be defensive
  153. against misbehaving or malicious clients that try to construct a
  154. message over the 4-GB limit. The server may also wish to return the
  155. TOOBIG response code if the resulting message exceeds a server-
  156. specific message size limit.
  157. 5. Formal Syntax
  158. The following syntax specification uses the Augmented Backus-Naur
  159. Form (ABNF) [7] notation. Elements not defined here can be found in
  160. the formal syntax of the ABNF [7], IMAP [1], and IMAP ABNF extensions
  161. [8] specifications. Note that capability and resp-text-code are
  162. extended from the IMAP [1] specification and append-data is extended
  163. from the IMAP ABNF extensions [8] specification.
  164. append-data =/ "CATENATE" SP "(" cat-part *(SP cat-part) ")"
  165. cat-part = text-literal / url
  166. text-literal = "TEXT" SP literal
  167. url = "URL" SP astring
  168. resp-text-code =/ toobig-response-code / badurl-response-code
  169. toobig-response-code = "TOOBIG"
  170. badurl-response-code = "BADURL" SP url-resp-text
  171. url-resp-text = 1*(%x01-09 /
  172. %x0B-0C /
  173. %x0E-5B /
  174. %x5D-FE) ; Any TEXT-CHAR except "]"
  175. capability =/ "CATENATE"
  176. The astring in the definition of url and the url-resp-text in the
  177. definition of badurl-response-code each contain an imapurl as defined
  178. by [2].
  179. Resnick Standards Track [Page 5]
  180. RFC 4469 IMAP CATENATE Extension April 2006
  181. 6. Acknowledgements
  182. Thanks to the members of the LEMONADE working group for their input.
  183. Special thanks to Alexey Melnikov for the examples.
  184. 7. Security Considerations
  185. The CATENATE extension does not raise any security considerations
  186. that are not present for the base protocol or in the use of IMAP
  187. URLs, and these issues are discussed in the IMAP [1] and IMAP URL [2]
  188. documents.
  189. 8. IANA Considerations
  190. IMAP4 capabilities are registered by publishing a standards track or
  191. IESG approved experimental RFC. The registry is currently located at
  192. <http://www.iana.org/assignments/imap4-capabilities>. This document
  193. defines the CATENATE IMAP capability. The IANA has added this
  194. capability to the registry.
  195. Resnick Standards Track [Page 6]
  196. RFC 4469 IMAP CATENATE Extension April 2006
  197. Appendix A. Examples
  198. Lines not starting with "C: " or "S: " are continuations of the
  199. previous lines.
  200. The original message in examples 1 and 2 below (UID = 20) has the
  201. following structure:
  202. multipart/mixed MIME message with two body parts:
  203. 1. text/plain
  204. 2. application/x-zip-compressed
  205. Example 1: The following example demonstrates how a CATENATE client
  206. can replace an attachment in a draft message, without the need to
  207. download it to the client and upload it back.
  208. C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE
  209. (URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=HEADER"
  210. TEXT {42}
  211. S: + Ready for literal data
  212. C:
  213. C: --------------030308070208000400050907
  214. C: URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=1.MIME"
  215. URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;section=1" TEXT {42}
  216. S: + Ready for literal data
  217. C:
  218. C: --------------030308070208000400050907
  219. C: URL "/Drafts;UIDVALIDITY=385759045/;UID=30" TEXT {44}
  220. S: + Ready for literal data
  221. C:
  222. C: --------------030308070208000400050907--
  223. C: )
  224. S: A003 OK catenate append completed
  225. Resnick Standards Track [Page 7]
  226. RFC 4469 IMAP CATENATE Extension April 2006
  227. Example 2: The following example demonstrates how the CATENATE
  228. extension can be used to replace edited text in a draft message, as
  229. well as header fields for the top level message part (e.g., Subject
  230. has changed). The previous version of the draft is marked as
  231. \Deleted. Note that the server also supports the UIDPLUS extension,
  232. so the APPENDUID response code is returned in the successful OK
  233. response to the APPEND command.
  234. C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE (TEXT {738}
  235. S: + Ready for literal data
  236. C: Return-Path: <bar@example.org>
  237. C: Received: from [127.0.0.2]
  238. C: by rufus.example.org via TCP (internal) with ESMTPA;
  239. C: Thu, 11 Nov 2004 16:57:07 +0000
  240. C: Message-ID: <419399E1.6000505@example.org>
  241. C: Date: Thu, 12 Nov 2004 16:57:05 +0000
  242. C: From: Bob Ar <bar@example.org>
  243. C: X-Accept-Language: en-us, en
  244. C: MIME-Version: 1.0
  245. C: To: foo@example.net
  246. C: Subject: About our holiday trip
  247. C: Content-Type: multipart/mixed;
  248. C: boundary="------------030308070208000400050907"
  249. C:
  250. C: --------------030308070208000400050907
  251. C: Content-Type: text/plain; charset=us-ascii; format=flowed
  252. C: Content-Transfer-Encoding: 7bit
  253. C:
  254. C: Our travel agent has sent the updated schedule.
  255. C:
  256. C: Cheers,
  257. C: Bob
  258. C: --------------030308070208000400050907
  259. C: URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;Section=2.MIME"
  260. URL "/Drafts;UIDVALIDITY=385759045/;UID=20/;Section=2" TEXT {44}
  261. S: + Ready for literal data
  262. C:
  263. C: --------------030308070208000400050907--
  264. C: )
  265. S: A003 OK [APPENDUID 385759045 45] append Completed
  266. C: A004 UID STORE 20 +FLAGS.SILENT (\Deleted)
  267. S: A004 OK STORE completed
  268. Resnick Standards Track [Page 8]
  269. RFC 4469 IMAP CATENATE Extension April 2006
  270. Example 3: The following example demonstrates how the CATENATE
  271. extension can be used to strip attachments. Below, a PowerPoint
  272. attachment was replaced by a small text part explaining that the
  273. attachment was stripped.
  274. C: A003 APPEND Drafts (\Seen \Draft $MDNSent) CATENATE
  275. (URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=HEADER"
  276. TEXT {42}
  277. S: + Ready for literal data
  278. C:
  279. C: --------------030308070208000400050903
  280. C: URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=1.MIME"
  281. URL "/Drafts;UIDVALIDITY=385759045/;UID=21/;section=1" TEXT {255}
  282. S: + Ready for literal data
  283. C:
  284. C: --------------030308070208000400050903
  285. C: Content-type: text/plain; charset="us-ascii"
  286. C: Content-transfer-encoding: 7bit
  287. C:
  288. C: This body part contained a Power Point presentation that was
  289. C: deleted upon your request.
  290. C: --------------030308070208000400050903--
  291. C: )
  292. S: A003 OK append Completed
  293. Resnick Standards Track [Page 9]
  294. RFC 4469 IMAP CATENATE Extension April 2006
  295. Example 4: The following example demonstrates a failed APPEND
  296. command. The server returns the BADURL response code to indicate
  297. that one of the provided URLs is invalid. This example also
  298. demonstrates how the CATENATE extension can be used to construct a
  299. digest of several messages.
  300. C: A003 APPEND Sent (\Seen $MDNSent) CATENATE (TEXT {541}
  301. S: + Ready for literal data
  302. C: Return-Path: <foo@example.org>
  303. C: Received: from [127.0.0.2]
  304. C: by rufus.example.org via TCP (internal) with ESMTPA;
  305. C: Thu, 11 Nov 2004 16:57:07 +0000
  306. C: Message-ID: <419399E1.6000505@example.org>
  307. C: Date: Thu, 21 Nov 2004 16:57:05 +0000
  308. C: From: Farren Oo <foo@example.org>
  309. C: X-Accept-Language: en-us, en
  310. C: MIME-Version: 1.0
  311. C: To: bar@example.org
  312. C: Subject: Digest of the mailing list for today
  313. C: Content-Type: multipart/digest;
  314. C: boundary="------------030308070208000400050904"
  315. C:
  316. C: --------------030308070208000400050904
  317. C: URL "/INBOX;UIDVALIDITY=785799047/;UID=11467" TEXT {42}
  318. S: + Ready for literal data
  319. C:
  320. C: --------------030308070208000400050904
  321. C: URL "/INBOX;UIDVALIDITY=785799047/;UID=113330/;section=1.5.9"
  322. TEXT {42}
  323. S: + Ready for literal data
  324. C:
  325. C: --------------030308070208000400050904
  326. C: URL "/INBOX;UIDVALIDITY=785799047/;UID=11916" TEXT {44}
  327. S: + Ready for literal data
  328. C:
  329. C: --------------030308070208000400050904--
  330. C: )
  331. S: A003 NO [BADURL "/INBOX;UIDVALIDITY=785799047/;UID=113330;
  332. section=1.5.9"] CATENATE append has failed, one message expunged
  333. Note that the server could have validated the URLs as they were
  334. received and therefore could have returned the tagged NO response
  335. with BADURL response-code in place of any continuation request after
  336. the URL was received.
  337. Resnick Standards Track [Page 10]
  338. RFC 4469 IMAP CATENATE Extension April 2006
  339. 9. Normative References
  340. [1] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1",
  341. RFC 3501, March 2003.
  342. [2] Newman, C., "IMAP URL Scheme", RFC 2192, September 1997.
  343. [3] Crispin, M., "Internet Message Access Protocol (IMAP) -
  344. MULTIAPPEND Extension", RFC 3502, March 2003.
  345. [4] Resnick, P., "Internet Message Format", RFC 2822, April 2001.
  346. [5] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  347. Extensions (MIME) Part One: Format of Internet Message Bodies",
  348. RFC 2045, November 1996.
  349. [6] Crispin, M., "Internet Message Access Protocol (IMAP) - UIDPLUS
  350. extension", RFC 4315, December 2005.
  351. [7] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  352. Specifications: ABNF", RFC 4234, October 2005.
  353. [8] Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4 ABNF",
  354. RFC 4466, April 2006.
  355. Resnick Standards Track [Page 11]
  356. RFC 4469 IMAP CATENATE Extension April 2006
  357. Author's Address
  358. Peter W. Resnick
  359. QUALCOMM Incorporated
  360. 5775 Morehouse Drive
  361. San Diego, CA 92121-1714
  362. US
  363. Phone: +1 858 651 4478
  364. EMail: presnick@qualcomm.com
  365. URI: http://www.qualcomm.com/~presnick/
  366. Resnick Standards Track [Page 12]
  367. RFC 4469 IMAP CATENATE Extension April 2006
  368. Full Copyright Statement
  369. Copyright (C) The Internet Society (2006).
  370. This document is subject to the rights, licenses and restrictions
  371. contained in BCP 78, and except as set forth therein, the authors
  372. retain all their rights.
  373. This document and the information contained herein are provided on an
  374. "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
  375. OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
  376. ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
  377. INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
  378. INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
  379. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  380. Intellectual Property
  381. The IETF takes no position regarding the validity or scope of any
  382. Intellectual Property Rights or other rights that might be claimed to
  383. pertain to the implementation or use of the technology described in
  384. this document or the extent to which any license under such rights
  385. might or might not be available; nor does it represent that it has
  386. made any independent effort to identify any such rights. Information
  387. on the procedures with respect to rights in RFC documents can be
  388. found in BCP 78 and BCP 79.
  389. Copies of IPR disclosures made to the IETF Secretariat and any
  390. assurances of licenses to be made available, or the result of an
  391. attempt made to obtain a general license or permission for the use of
  392. such proprietary rights by implementers or users of this
  393. specification can be obtained from the IETF on-line IPR repository at
  394. http://www.ietf.org/ipr.
  395. The IETF invites any interested party to bring to its attention any
  396. copyrights, patents or patent applications, or other proprietary
  397. rights that may cover technology that may be required to implement
  398. this standard. Please address the information to the IETF at
  399. ietf-ipr@ietf.org.
  400. Acknowledgement
  401. Funding for the RFC Editor function is provided by the IETF
  402. Administrative Support Activity (IASA).
  403. Resnick Standards Track [Page 13]