7Network Working Group                                         M. Crispin
 
8Request for Comments: 4315                                 December 2005
 
10Category: Standards Track
 
13      Internet Message Access Protocol (IMAP) - UIDPLUS 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 (2005).
 
29   The UIDPLUS extension of the Internet Message Access Protocol (IMAP)
 
30   provides a set of features intended to reduce the amount of time and
 
31   resources used by some client operations.  The features in UIDPLUS
 
32   are primarily intended for disconnected-use clients.
 
341.  Introduction and Overview
 
36   The UIDPLUS extension is present in any IMAP server implementation
 
37   that returns "UIDPLUS" as one of the supported capabilities to the
 
40   The UIDPLUS extension defines an additional command.  In addition,
 
41   this document recommends new status response codes in IMAP that
 
42   SHOULD be returned by all server implementations, regardless of
 
43   whether or not the UIDPLUS extension is implemented.
 
45   The added facilities of the features in UIDPLUS are optimizations;
 
46   clients can provide equivalent functionality, albeit less
 
47   efficiently, by using facilities in the base protocol.
 
491.1.  Conventions Used in This Document
 
51   In examples, "C:" and "S:" indicate lines sent by the client and
 
58Crispin                     Standards Track                     [Page 1]
 
60RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
63   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
 
64   "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in this document are to
 
65   be interpreted as described in [KEYWORDS].
 
67   A "UID set" is similar to the [IMAP] sequence set; however, the "*"
 
68   value for a sequence number is not permitted.
 
72   The following command definition is an extension to [IMAP] section
 
77   Arguments:  sequence set
 
79   Data:       untagged responses: EXPUNGE
 
81   Result:     OK - expunge completed
 
82               NO - expunge failure (e.g., permission denied)
 
83               BAD - command unknown or arguments invalid
 
85      The UID EXPUNGE command permanently removes all messages that both
 
86      have the \Deleted flag set and have a UID that is included in the
 
87      specified sequence set from the currently selected mailbox.  If a
 
88      message either does not have the \Deleted flag set or has a UID
 
89      that is not included in the specified sequence set, it is not
 
92      This command is particularly useful for disconnected use clients.
 
93      By using UID EXPUNGE instead of EXPUNGE when resynchronizing with
 
94      the server, the client can ensure that it does not inadvertantly
 
95      remove any messages that have been marked as \Deleted by other
 
96      clients between the time that the client was last connected and
 
97      the time the client resynchronizes.
 
99      If the server does not support the UIDPLUS capability, the client
 
100      should fall back to using the STORE command to temporarily remove
 
101      the \Deleted flag from messages it does not want to remove, then
 
102      issuing the EXPUNGE command.  Finally, the client should use the
 
103      STORE command to restore the \Deleted flag on the messages in
 
104      which it was temporarily removed.
 
106      Alternatively, the client may fall back to using just the EXPUNGE
 
107      command, risking the unintended removal of some messages.
 
114Crispin                     Standards Track                     [Page 2]
 
116RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
119   Example:    C: A003 UID EXPUNGE 3000:3002
 
123               S: A003 OK UID EXPUNGE completed
 
1253.  Additional Response Codes
 
127   The following response codes are extensions to the response codes
 
128   defined in [IMAP] section 7.1.  With limited exceptions, discussed
 
129   below, server implementations that advertise the UIDPLUS extension
 
130   SHOULD return these response codes.
 
132   In the case of a mailbox that has permissions set so that the client
 
133   can COPY or APPEND to the mailbox, but not SELECT or EXAMINE it, the
 
134   server SHOULD NOT send an APPENDUID or COPYUID response code as it
 
135   would disclose information about the mailbox.
 
137   In the case of a mailbox that has UIDNOTSTICKY status (as defined
 
138   below), the server MAY omit the APPENDUID or COPYUID response code as
 
139   it is not meaningful.
 
141   If the server does not return the APPENDUID or COPYUID response
 
142   codes, the client can discover this information by selecting the
 
143   destination mailbox.  The location of messages placed in the
 
144   destination mailbox by COPY or APPEND can be determined by using
 
145   FETCH and/or SEARCH commands (e.g., for Message-ID or some unique
 
146   marker placed in the message in an APPEND).
 
150      Followed by the UIDVALIDITY of the destination mailbox and the UID
 
151      assigned to the appended message in the destination mailbox,
 
152      indicates that the message has been appended to the destination
 
153      mailbox with that UID.
 
155      If the server also supports the [MULTIAPPEND] extension, and if
 
156      multiple messages were appended in the APPEND command, then the
 
157      second value is a UID set containing the UIDs assigned to the
 
158      appended messages, in the order they were transmitted in the
 
159      APPEND command.  This UID set may not contain extraneous UIDs or
 
