rfc4315.IMAP_UIDPLUS_extension.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. Network Working Group M. Crispin
  2. Request for Comments: 4315 December 2005
  3. Obsoletes: 2359
  4. Category: Standards Track
  5. Internet Message Access Protocol (IMAP) - UIDPLUS 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 (2005).
  14. Abstract
  15. The UIDPLUS extension of the Internet Message Access Protocol (IMAP)
  16. provides a set of features intended to reduce the amount of time and
  17. resources used by some client operations. The features in UIDPLUS
  18. are primarily intended for disconnected-use clients.
  19. 1. Introduction and Overview
  20. The UIDPLUS extension is present in any IMAP server implementation
  21. that returns "UIDPLUS" as one of the supported capabilities to the
  22. CAPABILITY command.
  23. The UIDPLUS extension defines an additional command. In addition,
  24. this document recommends new status response codes in IMAP that
  25. SHOULD be returned by all server implementations, regardless of
  26. whether or not the UIDPLUS extension is implemented.
  27. The added facilities of the features in UIDPLUS are optimizations;
  28. clients can provide equivalent functionality, albeit less
  29. efficiently, by using facilities in the base protocol.
  30. 1.1. Conventions Used in This Document
  31. In examples, "C:" and "S:" indicate lines sent by the client and
  32. server, respectively.
  33. Crispin Standards Track [Page 1]
  34. RFC 4315 IMAP - UIDPLUS Extension December 2005
  35. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  36. "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in this document are to
  37. be interpreted as described in [KEYWORDS].
  38. A "UID set" is similar to the [IMAP] sequence set; however, the "*"
  39. value for a sequence number is not permitted.
  40. 2. Additional Commands
  41. The following command definition is an extension to [IMAP] section
  42. 6.4.
  43. 2.1. UID EXPUNGE Command
  44. Arguments: sequence set
  45. Data: untagged responses: EXPUNGE
  46. Result: OK - expunge completed
  47. NO - expunge failure (e.g., permission denied)
  48. BAD - command unknown or arguments invalid
  49. The UID EXPUNGE command permanently removes all messages that both
  50. have the \Deleted flag set and have a UID that is included in the
  51. specified sequence set from the currently selected mailbox. If a
  52. message either does not have the \Deleted flag set or has a UID
  53. that is not included in the specified sequence set, it is not
  54. affected.
  55. This command is particularly useful for disconnected use clients.
  56. By using UID EXPUNGE instead of EXPUNGE when resynchronizing with
  57. the server, the client can ensure that it does not inadvertantly
  58. remove any messages that have been marked as \Deleted by other
  59. clients between the time that the client was last connected and
  60. the time the client resynchronizes.
  61. If the server does not support the UIDPLUS capability, the client
  62. should fall back to using the STORE command to temporarily remove
  63. the \Deleted flag from messages it does not want to remove, then
  64. issuing the EXPUNGE command. Finally, the client should use the
  65. STORE command to restore the \Deleted flag on the messages in
  66. which it was temporarily removed.
  67. Alternatively, the client may fall back to using just the EXPUNGE
  68. command, risking the unintended removal of some messages.
  69. Crispin Standards Track [Page 2]
  70. RFC 4315 IMAP - UIDPLUS Extension December 2005
  71. Example: C: A003 UID EXPUNGE 3000:3002
  72. S: * 3 EXPUNGE
  73. S: * 3 EXPUNGE
  74. S: * 3 EXPUNGE
  75. S: A003 OK UID EXPUNGE completed
  76. 3. Additional Response Codes
  77. The following response codes are extensions to the response codes
  78. defined in [IMAP] section 7.1. With limited exceptions, discussed
  79. below, server implementations that advertise the UIDPLUS extension
  80. SHOULD return these response codes.
  81. In the case of a mailbox that has permissions set so that the client
  82. can COPY or APPEND to the mailbox, but not SELECT or EXAMINE it, the
  83. server SHOULD NOT send an APPENDUID or COPYUID response code as it
  84. would disclose information about the mailbox.
  85. In the case of a mailbox that has UIDNOTSTICKY status (as defined
  86. below), the server MAY omit the APPENDUID or COPYUID response code as
  87. it is not meaningful.
  88. If the server does not return the APPENDUID or COPYUID response
  89. codes, the client can discover this information by selecting the
  90. destination mailbox. The location of messages placed in the
  91. destination mailbox by COPY or APPEND can be determined by using
  92. FETCH and/or SEARCH commands (e.g., for Message-ID or some unique
  93. marker placed in the message in an APPEND).
  94. APPENDUID
  95. Followed by the UIDVALIDITY of the destination mailbox and the UID
  96. assigned to the appended message in the destination mailbox,
  97. indicates that the message has been appended to the destination
  98. mailbox with that UID.
  99. If the server also supports the [MULTIAPPEND] extension, and if
  100. multiple messages were appended in the APPEND command, then the
  101. second value is a UID set containing the UIDs assigned to the
  102. appended messages, in the order they were transmitted in the
  103. APPEND command. This UID set may not contain extraneous UIDs or
  104. the symbol "*".
  105. Note: the UID set form of the APPENDUID response code MUST NOT
  106. be used if only a single message was appended. In particular,
  107. a server MUST NOT send a range such as 123:123. This is
  108. because a client that does not support [MULTIAPPEND] expects
  109. only a single UID and not a UID set.
  110. Crispin Standards Track [Page 3]
  111. RFC 4315 IMAP - UIDPLUS Extension December 2005
  112. UIDs are assigned in strictly ascending order in the mailbox
  113. (refer to [IMAP], section 2.3.1.1) and UID ranges are as in
  114. [IMAP]; in particular, note that a range of 12:10 is exactly
  115. equivalent to 10:12 and refers to the sequence 10,11,12.
  116. This response code is returned in a tagged OK response to the
  117. APPEND command.
  118. COPYUID
  119. Followed by the UIDVALIDITY of the destination mailbox, a UID set
  120. containing the UIDs of the message(s) in the source mailbox that
  121. were copied to the destination mailbox and containing the UIDs
  122. assigned to the copied message(s) in the destination mailbox,
  123. indicates that the message(s) have been copied to the destination
  124. mailbox with the stated UID(s).
  125. The source UID set is in the order the message(s) were copied; the
  126. destination UID set corresponds to the source UID set and is in
  127. the same order. Neither of the UID sets may contain extraneous
  128. UIDs or the symbol "*".
  129. UIDs are assigned in strictly ascending order in the mailbox
  130. (refer to [IMAP], section 2.3.1.1) and UID ranges are as in
  131. [IMAP]; in particular, note that a range of 12:10 is exactly
  132. equivalent to 10:12 and refers to the sequence 10,11,12.
  133. This response code is returned in a tagged OK response to the COPY
  134. command.
  135. UIDNOTSTICKY
  136. The selected mailbox is supported by a mail store that does not
  137. support persistent UIDs; that is, UIDVALIDITY will be different
  138. each time the mailbox is selected. Consequently, APPEND or COPY
  139. to this mailbox will not return an APPENDUID or COPYUID response
  140. code.
  141. This response code is returned in an untagged NO response to the
  142. SELECT command.
  143. Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores.
  144. This facility exists to support legacy mail stores in which it
  145. is technically infeasible to support persistent UIDs. This
  146. should be avoided when designing new mail stores.
  147. Crispin Standards Track [Page 4]
  148. RFC 4315 IMAP - UIDPLUS Extension December 2005
  149. Example: C: A003 APPEND saved-messages (\Seen) {297}
  150. C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  151. C: From: Fred Foobar <foobar@example.com>
  152. C: Subject: afternoon meeting
  153. C: To: mooch@example.com
  154. C: Message-Id: <B27397-0100000@example.com>
  155. C: MIME-Version: 1.0
  156. C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  157. C:
  158. C: Hello Joe, do you think we can meet at 3:30 tomorrow?
  159. C:
  160. S: A003 OK [APPENDUID 38505 3955] APPEND completed
  161. C: A004 COPY 2:4 meeting
  162. S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done
  163. C: A005 UID COPY 305:310 meeting
  164. S: A005 OK No matching messages, so nothing copied
  165. C: A006 COPY 2 funny
  166. S: A006 OK Done
  167. C: A007 SELECT funny
  168. S: * 1 EXISTS
  169. S: * 1 RECENT
  170. S: * OK [UNSEEN 1] Message 1 is first unseen
  171. S: * OK [UIDVALIDITY 3857529045] Validity session-only
  172. S: * OK [UIDNEXT 2] Predicted next UID
  173. S: * NO [UIDNOTSTICKY] Non-persistent UIDs
  174. S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  175. S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited
  176. S: A007 OK [READ-WRITE] SELECT completed
  177. In this example, A003 and A004 demonstrate successful appending and
  178. copying to a mailbox that returns the UIDs assigned to the messages.
  179. A005 is an example in which no messages were copied; this is because
  180. in A003, we see that message 2 had UID 304, and message 3 had UID
  181. 319; therefore, UIDs 305 through 310 do not exist (refer to section
  182. 2.3.1.1 of [IMAP] for further explanation). A006 is an example of a
  183. message being copied that did not return a COPYUID; and, as expected,
  184. A007 shows that the mail store containing that mailbox does not
  185. support persistent UIDs.
  186. 4. Formal Syntax
  187. Formal syntax is defined using ABNF [ABNF], which extends the ABNF
  188. rules defined in [IMAP]. The IMAP4 ABNF should be imported before
  189. attempting to validate these rules.
  190. append-uid = uniqueid
  191. capability =/ "UIDPLUS"
  192. Crispin Standards Track [Page 5]
  193. RFC 4315 IMAP - UIDPLUS Extension December 2005
  194. command-select =/ uid-expunge
  195. resp-code-apnd = "APPENDUID" SP nz-number SP append-uid
  196. resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set
  197. resp-text-code =/ resp-code-apnd / resp-code-copy / "UIDNOTSTICKY"
  198. ; incorporated before the expansion rule of
  199. ; atom [SP 1*<any TEXT-CHAR except "]">]
  200. ; that appears in [IMAP]
  201. uid-expunge = "UID" SP "EXPUNGE" SP sequence-set
  202. uid-set = (uniqueid / uid-range) *("," uid-set)
  203. uid-range = (uniqueid ":" uniqueid)
  204. ; two uniqueid values and all values
  205. ; between these two regards of order.
  206. ; Example: 2:4 and 4:2 are equivalent.
  207. Servers that support [MULTIAPPEND] will have the following extension
  208. to the above rules:
  209. append-uid =/ uid-set
  210. ; only permitted if client uses [MULTIAPPEND]
  211. ; to append multiple messages.
  212. 5. Security Considerations
  213. The COPYUID and APPENDUID response codes return information about the
  214. mailbox, which may be considered sensitive if the mailbox has
  215. permissions set that permit the client to COPY or APPEND to the
  216. mailbox, but not SELECT or EXAMINE it.
  217. Consequently, these response codes SHOULD NOT be issued if the client
  218. does not have access to SELECT or EXAMINE the mailbox.
  219. 6. IANA Considerations
  220. This document constitutes registration of the UIDPLUS capability in
  221. the imap4-capabilities registry, replacing [RFC2359].
  222. 7. Normative References
  223. [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  224. Specifications: ABNF", RFC 4234, October 2005.
  225. Crispin Standards Track [Page 6]
  226. RFC 4315 IMAP - UIDPLUS Extension December 2005
  227. [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL -
  228. VERSION 4rev1", RFC 3501, March 2003.
  229. [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
  230. Requirement Levels", BCP 14, RFC 2119, March 1997.
  231. [MULTIAPPEND] Crispin, M., "Internet Message Access Protocol (IMAP) -
  232. MULTIAPPEND Extension", RFC 3502, March 2003.
  233. 8. Informative References
  234. [RFC2359] Myers, J., "IMAP4 UIDPLUS extension", RFC 2359, June
  235. 1998.
  236. 9. Changes from RFC 2359
  237. This document obsoletes [RFC2359]. However, it is based upon that
  238. document, and takes substantial text from it (albeit with numerous
  239. clarifications in wording).
  240. [RFC2359] implied that a server must always return COPYUID/APPENDUID
  241. data; thus suggesting that in such cases the server should return
  242. arbitrary data if the destination mailbox did not support persistent
  243. UIDs. This document adds the UIDNOTSTICKY response code to indicate
  244. that a mailbox does not support persistent UIDs, and stipulates that
  245. a UIDPLUS server does not return COPYUID/APPENDUID data when the COPY
  246. (or APPEND) destination mailbox has UIDNOTSTICKY status.
  247. Author's Address
  248. Mark R. Crispin
  249. Networks and Distributed Computing
  250. University of Washington
  251. 4545 15th Avenue NE
  252. Seattle, WA 98105-4527
  253. Phone: (206) 543-5762
  254. EMail: MRC@CAC.Washington.EDU
  255. Crispin Standards Track [Page 7]
  256. RFC 4315 IMAP - UIDPLUS Extension December 2005
  257. Full Copyright Statement
  258. Copyright (C) The Internet Society (2005).
  259. This document is subject to the rights, licenses and restrictions
  260. contained in BCP 78, and except as set forth therein, the authors
  261. retain all their rights.
  262. This document and the information contained herein are provided on an
  263. "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
  264. OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
  265. ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
  266. INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
  267. INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
  268. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  269. Intellectual Property
  270. The IETF takes no position regarding the validity or scope of any
  271. Intellectual Property Rights or other rights that might be claimed to
  272. pertain to the implementation or use of the technology described in
  273. this document or the extent to which any license under such rights
  274. might or might not be available; nor does it represent that it has
  275. made any independent effort to identify any such rights. Information
  276. on the procedures with respect to rights in RFC documents can be
  277. found in BCP 78 and BCP 79.
  278. Copies of IPR disclosures made to the IETF Secretariat and any
  279. assurances of licenses to be made available, or the result of an
  280. attempt made to obtain a general license or permission for the use of
  281. such proprietary rights by implementers or users of this
  282. specification can be obtained from the IETF on-line IPR repository at
  283. http://www.ietf.org/ipr.
  284. The IETF invites any interested party to bring to its attention any
  285. copyrights, patents or patent applications, or other proprietary
  286. rights that may cover technology that may be required to implement
  287. this standard. Please address the information to the IETF at ietf-
  288. ipr@ietf.org.
  289. Acknowledgement
  290. Funding for the RFC Editor function is currently provided by the
  291. Internet Society.
  292. Crispin Standards Track [Page 8]