rfc3502.MULTIAPPEND_extension.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. Network Working Group M. Crispin
  2. Request for Comments: 3502 University of Washington
  3. Category: Standards Track March 2003
  4. Internet Message Access Protocol (IMAP) - MULTIAPPEND Extension
  5. Status of this Memo
  6. This document specifies an Internet standards track protocol for the
  7. Internet community, and requests discussion and suggestions for
  8. improvements. Please refer to the current edition of the "Internet
  9. Official Protocol Standards" (STD 1) for the standardization state
  10. and status of this protocol. Distribution of this memo is unlimited.
  11. Copyright Notice
  12. Copyright (C) The Internet Society (2003). All Rights Reserved.
  13. Abstract
  14. This document describes the multiappending extension to the Internet
  15. Message Access Protocol (IMAP) (RFC 3501). This extension provides
  16. substantial performance improvements for IMAP clients which upload
  17. multiple messages at a time to a mailbox on the server.
  18. A server which supports this extension indicates this with a
  19. capability name of "MULTIAPPEND".
  20. Terminology
  21. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  22. "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in this document are to
  23. be interpreted as described in [KEYWORDS].
  24. Introduction
  25. The MULTIAPPEND extension permits uploading of multiple messages with
  26. a single command. When used in conjunction with the [LITERAL+]
  27. extension, the entire upload is accomplished in a single
  28. command/response round trip.
  29. A MULTIAPPEND APPEND operation is atomic; either all messages are
  30. successfully appended, or no messages are appended.
  31. In the base IMAP specification, each message must be appended in a
  32. separate command, and there is no mechanism to "unappend" messages if
  33. an error occurs while appending. Also, some mail stores may require
  34. Crispin Standards Track [Page 1]
  35. RFC 3502 IMAP MULTIAPPEND March 2003
  36. an expensive "open/lock + sync/unlock/close" operation as part of
  37. appending; this can be quite expensive if it must be done on a
  38. per-message basis.
  39. If the server supports both LITERAL+ and pipelining but not
  40. MULTIAPPEND, it may be possible to get some of the performance
  41. advantages of MULTIAPPEND by doing a pipelined "batch" append.
  42. However, it will not work as well as MULTIAPPEND for the following
  43. reasons:
  44. 1) Multiple APPEND commands, even as part of a pipelined batch,
  45. are non-atomic by definition. There is no way to revert the
  46. mailbox to the state before the batch append in the event of an
  47. error.
  48. 2) It may not be feasible for the server to coalesce pipelined
  49. APPEND operations so as to avoid the "open/lock +
  50. sync/unlock/close" overhead described above. In any case, such
  51. coalescing would be timing dependent and thus potentially
  52. unreliable. In particular, with traditional UNIX mailbox files,
  53. it is assumed that a lock is held only for a single atomic
  54. operation, and many applications disregard any lock that is
  55. older than 5 minutes.
  56. 3) If an error occurs, depending upon the nature of the error,
  57. it is possible for additional messages to be appended after the
  58. error. For example, the user wants to append 5 messages, but a
  59. disk quota error occurs with the third message because of its
  60. size. However, the fourth and fifth messages have already been
  61. sent in the pipeline, so the mailbox ends up with the first,
  62. second, fourth, and fifth messages of the batch appended.
  63. 6.3.11. APPEND Command
  64. Arguments: mailbox name
  65. one or more messages to upload, specified as:
  66. OPTIONAL flag parenthesized list
  67. OPTIONAL date/time string
  68. message literal
  69. Data: no specific responses for this command
  70. Result: OK - append completed
  71. NO - append error: can't append to that mailbox, error
  72. in flags or date/time or message text,
  73. append cancelled
  74. BAD - command unknown or arguments invalid
  75. Crispin Standards Track [Page 2]
  76. RFC 3502 IMAP MULTIAPPEND March 2003
  77. The APPEND command appends the literal arguments as new messages
  78. to the end of the specified destination mailbox. This argument
  79. SHOULD be in the format of an [RFC-2822] message. 8-bit
  80. characters are permitted in the message. A server implementation
  81. that is unable to preserve 8-bit data properly MUST be able to
  82. reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB]
  83. content transfer encoding.
  84. Note: There MAY be exceptions, e.g., draft messages, in
  85. which required [RFC-2822] header lines are omitted in the
  86. message literal argument to APPEND. The full implications
  87. of doing so MUST be understood and carefully weighed.
  88. If a flag parenthesized list is specified, the flags SHOULD be set
  89. in the resulting message; otherwise, the flag list of the
  90. resulting message is set empty by default.
  91. If a date-time is specified, the internal date SHOULD be set in
  92. the resulting message; otherwise, the internal date of the
  93. resulting message is set to the current date and time by default.
  94. A zero-length message literal argument is an error, and MUST
  95. return a NO. This can be used to cancel the append.
  96. If the append is unsuccessful for any reason (including being
  97. cancelled), the mailbox MUST be restored to its state before the
  98. APPEND attempt; no partial appending is permitted. The server MAY
  99. return an error before processing all the message arguments.
  100. If the destination mailbox does not exist, a server MUST return an
  101. error, and MUST NOT automatically create the mailbox. Unless it
  102. is certain that the destination mailbox can not be created, the
  103. server MUST send the response code "[TRYCREATE]" as the prefix of
  104. the text of the tagged NO response. This gives a hint to the
  105. client that it can attempt a CREATE command and retry the APPEND
  106. if the CREATE is successful.
  107. If the mailbox is currently selected, the normal new message
  108. actions SHOULD occur. Specifically, the server SHOULD notify the
  109. client immediately via an untagged EXISTS response. If the server
  110. does not do so, the client MAY issue a NOOP command (or failing
  111. that, a CHECK command) after one or more APPEND commands.
  112. Crispin Standards Track [Page 3]
  113. RFC 3502 IMAP MULTIAPPEND March 2003
  114. Example: C: A003 APPEND saved-messages (\Seen) {329}
  115. S: + Ready for literal data
  116. C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  117. C: From: Fred Foobar <foobar@Blurdybloop.example.COM>
  118. C: Subject: afternoon meeting
  119. C: To: mooch@owatagu.example.net
  120. C: Message-Id: <B27397-0100000@Blurdybloop.example.COM>
  121. C: MIME-Version: 1.0
  122. C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  123. C:
  124. C: Hello Joe, do you think we can meet at 3:30 tomorrow?
  125. C: (\Seen) " 7-Feb-1994 22:43:04 -0800" {295}
  126. S: + Ready for literal data
  127. C: Date: Mon, 7 Feb 1994 22:43:04 -0800 (PST)
  128. C: From: Joe Mooch <mooch@OWaTaGu.example.net>
  129. C: Subject: Re: afternoon meeting
  130. C: To: foobar@blurdybloop.example.com
  131. C: Message-Id: <a0434793874930@OWaTaGu.example.net>
  132. C: MIME-Version: 1.0
  133. C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  134. C:
  135. C: 3:30 is fine with me.
  136. C:
  137. S: A003 OK APPEND completed
  138. C: A004 APPEND bogusname (\Flagged) {1023}
  139. S: A004 NO [TRYCREATE] No such mailbox as bogusname
  140. C: A005 APPEND test (\Flagged) {99}
  141. S: + Ready for literal data
  142. C: Date: Mon, 7 Feb 2000 22:43:04 -0800 (PST)
  143. C: From: Fred Foobar <fred@example.com>
  144. C: Subject: hmm...
  145. C: {35403}
  146. S: A005 NO APPEND failed: Disk quota exceeded
  147. Note: The APPEND command is not used for message delivery,
  148. because it does not provide a mechanism to transfer [SMTP]
  149. envelope information.
  150. Modification to IMAP4rev1 Base Protocol Formal Syntax
  151. The following syntax specification uses the Augmented Backus-Naur
  152. Form (ABNF) notation as specified in [ABNF].
  153. append = "APPEND" SP mailbox 1*append-message
  154. append-message = [SP flag-list] [SP date-time] SP literal
  155. Crispin Standards Track [Page 4]
  156. RFC 3502 IMAP MULTIAPPEND March 2003
  157. MULTIAPPEND Interaction with UIDPLUS Extension
  158. Servers which support both MULTIAPPEND and [UIDPLUS] will have the
  159. "resp-code-apnd" rule modified as follows:
  160. resp-code-apnd = "APPENDUID" SP nz-number SP set
  161. That is, the APPENDUID response code returns as many UIDs as there
  162. were messages appended in the multiple append. The UIDs returned
  163. should be in the order the articles where appended. The message set
  164. may not contain extraneous UIDs or the symbol "*".
  165. Security Considerations
  166. The MULTIAPPEND extension does not raise any security considerations
  167. that are not present in the base [IMAP] protocol, and these issues
  168. are discussed in [IMAP]. Nevertheless, it is important to remember
  169. that IMAP4rev1 protocol transactions, including electronic mail data,
  170. are sent in the clear over the network unless protection from
  171. snooping is negotiated, either by the use of STARTTLS, privacy
  172. protection is negotiated in the AUTHENTICATE command, or some other
  173. protection mechanism is in effect.
  174. Normative References
  175. [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  176. Specifications: ABNF", RFC 2234, November 1997.
  177. [IMAP] Crispin, M., "Internet Message Access Protocol - Version
  178. 4rev1", RFC 3501, March 2003.
  179. [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
  180. Requirement Levels", BCP 14, RFC 2119, March 1997.
  181. [MIME-IMB] Freed, N. and N. Borenstein, "MIME (Multipurpose Internet
  182. Mail Extensions) Part One: Format of Internet Message
  183. Bodies", RFC 2045, November 1996.
  184. [RFC-2822] Resnick, P., "Internet Message Format", RFC 2822, April
  185. 2001.
  186. Crispin Standards Track [Page 5]
  187. RFC 3502 IMAP MULTIAPPEND March 2003
  188. Informative References
  189. [LITERAL+] Myers, J., "IMAP4 non-synchronizing literals", RFC 2088,
  190. January 1997.
  191. [UIDPLUS] Myers, J., "IMAP4 UIDPLUS extension", RFC 2359, June 1988.
  192. [SMTP] Klensin, J., Editor, "Simple Mail Transfer Protocol", RFC
  193. 2821, April 2001.
  194. Author's Address
  195. Mark R. Crispin
  196. Networks and Distributed Computing
  197. University of Washington
  198. 4545 15th Avenue NE
  199. Seattle, WA 98105-4527
  200. Phone: (206) 543-5762
  201. EMail: MRC@CAC.Washington.EDU
  202. Crispin Standards Track [Page 6]
  203. RFC 3502 IMAP MULTIAPPEND March 2003
  204. Full Copyright Statement
  205. Copyright (C) The Internet Society (2003). All Rights Reserved.
  206. This document and translations of it may be copied and furnished to
  207. others, and derivative works that comment on or otherwise explain it
  208. or assist in its implementation may be prepared, copied, published
  209. and distributed, in whole or in part, without restriction of any
  210. kind, provided that the above copyright notice and this paragraph are
  211. included on all such copies and derivative works. However, this
  212. document itself may not be modified in any way, such as by removing
  213. the copyright notice or references to the Internet Society or other
  214. Internet organizations, except as needed for the purpose of
  215. developing Internet standards in which case the procedures for
  216. copyrights defined in the Internet Standards process must be
  217. followed, or as required to translate it into languages other than
  218. English.
  219. The limited permissions granted above are perpetual and will not be
  220. revoked by the Internet Society or its successors or assigns.
  221. This document and the information contained herein is provided on an
  222. "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  223. TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  224. BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  225. HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  226. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  227. Acknowledgement
  228. Funding for the RFC Editor function is currently provided by the
  229. Internet Society.
  230. Crispin Standards Track [Page 7]