162         Note: the UID set form of the APPENDUID response code MUST NOT
 
163         be used if only a single message was appended.  In particular,
 
164         a server MUST NOT send a range such as 123:123.  This is
 
165         because a client that does not support [MULTIAPPEND] expects
 
166         only a single UID and not a UID set.
 
170Crispin                     Standards Track                     [Page 3]
 
172RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
175      UIDs are assigned in strictly ascending order in the mailbox
 
176      (refer to [IMAP], section 2.3.1.1) and UID ranges are as in
 
177      [IMAP]; in particular, note that a range of 12:10 is exactly
 
178      equivalent to 10:12 and refers to the sequence 10,11,12.
 
180      This response code is returned in a tagged OK response to the
 
185      Followed by the UIDVALIDITY of the destination mailbox, a UID set
 
186      containing the UIDs of the message(s) in the source mailbox that
 
187      were copied to the destination mailbox and containing the UIDs
 
188      assigned to the copied message(s) in the destination mailbox,
 
189      indicates that the message(s) have been copied to the destination
 
190      mailbox with the stated UID(s).
 
192      The source UID set is in the order the message(s) were copied; the
 
193      destination UID set corresponds to the source UID set and is in
 
194      the same order.  Neither of the UID sets may contain extraneous
 
195      UIDs or the symbol "*".
 
197      UIDs are assigned in strictly ascending order in the mailbox
 
198      (refer to [IMAP], section 2.3.1.1) and UID ranges are as in
 
199      [IMAP]; in particular, note that a range of 12:10 is exactly
 
200      equivalent to 10:12 and refers to the sequence 10,11,12.
 
202      This response code is returned in a tagged OK response to the COPY
 
207      The selected mailbox is supported by a mail store that does not
 
208      support persistent UIDs; that is, UIDVALIDITY will be different
 
209      each time the mailbox is selected.  Consequently, APPEND or COPY
 
210      to this mailbox will not return an APPENDUID or COPYUID response
 
213      This response code is returned in an untagged NO response to the
 
216         Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores.
 
217         This facility exists to support legacy mail stores in which it
 
218         is technically infeasible to support persistent UIDs.  This
 
219         should be avoided when designing new mail stores.
 
226Crispin                     Standards Track                     [Page 4]
 
228RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
231   Example:    C: A003 APPEND saved-messages (\Seen) {297}
 
232               C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
 
233               C: From: Fred Foobar <foobar@example.com>
 
234               C: Subject: afternoon meeting
 
235               C: To: mooch@example.com
 
236               C: Message-Id: <B27397-0100000@example.com>
 
238               C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
 
240               C: Hello Joe, do you think we can meet at 3:30 tomorrow?
 
242               S: A003 OK [APPENDUID 38505 3955] APPEND completed
 
243               C: A004 COPY 2:4 meeting
 
244               S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done
 
245               C: A005 UID COPY 305:310 meeting
 
246               S: A005 OK No matching messages, so nothing copied
 
252               S: * OK [UNSEEN 1] Message 1 is first unseen
 
253               S: * OK [UIDVALIDITY 3857529045] Validity session-only
 
254               S: * OK [UIDNEXT 2] Predicted next UID
 
255               S: * NO [UIDNOTSTICKY] Non-persistent UIDs
 
256               S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
 
257               S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited
 
258               S: A007 OK [READ-WRITE] SELECT completed
 
260   In this example, A003 and A004 demonstrate successful appending and
 
261   copying to a mailbox that returns the UIDs assigned to the messages.
 
262   A005 is an example in which no messages were copied; this is because
 
263   in A003, we see that message 2 had UID 304, and message 3 had UID
 
264   319; therefore, UIDs 305 through 310 do not exist (refer to section
 
265   2.3.1.1 of [IMAP] for further explanation).  A006 is an example of a
 
266   message being copied that did not return a COPYUID; and, as expected,
 
267   A007 shows that the mail store containing that mailbox does not
 
268   support persistent UIDs.
 
272   Formal syntax is defined using ABNF [ABNF], which extends the ABNF
 
273   rules defined in [IMAP].  The IMAP4 ABNF should be imported before
 
274   attempting to validate these rules.
 
276   append-uid      = uniqueid
 
278   capability      =/ "UIDPLUS"
 
282Crispin                     Standards Track                     [Page 5]
 
284RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
287   command-select  =/ uid-expunge
 
289   resp-code-apnd  = "APPENDUID" SP nz-number SP append-uid
 
291   resp-code-copy  = "COPYUID" SP nz-number SP uid-set SP uid-set
 
293   resp-text-code  =/ resp-code-apnd / resp-code-copy / "UIDNOTSTICKY"
 
294                     ; incorporated before the expansion rule of
 
295                     ;  atom [SP 1*<any TEXT-CHAR except "]">]
 
296                     ; that appears in [IMAP]
 
300   uid-set         = (uniqueid / uid-range) *("," uid-set)
 
302   uid-range       = (uniqueid ":" uniqueid)
 
303                     ; two uniqueid values and all values
 
304                     ; between these two regards of order.
 
305                     ; Example: 2:4 and 4:2 are equivalent.
 
307   Servers that support [MULTIAPPEND] will have the following extension
 
310   append-uid      =/ uid-set
 
311                     ; only permitted if client uses [MULTIAPPEND]
 
312                     ; to append multiple messages.
 
3145.  Security Considerations
 
316   The COPYUID and APPENDUID response codes return information about the
 
317   mailbox, which may be considered sensitive if the mailbox has
 
318   permissions set that permit the client to COPY or APPEND to the
 
319   mailbox, but not SELECT or EXAMINE it.
 
321   Consequently, these response codes SHOULD NOT be issued if the client
 
322   does not have access to SELECT or EXAMINE the mailbox.
 
3246.  IANA Considerations
 
326   This document constitutes registration of the UIDPLUS capability in
 
327   the imap4-capabilities registry, replacing [RFC2359].
 
3297.  Normative References
 
331   [ABNF]        Crocker, D. and P. Overell, "Augmented BNF for Syntax
 
332                 Specifications: ABNF", RFC 4234, October 2005.
 
338Crispin                     Standards Track                     [Page 6]
 
340RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
343   [IMAP]        Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL -
 
344                 VERSION 4rev1", RFC 3501, March 2003.
 
346   [KEYWORDS]    Bradner, S., "Key words for use in RFCs to Indicate
 
347                 Requirement Levels", BCP 14, RFC 2119, March 1997.
 
349   [MULTIAPPEND] Crispin, M., "Internet Message Access Protocol (IMAP) -
 
350                 MULTIAPPEND Extension", RFC 3502, March 2003.
 
3528.  Informative References
 
354   [RFC2359]     Myers, J., "IMAP4 UIDPLUS extension", RFC 2359, June
 
3579.  Changes from RFC 2359
 
359   This document obsoletes [RFC2359].  However, it is based upon that
 
360   document, and takes substantial text from it (albeit with numerous
 
361   clarifications in wording).
 
363   [RFC2359] implied that a server must always return COPYUID/APPENDUID
 
364   data; thus suggesting that in such cases the server should return
 
365   arbitrary data if the destination mailbox did not support persistent
 
366   UIDs.  This document adds the UIDNOTSTICKY response code to indicate
 
367   that a mailbox does not support persistent UIDs, and stipulates that
 
368   a UIDPLUS server does not return COPYUID/APPENDUID data when the COPY
 
369   (or APPEND) destination mailbox has UIDNOTSTICKY status.
 
374   Networks and Distributed Computing
 
375   University of Washington
 
377   Seattle, WA  98105-4527
 
379   Phone: (206) 543-5762
 
380   EMail: MRC@CAC.Washington.EDU
 
394Crispin                     Standards Track                     [Page 7]
 
396RFC 4315                IMAP - UIDPLUS Extension           December 2005
 
399Full Copyright Statement
 
401   Copyright (C) The Internet Society (2005).
 
403   This document is subject to the rights, licenses and restrictions
 
404   contained in BCP 78, and except as set forth therein, the authors
 
405   retain all their rights.
 
407   This document and the information contained herein are provided on an
 
408   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
 
409   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
 
410   ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
 
411   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
 
412   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
 
413   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 
417   The IETF takes no position regarding the validity or scope of any
 
418   Intellectual Property Rights or other rights that might be claimed to
 
419   pertain to the implementation or use of the technology described in
 
420   this document or the extent to which any license under such rights
 
421   might or might not be available; nor does it represent that it has
 
422   made any independent effort to identify any such rights.  Information
 
423   on the procedures with respect to rights in RFC documents can be
 
424   found in BCP 78 and BCP 79.
 
426   Copies of IPR disclosures made to the IETF Secretariat and any
 
427   assurances of licenses to be made available, or the result of an
 
428   attempt made to obtain a general license or permission for the use of
 
429   such proprietary rights by implementers or users of this
 
430   specification can be obtained from the IETF on-line IPR repository at
 
431   http://www.ietf.org/ipr.
 
433   The IETF invites any interested party to bring to its attention any
 
434   copyrights, patents or patent applications, or other proprietary
 
435   rights that may cover technology that may be required to implement
 
436   this standard.  Please address the information to the IETF at ietf-
 
441   Funding for the RFC Editor function is currently provided by the
 
450Crispin                     Standards Track                     [Page 8]