idnits 2.17.1 draft-ietf-extra-imap4rev2-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an Introduction section. ** There are 13 instances of too long lines in the document, the longest one being 9 characters in excess of 72. -- The draft header indicates that this document obsoletes RFC3501, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 3, 2019) is 1899 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'IMAP2' is mentioned on line 5485, but not defined == Missing Reference: 'IMAP-OBSOLETE' is mentioned on line 5480, but not defined == Missing Reference: 'IMAP-COMPAT' is mentioned on line 5470, but not defined == Missing Reference: 'IMAP-HISTORICAL' is mentioned on line 5475, but not defined == Missing Reference: 'RFC-822' is mentioned on line 5489, but not defined ** Obsolete undefined reference: RFC 822 (Obsoleted by RFC 2822) == Missing Reference: 'HEADER' is mentioned on line 4472, but not defined == Missing Reference: 'IMAP-DISC' is mentioned on line 5427, but not defined == Missing Reference: 'SMTP' is mentioned on line 5452, but not defined == Missing Reference: 'IMAP-URL' is mentioned on line 5462, but not defined == Missing Reference: 'UIDVALIDITY 3857529045' is mentioned on line 4455, but not defined == Missing Reference: 'UIDNEXT 4392' is mentioned on line 1608, but not defined == Missing Reference: 'UIDNEXT 2' is mentioned on line 2397, but not defined == Missing Reference: 'UIDVALIDITY 1' is mentioned on line 2468, but not defined == Missing Reference: 'IMAP-I18N' is mentioned on line 5432, but not defined == Missing Reference: 'TEXT' is mentioned on line 4409, but not defined == Missing Reference: 'UID' is mentioned on line 3156, but not defined == Missing Reference: 'RFC4314' is mentioned on line 5455, but not defined == Missing Reference: 'RFC2087' is mentioned on line 5459, but not defined ** Obsolete undefined reference: RFC 2087 (Obsoleted by RFC 9208) == Missing Reference: 'READ-WRITE' is mentioned on line 4456, but not defined == Missing Reference: 'RFC4422' is mentioned on line 4769, but not defined == Missing Reference: 'IMAP-TLS' is mentioned on line 5497, but not defined == Missing Reference: 'IMAP-MODEL' is mentioned on line 5438, but not defined == Missing Reference: 'IMAP-UTF-8' is mentioned on line 5515, but not defined == Missing Reference: 'ACAP' is mentioned on line 5448, but not defined == Missing Reference: 'RFC-821' is mentioned on line 5493, but not defined ** Obsolete undefined reference: RFC 821 (Obsoleted by RFC 2821) ** Obsolete normative reference: RFC 2831 (ref. 'DIGEST-MD5') (Obsoleted by RFC 6331) ** Obsolete normative reference: RFC 5246 (ref. 'TLS') (Obsoleted by RFC 8446) ** Downref: Normative reference to an Informational RFC: RFC 2152 (ref. 'UTF-7') ** Downref: Normative reference to an Informational RFC: RFC 2683 (ref. 'IMAP-IMPLEMENTATION') ** Downref: Normative reference to an Informational RFC: RFC 2180 (ref. 'IMAP-MULTIACCESS') Summary: 10 errors (**), 0 flaws (~~), 27 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group A. Melnikov, Ed. 3 Internet-Draft Isode Ltd 4 Obsoletes: 3501 (if approved) B. Leiba, Ed. 5 Intended status: Standards Track Huawei Technologies 6 Expires: August 7, 2019 February 3, 2019 8 INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev2 9 draft-ietf-extra-imap4rev2-03 11 Abstract 13 The Internet Message Access Protocol, Version 4rev2 (IMAP4rev2) 14 allows a client to access and manipulate electronic mail messages on 15 a server. IMAP4rev2 permits manipulation of mailboxes (remote 16 message folders) in a way that is functionally equivalent to local 17 folders. IMAP4rev2 also provides the capability for an offline 18 client to resynchronize with the server. 20 IMAP4rev2 includes operations for creating, deleting, and renaming 21 mailboxes, checking for new messages, permanently removing messages, 22 setting and clearing flags, RFC 5322 and RFC 2045 parsing, searching, 23 and selective fetching of message attributes, texts, and portions 24 thereof. Messages in IMAP4rev2 are accessed by the use of numbers. 25 These numbers are either message sequence numbers or unique 26 identifiers. 28 IMAP4rev2 does not specify a means of posting mail; this function is 29 handled by a mail submission protocol such as RFC 6409. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at https://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on August 7, 2019. 48 Copyright Notice 50 Copyright (c) 2019 IETF Trust and the persons identified as the 51 document authors. All rights reserved. 53 This document is subject to BCP 78 and the IETF Trust's Legal 54 Provisions Relating to IETF Documents 55 (https://trustee.ietf.org/license-info) in effect on the date of 56 publication of this document. Please review these documents 57 carefully, as they describe your rights and restrictions with respect 58 to this document. Code Components extracted from this document must 59 include Simplified BSD License text as described in Section 4.e of 60 the Trust Legal Provisions and are provided without warranty as 61 described in the Simplified BSD License. 63 This document may contain material from IETF Documents or IETF 64 Contributions published or made publicly available before November 65 10, 2008. The person(s) controlling the copyright in some of this 66 material may not have granted the IETF Trust the right to allow 67 modifications of such material outside the IETF Standards Process. 68 Without obtaining an adequate license from the person(s) controlling 69 the copyright in such materials, this document may not be modified 70 outside the IETF Standards Process, and derivative works of it may 71 not be created outside the IETF Standards Process, except to format 72 it for publication as an RFC or to translate it into languages other 73 than English. 75 Table of Contents 77 1. How to Read This Document . . . . . . . . . . . . . . . . . . 5 78 1.1. Organization of This Document . . . . . . . . . . . . . . 5 79 1.2. Conventions Used in This Document . . . . . . . . . . . . 5 80 1.3. Special Notes to Implementors . . . . . . . . . . . . . . 6 81 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 7 82 2.1. Link Level . . . . . . . . . . . . . . . . . . . . . . . 7 83 2.2. Commands and Responses . . . . . . . . . . . . . . . . . 7 84 2.2.1. Client Protocol Sender and Server Protocol Receiver . 7 85 2.2.2. Server Protocol Sender and Client Protocol Receiver . 8 86 2.3. Message Attributes . . . . . . . . . . . . . . . . . . . 9 87 2.3.1. Message Numbers . . . . . . . . . . . . . . . . . . . 9 88 2.3.2. Flags Message Attribute . . . . . . . . . . . . . . . 11 89 2.3.3. Internal Date Message Attribute . . . . . . . . . . . 12 90 2.3.4. [RFC-5322] Size Message Attribute . . . . . . . . . . 13 91 2.3.5. Envelope Structure Message Attribute . . . . . . . . 13 92 2.3.6. Body Structure Message Attribute . . . . . . . . . . 13 93 2.4. Message Texts . . . . . . . . . . . . . . . . . . . . . . 13 94 3. State and Flow Diagram . . . . . . . . . . . . . . . . . . . 13 95 3.1. Not Authenticated State . . . . . . . . . . . . . . . . . 13 96 3.2. Authenticated State . . . . . . . . . . . . . . . . . . . 13 97 3.3. Selected State . . . . . . . . . . . . . . . . . . . . . 14 98 3.4. Logout State . . . . . . . . . . . . . . . . . . . . . . 14 99 4. Data Formats . . . . . . . . . . . . . . . . . . . . . . . . 16 100 4.1. Atom . . . . . . . . . . . . . . . . . . . . . . . . . . 16 101 4.1.1. Sequence set and UID set . . . . . . . . . . . . . . 16 102 4.2. Number . . . . . . . . . . . . . . . . . . . . . . . . . 16 103 4.3. String . . . . . . . . . . . . . . . . . . . . . . . . . 16 104 4.3.1. 8-bit and Binary Strings . . . . . . . . . . . . . . 17 105 4.4. Parenthesized List . . . . . . . . . . . . . . . . . . . 18 106 4.5. NIL . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 107 5. Operational Considerations . . . . . . . . . . . . . . . . . 18 108 5.1. Mailbox Naming . . . . . . . . . . . . . . . . . . . . . 18 109 5.1.1. Mailbox Hierarchy Naming . . . . . . . . . . . . . . 19 110 5.1.2. Namespaces . . . . . . . . . . . . . . . . . . . . . 19 111 5.2. Mailbox Size and Message Status Updates . . . . . . . . . 21 112 5.3. Response when no Command in Progress . . . . . . . . . . 21 113 5.4. Autologout Timer . . . . . . . . . . . . . . . . . . . . 21 114 5.5. Multiple Commands in Progress (Command Pipelining) . . . 22 115 6. Client Commands . . . . . . . . . . . . . . . . . . . . . . . 23 116 6.1. Client Commands - Any State . . . . . . . . . . . . . . . 23 117 6.1.1. CAPABILITY Command . . . . . . . . . . . . . . . . . 24 118 6.1.2. NOOP Command . . . . . . . . . . . . . . . . . . . . 25 119 6.1.3. LOGOUT Command . . . . . . . . . . . . . . . . . . . 25 120 6.2. Client Commands - Not Authenticated State . . . . . . . . 26 121 6.2.1. STARTTLS Command . . . . . . . . . . . . . . . . . . 26 122 6.2.2. AUTHENTICATE Command . . . . . . . . . . . . . . . . 27 123 6.2.3. LOGIN Command . . . . . . . . . . . . . . . . . . . . 30 124 6.3. Client Commands - Authenticated State . . . . . . . . . . 31 125 6.3.1. ENABLE Command . . . . . . . . . . . . . . . . . . . 31 126 6.3.2. SELECT Command . . . . . . . . . . . . . . . . . . . 33 127 6.3.3. EXAMINE Command . . . . . . . . . . . . . . . . . . . 35 128 6.3.4. CREATE Command . . . . . . . . . . . . . . . . . . . 35 129 6.3.5. DELETE Command . . . . . . . . . . . . . . . . . . . 36 130 6.3.6. RENAME Command . . . . . . . . . . . . . . . . . . . 38 131 6.3.7. SUBSCRIBE Command . . . . . . . . . . . . . . . . . . 40 132 6.3.8. UNSUBSCRIBE Command . . . . . . . . . . . . . . . . . 41 133 6.3.9. LIST Command . . . . . . . . . . . . . . . . . . . . 41 134 6.3.10. LSUB Command . . . . . . . . . . . . . . . . . . . . 44 135 6.3.11. NAMESPACE Command . . . . . . . . . . . . . . . . . . 45 136 6.3.12. STATUS Command . . . . . . . . . . . . . . . . . . . 49 137 6.3.13. APPEND Command . . . . . . . . . . . . . . . . . . . 51 138 6.3.14. IDLE Command . . . . . . . . . . . . . . . . . . . . 53 139 6.4. Client Commands - Selected State . . . . . . . . . . . . 55 140 6.4.1. CHECK Command . . . . . . . . . . . . . . . . . . . . 56 141 6.4.2. CLOSE Command . . . . . . . . . . . . . . . . . . . . 56 142 6.4.3. UNSELECT Command . . . . . . . . . . . . . . . . . . 57 143 6.4.4. EXPUNGE Command . . . . . . . . . . . . . . . . . . . 57 144 6.4.5. SEARCH Command . . . . . . . . . . . . . . . . . . . 58 145 6.4.6. FETCH Command . . . . . . . . . . . . . . . . . . . . 63 146 6.4.7. STORE Command . . . . . . . . . . . . . . . . . . . . 66 147 6.4.8. COPY Command . . . . . . . . . . . . . . . . . . . . 68 148 6.4.9. MOVE Command . . . . . . . . . . . . . . . . . . . . 69 149 6.4.10. UID Command . . . . . . . . . . . . . . . . . . . . . 70 150 6.5. Client Commands - Experimental/Expansion . . . . . . . . 72 151 6.5.1. X Command . . . . . . . . . . . . . . . . . . . 72 152 7. Server Responses . . . . . . . . . . . . . . . . . . . . . . 73 153 7.1. Server Responses - Status Responses . . . . . . . . . . . 74 154 7.1.1. OK Response . . . . . . . . . . . . . . . . . . . . . 81 155 7.1.2. NO Response . . . . . . . . . . . . . . . . . . . . . 81 156 7.1.3. BAD Response . . . . . . . . . . . . . . . . . . . . 82 157 7.1.4. PREAUTH Response . . . . . . . . . . . . . . . . . . 82 158 7.1.5. BYE Response . . . . . . . . . . . . . . . . . . . . 83 159 7.2. Server Responses - Server and Mailbox Status . . . . . . 83 160 7.2.1. The ENABLED Response . . . . . . . . . . . . . . . . 83 161 7.2.2. CAPABILITY Response . . . . . . . . . . . . . . . . . 84 162 7.2.3. LIST Response . . . . . . . . . . . . . . . . . . . . 85 163 7.2.4. LSUB Response . . . . . . . . . . . . . . . . . . . . 87 164 7.2.5. NAMESPACE Response . . . . . . . . . . . . . . . . . 88 165 7.2.6. STATUS Response . . . . . . . . . . . . . . . . . . . 88 166 7.2.7. ESEARCH Response . . . . . . . . . . . . . . . . . . 88 167 7.2.8. FLAGS Response . . . . . . . . . . . . . . . . . . . 89 168 7.3. Server Responses - Mailbox Size . . . . . . . . . . . . . 89 169 7.3.1. EXISTS Response . . . . . . . . . . . . . . . . . . . 89 170 7.4. Server Responses - Message Status . . . . . . . . . . . . 90 171 7.4.1. EXPUNGE Response . . . . . . . . . . . . . . . . . . 90 172 7.4.2. FETCH Response . . . . . . . . . . . . . . . . . . . 91 173 7.5. Server Responses - Command Continuation Request . . . . . 96 174 8. Sample IMAP4rev2 connection . . . . . . . . . . . . . . . . . 96 175 9. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 97 176 10. Author's Note . . . . . . . . . . . . . . . . . . . . . . . . 112 177 11. Security Considerations . . . . . . . . . . . . . . . . . . . 112 178 11.1. STARTTLS Security Considerations . . . . . . . . . . . . 112 179 11.2. COPYUID and APPENDUID response codes . . . . . . . . . . 112 180 11.3. Other Security Considerations . . . . . . . . . . . . . 113 181 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 113 182 12.1. Updates to IMAP4 Capabilities registry . . . . . . . . . 114 183 12.2. GSSAPI/SASL service name . . . . . . . . . . . . . . . . 114 184 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 114 185 13.1. Normative References . . . . . . . . . . . . . . . . . . 114 186 13.2. Informative References (related protocols) . . . . . . . 117 187 13.3. Informative References (historical aspects of IMAP and 188 related protocols) . . . . . . . . . . . . . . . . . . . 118 189 Appendix A. Backward compatibility with IMAP4rev1 . . . . . . . 119 190 A.1. Mailbox International Naming Convention . . . . . . . . . 119 191 Appendix B. Changes from RFC 3501 / IMAP4rev1 . . . . . . . . . 121 192 Appendix C. Acknowledgement . . . . . . . . . . . . . . . . . . 122 193 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 194 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 128 196 1. How to Read This Document 198 1.1. Organization of This Document 200 This document is written from the point of view of the implementor of 201 an IMAP4rev2 client or server. Beyond the protocol overview in 202 section 2, it is not optimized for someone trying to understand the 203 operation of the protocol. The material in sections 3 through 5 204 provides the general context and definitions with which IMAP4rev2 205 operates. 207 Sections 6, 7, and 9 describe the IMAP commands, responses, and 208 syntax, respectively. The relationships among these are such that it 209 is almost impossible to understand any of them separately. In 210 particular, do not attempt to deduce command syntax from the command 211 section alone; instead refer to the Formal Syntax section. 213 1.2. Conventions Used in This Document 215 "Conventions" are basic principles or procedures. Document 216 conventions are noted in this section. 218 In examples, "C:" and "S:" indicate lines sent by the client and 219 server respectively. 221 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 222 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 223 document are to be interpreted as described in [KEYWORDS]. 225 The word "can" (not "may") is used to refer to a possible 226 circumstance or situation, as opposed to an optional facility of the 227 protocol. 229 "User" is used to refer to a human user, whereas "client" refers to 230 the software being run by the user. 232 "Connection" refers to the entire sequence of client/server 233 interaction from the initial establishment of the network connection 234 until its termination. 236 "Session" refers to the sequence of client/server interaction from 237 the time that a mailbox is selected (SELECT or EXAMINE command) until 238 the time that selection ends (SELECT or EXAMINE of another mailbox, 239 CLOSE command, or connection termination). 241 Characters are 7-bit US-ASCII unless otherwise specified. Other 242 character sets are indicated using a "CHARSET", as described in 243 [MIME-IMT] and defined in [CHARSET]. CHARSETs have important 244 additional semantics in addition to defining character set; refer to 245 these documents for more detail. 247 There are several protocol conventions in IMAP. These refer to 248 aspects of the specification which are not strictly part of the IMAP 249 protocol, but reflect generally-accepted practice. Implementations 250 need to be aware of these conventions, and avoid conflicts whether or 251 not they implement the convention. For example, "&" may not be used 252 as a hierarchy delimiter since it conflicts with the Mailbox 253 International Naming Convention, and other uses of "&" in mailbox 254 names are impacted as well. 256 1.3. Special Notes to Implementors 258 Implementors of the IMAP protocol are strongly encouraged to read the 259 IMAP implementation recommendations document [IMAP-IMPLEMENTATION] in 260 conjunction with this document, to help understand the intricacies of 261 this protocol and how best to build an interoperable product. 263 IMAP4rev2 is designed to be upwards compatible from the [IMAP2] and 264 unpublished IMAP2bis protocols. IMAP4rev2 is largely compatible with 265 the IMAP4rev1 protocol described in RFC 3501 and the IMAP4 protocol 266 described in RFC 1730; the exception being in certain facilities 267 added in RFC 1730 that proved problematic and were subsequently 268 removed. In the course of the evolution of IMAP4rev2, some aspects 269 in the earlier protocols have become obsolete. Obsolete commands, 270 responses, and data formats which an IMAP4rev2 implementation can 271 encounter when used with an earlier implementation are described in 272 [IMAP-OBSOLETE]. 274 Other compatibility issues with IMAP2bis, the most common variant of 275 the earlier protocol, are discussed in [IMAP-COMPAT]. A full 276 discussion of compatibility issues with rare (and presumed extinct) 277 variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is 278 primarily of historical interest. 280 IMAP was originally developed for the older [RFC-822] standard, and 281 as a consequence several fetch items in IMAP incorporate "RFC822" in 282 their name. With the exception of RFC822.SIZE, there are more modern 283 replacements; for example, the modern version of RFC822.HEADER is 284 BODY.PEEK[HEADER]. In all cases, "RFC822" should be interpreted as a 285 reference to the updated [RFC-5322] standard. 287 2. Protocol Overview 289 2.1. Link Level 291 The IMAP4rev2 protocol assumes a reliable data stream such as that 292 provided by TCP. When TCP is used, an IMAP4rev2 server listens on 293 port 143. 295 2.2. Commands and Responses 297 An IMAP4rev2 connection consists of the establishment of a client/ 298 server network connection, an initial greeting from the server, and 299 client/server interactions. These client/server interactions consist 300 of a client command, server data, and a server completion result 301 response. 303 All interactions transmitted by client and server are in the form of 304 lines, that is, strings that end with a CRLF. The protocol receiver 305 of an IMAP4rev2 client or server is either reading a line, or is 306 reading a sequence of octets with a known count followed by a line. 308 2.2.1. Client Protocol Sender and Server Protocol Receiver 310 The client command begins an operation. Each client command is 311 prefixed with an identifier (typically a short alphanumeric string, 312 e.g., A0001, A0002, etc.) called a "tag". A different tag is 313 generated by the client for each command. 315 Clients MUST follow the syntax outlined in this specification 316 strictly. It is a syntax error to send a command with missing or 317 extraneous spaces or arguments. 319 There are two cases in which a line from the client does not 320 represent a complete command. In one case, a command argument is 321 quoted with an octet count (see the description of literal in String 322 under Data Formats); in the other case, the command arguments require 323 server feedback (see the AUTHENTICATE command). In either case, the 324 server sends a command continuation request response if it is ready 325 for the octets (if appropriate) and the remainder of the command. 326 This response is prefixed with the token "+". 328 Note: If instead, the server detected an error in the command, it 329 sends a BAD completion response with a tag matching the command 330 (as described below) to reject the command and prevent the client 331 from sending any more of the command. 333 It is also possible for the server to send a completion response 334 for some other command (if multiple commands are in progress), or 335 untagged data. In either case, the command continuation request 336 is still pending; the client takes the appropriate action for the 337 response, and reads another response from the server. In all 338 cases, the client MUST send a complete command (including 339 receiving all command continuation request responses and command 340 continuations for the command) before initiating a new command. 342 The protocol receiver of an IMAP4rev2 server reads a command line 343 from the client, parses the command and its arguments, and transmits 344 server data and a server command completion result response. 346 2.2.2. Server Protocol Sender and Client Protocol Receiver 348 Data transmitted by the server to the client and status responses 349 that do not indicate command completion are prefixed with the token 350 "*", and are called untagged responses. 352 Server data MAY be sent as a result of a client command, or MAY be 353 sent unilaterally by the server. There is no syntactic difference 354 between server data that resulted from a specific command and server 355 data that were sent unilaterally. 357 The server completion result response indicates the success or 358 failure of the operation. It is tagged with the same tag as the 359 client command which began the operation. Thus, if more than one 360 command is in progress, the tag in a server completion response 361 identifies the command to which the response applies. There are 362 three possible server completion responses: OK (indicating success), 363 NO (indicating failure), or BAD (indicating a protocol error such as 364 unrecognized command or command syntax error). 366 Servers SHOULD enforce the syntax outlined in this specification 367 strictly. Any client command with a protocol syntax error, including 368 (but not limited to) missing or extraneous spaces or arguments, 369 SHOULD be rejected, and the client given a BAD server completion 370 response. 372 The protocol receiver of an IMAP4rev2 client reads a response line 373 from the server. It then takes action on the response based upon the 374 first token of the response, which can be a tag, a "*", or a "+". 376 A client MUST be prepared to accept any server response at all times. 377 This includes server data that was not requested. Server data SHOULD 378 be recorded, so that the client can reference its recorded copy 379 rather than sending a command to the server to request the data. In 380 the case of certain server data, the data MUST be recorded. 382 This topic is discussed in greater detail in the Server Responses 383 section. 385 2.3. Message Attributes 387 In addition to message text, each message has several attributes 388 associated with it. These attributes can be retrieved individually 389 or in conjunction with other attributes or message texts. 391 2.3.1. Message Numbers 393 Messages in IMAP4rev2 are accessed by one of two numbers; the unique 394 identifier or the message sequence number. 396 2.3.1.1. Unique Identifier (UID) Message Attribute 398 An unsigned 32-bit value assigned to each message, which when used 399 with the unique identifier validity value (see below) forms a 64-bit 400 value that MUST NOT refer to any other message in the mailbox or any 401 subsequent mailbox with the same name forever. Unique identifiers 402 are assigned in a strictly ascending fashion in the mailbox; as each 403 message is added to the mailbox it is assigned a higher UID than the 404 message(s) which were added previously. Unlike message sequence 405 numbers, unique identifiers are not necessarily contiguous. 407 The unique identifier of a message MUST NOT change during the 408 session, and SHOULD NOT change between sessions. Any change of 409 unique identifiers between sessions MUST be detectable using the 410 UIDVALIDITY mechanism discussed below. Persistent unique identifiers 411 are required for a client to resynchronize its state from a previous 412 session with the server (e.g., disconnected or offline access 413 clients); this is discussed further in [IMAP-DISC]. 415 Associated with every mailbox are two 32-bit unsigned values which 416 aid in unique identifier handling: the next unique identifier value 417 (UIDNEXT) and the unique identifier validity value (UIDVALIDITY). 419 The next unique identifier value is the predicted value that will be 420 assigned to a new message in the mailbox. Unless the unique 421 identifier validity also changes (see below), the next unique 422 identifier value MUST have the following two characteristics. First, 423 the next unique identifier value MUST NOT change unless new messages 424 are added to the mailbox; and second, the next unique identifier 425 value MUST change whenever new messages are added to the mailbox, 426 even if those new messages are subsequently expunged. 428 Note: The next unique identifier value is intended to provide a 429 means for a client to determine whether any messages have been 430 delivered to the mailbox since the previous time it checked this 431 value. It is not intended to provide any guarantee that any 432 message will have this unique identifier. A client can only 433 assume, at the time that it obtains the next unique identifier 434 value, that messages arriving after that time will have a UID 435 greater than or equal to that value. 437 The unique identifier validity value is sent in a UIDVALIDITY 438 response code in an OK untagged response at mailbox selection time. 439 If unique identifiers from an earlier session fail to persist in this 440 session, the unique identifier validity value MUST be greater than 441 the one used in the earlier session. 443 Note: Ideally, unique identifiers SHOULD persist at all times. 444 Although this specification recognizes that failure to persist can 445 be unavoidable in certain server environments, it STRONGLY 446 ENCOURAGES message store implementation techniques that avoid this 447 problem. For example: 449 1. Unique identifiers MUST be strictly ascending in the mailbox 450 at all times. If the physical message store is re-ordered by 451 a non-IMAP agent, this requires that the unique identifiers in 452 the mailbox be regenerated, since the former unique 453 identifiers are no longer strictly ascending as a result of 454 the re-ordering. 456 2. If the message store has no mechanism to store unique 457 identifiers, it must regenerate unique identifiers at each 458 session, and each session must have a unique UIDVALIDITY 459 value. 461 3. If the mailbox is deleted and a new mailbox with the same name 462 is created at a later date, the server must either keep track 463 of unique identifiers from the previous instance of the 464 mailbox, or it must assign a new UIDVALIDITY value to the new 465 instance of the mailbox. A good UIDVALIDITY value to use in 466 this case is a 32-bit representation of the creation date/time 467 of the mailbox. It is alright to use a constant such as 1, 468 but only if it guaranteed that unique identifiers will never 469 be reused, even in the case of a mailbox being deleted (or 470 renamed) and a new mailbox by the same name created at some 471 future time. 473 4. The combination of mailbox name, UIDVALIDITY, and UID must 474 refer to a single immutable message on that server forever. 475 In particular, the internal date, [RFC-5322] size, envelope, 476 body structure, and message texts (RFC822, RFC822.HEADER, 477 RFC822.TEXT, and all BODY[...] fetch data items) must never 478 change. This does not include message numbers, nor does it 479 include attributes that can be set by a STORE command (e.g., 480 FLAGS). 482 2.3.1.2. Message Sequence Number Message Attribute 484 A relative position from 1 to the number of messages in the mailbox. 485 This position MUST be ordered by ascending unique identifier. As 486 each new message is added, it is assigned a message sequence number 487 that is 1 higher than the number of messages in the mailbox before 488 that new message was added. 490 Message sequence numbers can be reassigned during the session. For 491 example, when a message is permanently removed (expunged) from the 492 mailbox, the message sequence number for all subsequent messages is 493 decremented. The number of messages in the mailbox is also 494 decremented. Similarly, a new message can be assigned a message 495 sequence number that was once held by some other message prior to an 496 expunge. 498 In addition to accessing messages by relative position in the 499 mailbox, message sequence numbers can be used in mathematical 500 calculations. For example, if an untagged "11 EXISTS" is received, 501 and previously an untagged "8 EXISTS" was received, three new 502 messages have arrived with message sequence numbers of 9, 10, and 11. 503 Another example, if message 287 in a 523 message mailbox has UID 504 12345, there are exactly 286 messages which have lesser UIDs and 236 505 messages which have greater UIDs. 507 2.3.2. Flags Message Attribute 509 A list of zero or more named tokens associated with the message. A 510 flag is set by its addition to this list, and is cleared by its 511 removal. There are two types of flags in IMAP4rev2. A flag of 512 either type can be permanent or session-only. 514 A system flag is a flag name that is pre-defined in this 515 specification and begin with "\". Certain system flags (\Deleted and 516 \Seen) have special semantics described elsewhere in this document. 517 The currently-defined system flags are: 519 \Seen Message has been read 521 \Answered Message has been answered 523 \Flagged Message is "flagged" for urgent/special attention 525 \Deleted Message is "deleted" for removal by later EXPUNGE 526 \Draft Message has not completed composition (marked as a draft). 528 \Recent This flag was in used in IMAP4rev1 and is now deprecated. 530 A keyword is defined by the server implementation. Keywords do not 531 begin with "\". Servers MAY permit the client to define new keywords 532 in the mailbox (see the description of the PERMANENTFLAGS response 533 code for more information). Some keywords that start with "$" are 534 also defined in this specification. 536 This document defines several keywords that were not originally 537 defined in RFC 3501, but which were found to be useful by client 538 implementations. These keywords SHOULD be supported (i.e. allowed in 539 APPEND, COPY, MOVE and SEARCH commands) by server implementations: 541 $Forwarded Message has been forwarded to another email address, 542 embedded within or attached to a new message. An email client 543 sets this keyword when it successfully forwards the message to 544 another email address. Typical usage of this keyword is to show a 545 different (or additional) icon for a message that has been 546 forwarded. Once set, the flag SHOULD NOT be cleared. 548 $MDNSent Message Disposition Notification was generated and sent for 549 this message. 551 A flag can be permanent or session-only on a per-flag basis. 552 Permanent flags are those which the client can add or remove from the 553 message flags permanently; that is, concurrent and subsequent 554 sessions will see any change in permanent flags. Changes to session 555 flags are valid only in that session. 557 2.3.3. Internal Date Message Attribute 559 The internal date and time of the message on the server. This is not 560 the date and time in the [RFC-5322] header, but rather a date and 561 time which reflects when the message was received. In the case of 562 messages delivered via [SMTP], this SHOULD be the date and time of 563 final delivery of the message as defined by [SMTP]. In the case of 564 messages delivered by the IMAP4rev2 COPY or MOVE command, this SHOULD 565 be the internal date and time of the source message. In the case of 566 messages delivered by the IMAP4rev2 APPEND command, this SHOULD be 567 the date and time as specified in the APPEND command description. 568 All other cases are implementation defined. 570 2.3.4. [RFC-5322] Size Message Attribute 572 The number of octets in the message, as expressed in [RFC-5322] 573 format. 575 2.3.5. Envelope Structure Message Attribute 577 A parsed representation of the [RFC-5322] header of the message. 578 Note that the IMAP Envelope structure is not the same as an [SMTP] 579 envelope. 581 2.3.6. Body Structure Message Attribute 583 A parsed representation of the [MIME-IMB] body structure information 584 of the message. 586 2.4. Message Texts 588 In addition to being able to fetch the full [RFC-5322] text of a 589 message, IMAP4rev2 permits the fetching of portions of the full 590 message text. Specifically, it is possible to fetch the [RFC-5322] 591 message header, [RFC-5322] message body, a [MIME-IMB] body part, or a 592 [MIME-IMB] header. 594 3. State and Flow Diagram 596 Once the connection between client and server is established, an 597 IMAP4rev2 connection is in one of four states. The initial state is 598 identified in the server greeting. Most commands are only valid in 599 certain states. It is a protocol error for the client to attempt a 600 command while the connection is in an inappropriate state, and the 601 server will respond with a BAD or NO (depending upon server 602 implementation) command completion result. 604 3.1. Not Authenticated State 606 In the not authenticated state, the client MUST supply authentication 607 credentials before most commands will be permitted. This state is 608 entered when a connection starts unless the connection has been pre- 609 authenticated. 611 3.2. Authenticated State 613 In the authenticated state, the client is authenticated and MUST 614 select a mailbox to access before commands that affect messages will 615 be permitted. This state is entered when a pre-authenticated 616 connection starts, when acceptable authentication credentials have 617 been provided, after an error in selecting a mailbox, or after a 618 successful CLOSE command. 620 3.3. Selected State 622 In a selected state, a mailbox has been selected to access. This 623 state is entered when a mailbox has been successfully selected. 625 3.4. Logout State 627 In the logout state, the connection is being terminated. This state 628 can be entered as a result of a client request (via the LOGOUT 629 command) or by unilateral action on the part of either the client or 630 server. 632 If the client requests the logout state, the server MUST send an 633 untagged BYE response and a tagged OK response to the LOGOUT command 634 before the server closes the connection; and the client MUST read the 635 tagged OK response to the LOGOUT command before the client closes the 636 connection. 638 A server MUST NOT unilaterally close the connection without sending 639 an untagged BYE response that contains the reason for having done so. 640 A client SHOULD NOT unilaterally close the connection, and instead 641 SHOULD issue a LOGOUT command. If the server detects that the client 642 has unilaterally closed the connection, the server MAY omit the 643 untagged BYE response and simply close its connection. 645 +----------------------+ 646 |connection established| 647 +----------------------+ 648 || 649 \/ 650 +--------------------------------------+ 651 | server greeting | 652 +--------------------------------------+ 653 || (1) || (2) || (3) 654 \/ || || 655 +-----------------+ || || 656 |Not Authenticated| || || 657 +-----------------+ || || 658 || (7) || (4) || || 659 || \/ \/ || 660 || +----------------+ || 661 || | Authenticated |<=++ || 662 || +----------------+ || || 663 || || (7) || (5) || (6) || 664 || || \/ || || 665 || || +--------+ || || 666 || || |Selected|==++ || 667 || || +--------+ || 668 || || || (7) || 669 \/ \/ \/ \/ 670 +--------------------------------------+ 671 | Logout | 672 +--------------------------------------+ 673 || 674 \/ 675 +-------------------------------+ 676 |both sides close the connection| 677 +-------------------------------+ 679 (1) connection without pre-authentication (OK greeting) 680 (2) pre-authenticated connection (PREAUTH greeting) 681 (3) rejected connection (BYE greeting) 682 (4) successful LOGIN or AUTHENTICATE command 683 (5) successful SELECT or EXAMINE command 684 (6) CLOSE command, unsolicited CLOSED response code or 685 failed SELECT or EXAMINE command 686 (7) LOGOUT command, server shutdown, or connection closed 688 4. Data Formats 690 IMAP4rev2 uses textual commands and responses. Data in IMAP4rev2 can 691 be in one of several forms: atom, number, string, parenthesized list, 692 or NIL. Note that a particular data item may take more than one 693 form; for example, a data item defined as using "astring" syntax may 694 be either an atom or a string. 696 4.1. Atom 698 An atom consists of one or more non-special characters. 700 4.1.1. Sequence set and UID set 702 A set of messages can be referenced by a sequence set containing 703 either message sequence numbers or unique identifiers. See Section 9 704 for details. Sequence sets can contain ranges (e.g. "5:50"), an 705 enumeration of specific message/UID numbers, a special symbol "*", or 706 a combination of the above. 708 A "UID set" is similar to the sequence set of unique identifiers; 709 however, the "*" value for a sequence number is not permitted. 711 4.2. Number 713 A number consists of one or more digit characters, and represents a 714 numeric value. 716 4.3. String 718 A string is in one of three forms: synchonizing literal, non- 719 synchronizing literal or quoted string. The synchronizing literal 720 form is the general form of string. The non-synchronizing literal 721 form is also the general form, but has length limitation. The quoted 722 string form is an alternative that avoids the overhead of processing 723 a literal at the cost of limitations of characters which may be used. 725 When the distinction between synchronizing and non-synchronizing 726 literals is not important, this document just uses the term 727 "literal". 729 A synchronizing literal is a sequence of zero or more octets 730 (including CR and LF), prefix-quoted with an octet count in the form 731 of an open brace ("{"), the number of octets, close brace ("}"), and 732 CRLF. In the case of synchronizing literals transmitted from server 733 to client, the CRLF is immediately followed by the octet data. In 734 the case of synchronizing literals transmitted from client to server, 735 the client MUST wait to receive a command continuation request 736 (described later in this document) before sending the octet data (and 737 the remainder of the command). 739 The non-synchronizing literal is an alternate form of synchronizing 740 literal, and it may appear in communication from client to server 741 instead of the synchonizing form of literal. The non-synchronizing 742 literal form MUST NOT be sent from server to client. The non- 743 synchronizing literal is distinguished from the synchronizing literal 744 by having a plus ("+") between the octet count and the closing brace 745 ("}"). The server does not generate a command continuation request 746 in response to a non-synchronizing literal, and clients are not 747 required to wait before sending the octets of a non- synchronizing 748 literal. Non-synchronizing literals MUST NOT be larger than 4096 749 octets. Any literal larger than 4096 bytes MUST be sent as a 750 synchronizing literal. (Non-synchronizing literals defined in this 751 document are the same as non-synchronizing literals defined by the 752 LITERAL- extension from [RFC7888]. See that document for details on 753 how to handle invalid non-synchronizing literals longer than 4096 754 octets and for interaction with other IMAP extensions.) 756 A quoted string is a sequence of zero or more Unicode characters, 757 excluding CR and LF, encoded in UTF-8, with double quote (<">) 758 characters at each end. 760 The empty string is represented as "" (a quoted string with zero 761 characters between double quotes), as {0} followed by CRLF (a 762 synchronizing literal with an octet count of 0) or as {0+} followed 763 by CRLF (a non-synchronizing literal with an octet count of 0). 765 Note: Even if the octet count is 0, a client transmitting a 766 synchronizing literal MUST wait to receive a command continuation 767 request. 769 4.3.1. 8-bit and Binary Strings 771 8-bit textual and binary mail is supported through the use of a 772 [MIME-IMB] content transfer encoding. IMAP4rev2 implementations MAY 773 transmit 8-bit or multi-octet characters in literals, but SHOULD do 774 so only when the [CHARSET] is identified. 776 IMAP4rev2 is compatible with [I18N-HDRS]. As a result, the 777 identified charset for header-field values with 8-bit content is 778 UTF-8 [UTF-8]. IMAP4rev2 implementations MUST accept and MAY 779 transmit [UTF-8] text in quoted-strings as long as the string does 780 not contain NUL, CR, or LF. This differs from IMAP4rev1 781 implementations. 783 Although a BINARY body encoding is defined, unencoded binary strings 784 are not permitted. A "binary string" is any string with NUL 785 characters. Implementations MUST encode binary data into a textual 786 form, such as BASE64, before transmitting the data. A string with an 787 excessive amount of CTL characters MAY also be considered to be 788 binary. 790 4.4. Parenthesized List 792 Data structures are represented as a "parenthesized list"; a sequence 793 of data items, delimited by space, and bounded at each end by 794 parentheses. A parenthesized list can contain other parenthesized 795 lists, using multiple levels of parentheses to indicate nesting. 797 The empty list is represented as () -- a parenthesized list with no 798 members. 800 4.5. NIL 802 The special form "NIL" represents the non-existence of a particular 803 data item that is represented as a string or parenthesized list, as 804 distinct from the empty string "" or the empty parenthesized list (). 806 Note: NIL is never used for any data item which takes the form of 807 an atom. For example, a mailbox name of "NIL" is a mailbox named 808 NIL as opposed to a non-existent mailbox name. This is because 809 mailbox uses "astring" syntax which is an atom or a string. 810 Conversely, an addr-name of NIL is a non-existent personal name, 811 because addr-name uses "nstring" syntax which is NIL or a string, 812 but never an atom. 814 5. Operational Considerations 816 The following rules are listed here to ensure that all IMAP4rev2 817 implementations interoperate properly. 819 5.1. Mailbox Naming 821 In IMAP4rev2, Mailbox names are encoded in Net-Unicode [NET-UNICODE] 822 (this differs from IMAP4rev1). Client implementations MAY attempt to 823 create Net-Unicode mailbox names, and MUST interpret any 8-bit 824 mailbox names returned by LIST or LSUB as [NET-UNICODE]. Server 825 implementations MUST prohibit the creation of 8-bit mailbox names 826 that do not comply with Net-Unicode (however, servers MAY accept a 827 de-normalized UTF-8 mailbox name and convert it to Net-Unicode prior 828 to mailbox creation). 830 The case-insensitive mailbox name INBOX is a special name reserved to 831 mean "the primary mailbox for this user on this server". (Note that 832 this special name may not exist on some servers for some users.) The 833 interpretation of all other names is implementation-dependent. 835 In particular, this specification takes no position on case 836 sensitivity in non-INBOX mailbox names. Some server implementations 837 are fully case-sensitive in ASCII range; others preserve case of a 838 newly-created name but otherwise are case-insensitive; and yet others 839 coerce names to a particular case. Client implementations MUST 840 interact with any of these. 842 There are certain client considerations when creating a new mailbox 843 name: 845 1. Any character which is one of the atom-specials (see the Formal 846 Syntax) will require that the mailbox name be represented as a 847 quoted string or literal. 849 2. CTL and other non-graphic characters are difficult to represent 850 in a user interface and are best avoided. Servers MAY refuse to 851 create mailbox names containing Unicode CTL characters. 853 3. Although the list-wildcard characters ("%" and "*") are valid in 854 a mailbox name, it is difficult to use such mailbox names with 855 the LIST and LSUB commands due to the conflict with wildcard 856 interpretation. 858 4. Usually, a character (determined by the server implementation) is 859 reserved to delimit levels of hierarchy. 861 5. Two characters, "#" and "&", have meanings by convention, and 862 should be avoided except when used in that convention. 864 5.1.1. Mailbox Hierarchy Naming 866 If it is desired to export hierarchical mailbox names, mailbox names 867 MUST be left-to-right hierarchical using a single character to 868 separate levels of hierarchy. The same hierarchy separator character 869 is used for all levels of hierarchy within a single name. 871 5.1.2. Namespaces 873 Personal Namespace: A namespace that the server considers within the 874 personal scope of the authenticated user on a particular connection. 875 Typically, only the authenticated user has access to mailboxes in 876 their Personal Namespace. It is the part of the namespace that 877 belongs to the user that is allocated for mailboxes. If an INBOX 878 exists for a user, it MUST appear within the user's personal 879 namespace. In the typical case, there SHOULD be only one Personal 880 Namespace on a server. 882 Other Users' Namespace: A namespace that consists of mailboxes from 883 the Personal Namespaces of other users. To access mailboxes in the 884 Other Users' Namespace, the currently authenticated user MUST be 885 explicitly granted access rights. For example, it is common for a 886 manager to grant to their secretary access rights to their mailbox. 887 In the typical case, there SHOULD be only one Other Users' Namespace 888 on a server. 890 Shared Namespace: A namespace that consists of mailboxes that are 891 intended to be shared amongst users and do not exist within a user's 892 Personal Namespace. 894 The namespaces a server uses MAY differ on a per-user basis. 896 5.1.2.1. Historic Mailbox Namespace Naming Convention 898 By convention, the first hierarchical element of any mailbox name 899 which begins with "#" identifies the "namespace" of the remainder of 900 the name. This makes it possible to disambiguate between different 901 types of mailbox stores, each of which have their own namespaces. 903 For example, implementations which offer access to USENET 904 newsgroups MAY use the "#news" namespace to partition the USENET 905 newsgroup namespace from that of other mailboxes. Thus, the 906 comp.mail.misc newsgroup would have a mailbox name of 907 "#news.comp.mail.misc", and the name "comp.mail.misc" can refer to 908 a different object (e.g., a user's private mailbox). 910 Namespaces that include the "#" character are not IMAP URL [IMAP-URL] 911 friendly requiring the "#" character to be represented as %23 when 912 within URLs. As such, server implementers MAY instead consider using 913 namespace prefixes that do not contain the "#" character. 915 5.1.2.2. Common namespace models 917 Previous version of this protocol does not define a default server 918 namespace. Two common namespace models have evolved: 920 The "Personal Mailbox" model, in which the default namespace that is 921 presented consists of only the user's personal mailboxes. To access 922 shared mailboxes, the user must use an escape mechanism to reach 923 another namespace. 925 The "Complete Hierarchy" model, in which the default namespace that 926 is presented includes the user's personal mailboxes along with any 927 other mailboxes they have access to. 929 5.2. Mailbox Size and Message Status Updates 931 At any time, a server can send data that the client did not request. 932 Sometimes, such behavior is REQUIRED. For example, agents other than 933 the server MAY add messages to the mailbox (e.g., new message 934 delivery), change the flags of the messages in the mailbox (e.g., 935 simultaneous access to the same mailbox by multiple agents), or even 936 remove messages from the mailbox. A server MUST send mailbox size 937 updates automatically if a mailbox size change is observed during the 938 processing of a command. A server SHOULD send message flag updates 939 automatically, without requiring the client to request such updates 940 explicitly. 942 Special rules exist for server notification of a client about the 943 removal of messages to prevent synchronization errors; see the 944 description of the EXPUNGE response for more detail. In particular, 945 it is NOT permitted to send an EXISTS response that would reduce the 946 number of messages in the mailbox; only the EXPUNGE response can do 947 this. 949 Regardless of what implementation decisions a client makes on 950 remembering data from the server, a client implementation MUST record 951 mailbox size updates. It MUST NOT assume that any command after the 952 initial mailbox selection will return the size of the mailbox. 954 5.3. Response when no Command in Progress 956 Server implementations are permitted to send an untagged response 957 (except for EXPUNGE) while there is no command in progress. Server 958 implementations that send such responses MUST deal with flow control 959 considerations. Specifically, they MUST either (1) verify that the 960 size of the data does not exceed the underlying transport's available 961 window size, or (2) use non-blocking writes. 963 5.4. Autologout Timer 965 If a server has an inactivity autologout timer that applies to 966 sessions after authentication, the duration of that timer MUST be at 967 least 30 minutes. The receipt of ANY command from the client during 968 that interval SHOULD suffice to reset the autologout timer. 970 5.5. Multiple Commands in Progress (Command Pipelining) 972 The client MAY send another command without waiting for the 973 completion result response of a command, subject to ambiguity rules 974 (see below) and flow control constraints on the underlying data 975 stream. Similarly, a server MAY begin processing another command 976 before processing the current command to completion, subject to 977 ambiguity rules. However, any command continuation request responses 978 and command continuations MUST be negotiated before any subsequent 979 command is initiated. 981 The exception is if an ambiguity would result because of a command 982 that would affect the results of other commands. Clients MUST NOT 983 send multiple commands without waiting if an ambiguity would result. 984 If the server detects a possible ambiguity, it MUST execute commands 985 to completion in the order given by the client. 987 The most obvious example of ambiguity is when a command would affect 988 the results of another command, e.g., a FETCH of a message's flags 989 and a STORE of that same message's flags. 991 A non-obvious ambiguity occurs with commands that permit an untagged 992 EXPUNGE response (commands other than FETCH, STORE, and SEARCH), 993 since an untagged EXPUNGE response can invalidate sequence numbers in 994 a subsequent command. This is not a problem for FETCH, STORE, or 995 SEARCH commands because servers are prohibited from sending EXPUNGE 996 responses while any of those commands are in progress. Therefore, if 997 the client sends any command other than FETCH, STORE, or SEARCH, it 998 MUST wait for the completion result response before sending a command 999 with message sequence numbers. 1001 Note: EXPUNGE responses are permitted while UID FETCH, UID STORE, 1002 and UID SEARCH are in progress. If the client sends a UID 1003 command, it MUST wait for a completion result response before 1004 sending a command which uses message sequence numbers (this may 1005 include UID SEARCH). Any message sequence numbers in an argument 1006 to UID SEARCH are associated with messages prior to the effect of 1007 any untagged EXPUNGE returned by the UID SEARCH. 1009 For example, the following non-waiting command sequences are invalid: 1011 FETCH + NOOP + STORE 1013 STORE + COPY + FETCH 1015 COPY + COPY 1017 CHECK + FETCH 1019 The following are examples of valid non-waiting command sequences: 1021 FETCH + STORE + SEARCH + CHECK 1023 STORE + COPY + EXPUNGE 1025 UID SEARCH + UID SEARCH may be valid or invalid as a non-waiting 1026 command sequence, depending upon whether or not the second UID 1027 SEARCH contains message sequence numbers. 1029 6. Client Commands 1031 IMAP4rev2 commands are described in this section. Commands are 1032 organized by the state in which the command is permitted. Commands 1033 which are permitted in multiple states are listed in the minimum 1034 permitted state (for example, commands valid in authenticated and 1035 selected state are listed in the authenticated state commands). 1037 Command arguments, identified by "Arguments:" in the command 1038 descriptions below, are described by function, not by syntax. The 1039 precise syntax of command arguments is described in the Formal Syntax 1040 (Section 9). 1042 Some commands cause specific server responses to be returned; these 1043 are identified by "Responses:" in the command descriptions below. 1044 See the response descriptions in the Responses section for 1045 information on these responses, and the Formal Syntax section for the 1046 precise syntax of these responses. It is possible for server data to 1047 be transmitted as a result of any command. Thus, commands that do 1048 not specifically require server data specify "no specific responses 1049 for this command" instead of "none". 1051 The "Result:" in the command description refers to the possible 1052 tagged status responses to a command, and any special interpretation 1053 of these status responses. 1055 The state of a connection is only changed by successful commands 1056 which are documented as changing state. A rejected command (BAD 1057 response) never changes the state of the connection or of the 1058 selected mailbox. A failed command (NO response) generally does not 1059 change the state of the connection or of the selected mailbox; the 1060 exception being the SELECT and EXAMINE commands. 1062 6.1. Client Commands - Any State 1064 The following commands are valid in any state: CAPABILITY, NOOP, and 1065 LOGOUT. 1067 6.1.1. CAPABILITY Command 1069 Arguments: none 1071 Responses: REQUIRED untagged response: CAPABILITY 1073 Result: OK - capability completed 1074 BAD - command unknown or arguments invalid 1076 The CAPABILITY command requests a listing of capabilities that the 1077 server supports. The server MUST send a single untagged CAPABILITY 1078 response with "IMAP4rev2" as one of the listed capabilities before 1079 the (tagged) OK response. 1081 A capability name which begins with "AUTH=" indicates that the server 1082 supports that particular authentication mechanism. All such names 1083 are, by definition, part of this specification. For example, the 1084 authorization capability for an experimental "blurdybloop" 1085 authenticator would be "AUTH=XBLURDYBLOOP" and not 1086 "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP". 1088 Other capability names refer to extensions, revisions, or amendments 1089 to this specification. See the documentation of the CAPABILITY 1090 response for additional information. No capabilities, beyond the 1091 base IMAP4rev2 set defined in this specification, are enabled without 1092 explicit client action to invoke the capability. 1094 Client and server implementations MUST implement the STARTTLS, 1095 LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) capabilities. 1096 See the Security Considerations section for important information. 1098 See the section entitled "Client Commands - Experimental/Expansion" 1099 for information about the form of site or implementation-specific 1100 capabilities. 1102 Example: C: abcd CAPABILITY 1103 S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI 1104 LOGINDISABLED 1105 S: abcd OK CAPABILITY completed 1106 C: efgh STARTTLS 1107 S: efgh OK STARTLS completed 1108 1109 C: ijkl CAPABILITY 1110 S: * CAPABILITY IMAP4rev2 AUTH=GSSAPI AUTH=PLAIN 1111 S: ijkl OK CAPABILITY completed 1113 6.1.2. NOOP Command 1115 Arguments: none 1117 Responses: no specific responses for this command (but see below) 1119 Result: OK - noop completed 1120 BAD - command unknown or arguments invalid 1122 The NOOP command always succeeds. It does nothing. 1124 Since any command can return a status update as untagged data, the 1125 NOOP command can be used as a periodic poll for new messages or 1126 message status updates during a period of inactivity (this is the 1127 preferred method to do this). The NOOP command can also be used to 1128 reset any inactivity autologout timer on the server. 1130 Example: C: a002 NOOP 1131 S: a002 OK NOOP completed 1132 . . . 1133 C: a047 NOOP 1134 S: * 22 EXPUNGE 1135 S: * 23 EXISTS 1136 S: * 14 FETCH (FLAGS (\Seen \Deleted)) 1137 S: a047 OK NOOP completed 1139 6.1.3. LOGOUT Command 1141 Arguments: none 1143 Responses: REQUIRED untagged response: BYE 1145 Result: OK - logout completed 1146 BAD - command unknown or arguments invalid 1148 The LOGOUT command informs the server that the client is done with 1149 the connection. The server MUST send a BYE untagged response before 1150 the (tagged) OK response, and then close the network connection. 1152 Example: C: A023 LOGOUT 1153 S: * BYE IMAP4rev2 Server logging out 1154 S: A023 OK LOGOUT completed 1155 (Server and client then close the connection) 1157 6.2. Client Commands - Not Authenticated State 1159 In the not authenticated state, the AUTHENTICATE or LOGIN command 1160 establishes authentication and enters the authenticated state. The 1161 AUTHENTICATE command provides a general mechanism for a variety of 1162 authentication techniques, privacy protection, and integrity 1163 checking; whereas the LOGIN command uses a traditional user name and 1164 plaintext password pair and has no means of establishing privacy 1165 protection or integrity checking. 1167 The STARTTLS command is an alternate form of establishing session 1168 privacy protection and integrity checking, but does not by itself 1169 establish authentication or enter the authenticated state. 1171 Server implementations MAY allow access to certain mailboxes without 1172 establishing authentication. This can be done by means of the 1173 ANONYMOUS [SASL] authenticator described in [ANONYMOUS]. An older 1174 convention is a LOGIN command using the userid "anonymous"; in this 1175 case, a password is required although the server may choose to accept 1176 any password. The restrictions placed on anonymous users are 1177 implementation-dependent. 1179 Once authenticated (including as anonymous), it is not possible to 1180 re-enter not authenticated state. 1182 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1183 the following commands are valid in the not authenticated state: 1184 STARTTLS, AUTHENTICATE and LOGIN. See the Security Considerations 1185 section for important information about these commands. 1187 6.2.1. STARTTLS Command 1189 Arguments: none 1191 Responses: no specific response for this command 1193 Result: OK - starttls completed, begin TLS negotiation 1194 BAD - command unknown or arguments invalid 1196 A [TLS] negotiation begins immediately after the CRLF at the end of 1197 the tagged OK response from the server. Once a client issues a 1198 STARTTLS command, it MUST NOT issue further commands until a server 1199 response is seen and the [TLS] negotiation is complete. 1201 The server remains in the non-authenticated state, even if client 1202 credentials are supplied during the [TLS] negotiation. This does not 1203 preclude an authentication mechanism such as EXTERNAL (defined in 1205 [SASL]) from using client identity determined by the [TLS] 1206 negotiation. 1208 Once [TLS] has been started, the client MUST discard cached 1209 information about server capabilities and SHOULD re-issue the 1210 CAPABILITY command. This is necessary to protect against man-in- 1211 the-middle attacks which alter the capabilities list prior to 1212 STARTTLS. The server MAY advertise different capabilities, and in 1213 particular SHOULD NOT advertise the STARTTLS capability, after a 1214 successful STARTTLS command. 1216 Example: C: a001 CAPABILITY 1217 S: * CAPABILITY IMAP4rev2 STARTTLS LOGINDISABLED 1218 S: a001 OK CAPABILITY completed 1219 C: a002 STARTTLS 1220 S: a002 OK Begin TLS negotiation now 1221 1222 C: a003 CAPABILITY 1223 S: * CAPABILITY IMAP4rev2 AUTH=PLAIN 1224 S: a003 OK CAPABILITY completed 1225 C: a004 LOGIN joe password 1226 S: a004 OK LOGIN completed 1228 6.2.2. AUTHENTICATE Command 1230 Arguments: SASL authentication mechanism name 1231 OPTIONAL initial response 1233 Responses: continuation data can be requested 1235 Result: OK - authenticate completed, now in authenticated state 1236 NO - authenticate failure: unsupported authentication 1237 mechanism, credentials rejected 1238 BAD - command unknown or arguments invalid, 1239 authentication exchange cancelled 1241 The AUTHENTICATE command indicates a [SASL] authentication mechanism 1242 to the server. If the server supports the requested authentication 1243 mechanism, it performs an authentication protocol exchange to 1244 authenticate and identify the client. It MAY also negotiate an 1245 OPTIONAL security layer for subsequent protocol interactions. If the 1246 requested authentication mechanism is not supported, the server 1247 SHOULD reject the AUTHENTICATE command by sending a tagged NO 1248 response. 1250 The AUTHENTICATE command supports the optional "initial response" 1251 feature defined in Section 5.1 of [SASL]. The client doesn't need to 1252 use it. If a SASL mechanism supports "initial response", but it is 1253 not specified by the client, the server handles this as specified in 1254 Section 3 of [SASL]. 1256 The service name specified by this protocol's profile of [SASL] is 1257 "imap". 1259 The authentication protocol exchange consists of a series of server 1260 challenges and client responses that are specific to the 1261 authentication mechanism. A server challenge consists of a command 1262 continuation request response with the "+" token followed by a BASE64 1263 encoded (see Section 4 of [RFC4648]) string. The client response 1264 consists of a single line consisting of a BASE64 encoded string. If 1265 the client wishes to cancel an authentication exchange, it issues a 1266 line consisting of a single "*". If the server receives such a 1267 response, or if it receives an invalid BASE64 string (e.g. 1268 characters outside the BASE64 alphabet, or non-terminal "="), it MUST 1269 reject the AUTHENTICATE command by sending a tagged BAD response. 1271 As with any other client response, this initial response MUST be 1272 encoded as BASE64. It also MUST be transmitted outside of a quoted 1273 string or literal. To send a zero-length initial response, the 1274 client MUST send a single pad character ("="). This indicates that 1275 the response is present, but is a zero-length string. 1277 When decoding the BASE64 data in the initial response, decoding 1278 errors MUST be treated as in any normal SASL client response, i.e. 1279 with a tagged BAD response. In particular, the server should check 1280 for any characters not explicitly allowed by the BASE64 alphabet, as 1281 well as any sequence of BASE64 characters that contains the pad 1282 character ('=') anywhere other than the end of the string (e.g., 1283 "=AAA" and "AAA=BBB" are not allowed). 1285 If the client uses an initial response with a SASL mechanism that 1286 does not support an initial response, the server MUST reject the 1287 command with a tagged BAD response. 1289 If a security layer is negotiated through the [SASL] authentication 1290 exchange, it takes effect immediately following the CRLF that 1291 concludes the authentication exchange for the client, and the CRLF of 1292 the tagged OK response for the server. 1294 While client and server implementations MUST implement the 1295 AUTHENTICATE command itself, it is not required to implement any 1296 authentication mechanisms other than the PLAIN mechanism described in 1297 [PLAIN]. Also, an authentication mechanism is not required to 1298 support any security layers. 1300 Note: a server implementation MUST implement a configuration in 1301 which it does NOT permit any plaintext password mechanisms, unless 1302 either the STARTTLS command has been negotiated or some other 1303 mechanism that protects the session from password snooping has 1304 been provided. Server sites SHOULD NOT use any configuration 1305 which permits a plaintext password mechanism without such a 1306 protection mechanism against password snooping. Client and server 1307 implementations SHOULD implement additional [SASL] mechanisms that 1308 do not use plaintext passwords, such the GSSAPI mechanism 1309 described in [SASL] and/or the [DIGEST-MD5] mechanism. 1311 Servers and clients can support multiple authentication mechanisms. 1312 The server SHOULD list its supported authentication mechanisms in the 1313 response to the CAPABILITY command so that the client knows which 1314 authentication mechanisms to use. 1316 A server MAY include a CAPABILITY response code in the tagged OK 1317 response of a successful AUTHENTICATE command in order to send 1318 capabilities automatically. It is unnecessary for a client to send a 1319 separate CAPABILITY command if it recognizes these automatic 1320 capabilities. This should only be done if a security layer was not 1321 negotiated by the AUTHENTICATE command, because the tagged OK 1322 response as part of an AUTHENTICATE command is not protected by 1323 encryption/integrity checking. [SASL] requires the client to re- 1324 issue a CAPABILITY command in this case. The server MAY advertise 1325 different capabilities after a successful AUTHENTICATE command. 1327 If an AUTHENTICATE command fails with a NO response, the client MAY 1328 try another authentication mechanism by issuing another AUTHENTICATE 1329 command. It MAY also attempt to authenticate by using the LOGIN 1330 command (see Section 6.2.3 for more detail). In other words, the 1331 client MAY request authentication types in decreasing order of 1332 preference, with the LOGIN command as a last resort. 1334 The authorization identity passed from the client to the server 1335 during the authentication exchange is interpreted by the server as 1336 the user name whose privileges the client is requesting. 1338 Example: S: * OK IMAP4rev2 Server 1339 C: A001 AUTHENTICATE GSSAPI 1340 S: + 1341 C: YIIB+wYJKoZIhvcSAQICAQBuggHqMIIB5qADAgEFoQMCAQ6iBw 1342 MFACAAAACjggEmYYIBIjCCAR6gAwIBBaESGxB1Lndhc2hpbmd0 1343 b24uZWR1oi0wK6ADAgEDoSQwIhsEaW1hcBsac2hpdmFtcy5jYW 1344 Mud2FzaGluZ3Rvbi5lZHWjgdMwgdCgAwIBAaEDAgEDooHDBIHA 1345 cS1GSa5b+fXnPZNmXB9SjL8Ollj2SKyb+3S0iXMljen/jNkpJX 1346 AleKTz6BQPzj8duz8EtoOuNfKgweViyn/9B9bccy1uuAE2HI0y 1347 C/PHXNNU9ZrBziJ8Lm0tTNc98kUpjXnHZhsMcz5Mx2GR6dGknb 1348 I0iaGcRerMUsWOuBmKKKRmVMMdR9T3EZdpqsBd7jZCNMWotjhi 1349 vd5zovQlFqQ2Wjc2+y46vKP/iXxWIuQJuDiisyXF0Y8+5GTpAL 1350 pHDc1/pIGmMIGjoAMCAQGigZsEgZg2on5mSuxoDHEA1w9bcW9n 1351 FdFxDKpdrQhVGVRDIzcCMCTzvUboqb5KjY1NJKJsfjRQiBYBdE 1352 NKfzK+g5DlV8nrw81uOcP8NOQCLR5XkoMHC0Dr/80ziQzbNqhx 1353 O6652Npft0LQwJvenwDI13YxpwOdMXzkWZN/XrEqOWp6GCgXTB 1354 vCyLWLlWnbaUkZdEYbKHBPjd8t/1x5Yg== 1355 S: + YGgGCSqGSIb3EgECAgIAb1kwV6ADAgEFoQMCAQ+iSzBJoAMC 1356 AQGiQgRAtHTEuOP2BXb9sBYFR4SJlDZxmg39IxmRBOhXRKdDA0 1357 uHTCOT9Bq3OsUTXUlk0CsFLoa8j+gvGDlgHuqzWHPSQg== 1358 C: 1359 S: + YDMGCSqGSIb3EgECAgIBAAD/////6jcyG4GE3KkTzBeBiVHe 1360 ceP2CWY0SR0fAQAgAAQEBAQ= 1361 C: YDMGCSqGSIb3EgECAgIBAAD/////3LQBHXTpFfZgrejpLlLImP 1362 wkhbfa2QteAQAgAG1yYwE= 1363 S: A001 OK GSSAPI authentication successful 1365 Note: The line breaks within server challenges and client responses 1366 are for editorial clarity and are not in real authenticators. 1368 6.2.3. LOGIN Command 1370 Arguments: user name 1371 password 1373 Responses: no specific responses for this command 1375 Result: OK - login completed, now in authenticated state 1376 NO - login failure: user name or password rejected 1377 BAD - command unknown or arguments invalid 1379 The LOGIN command identifies the client to the server and carries the 1380 plaintext password authenticating this user. 1382 A server MAY include a CAPABILITY response code in the tagged OK 1383 response to a successful LOGIN command in order to send capabilities 1384 automatically. It is unnecessary for a client to send a separate 1385 CAPABILITY command if it recognizes these automatic capabilities. 1387 Example: C: a001 LOGIN SMITH SESAME 1388 S: a001 OK LOGIN completed 1390 Note: Use of the LOGIN command over an insecure network (such as the 1391 Internet) is a security risk, because anyone monitoring network 1392 traffic can obtain plaintext passwords. The LOGIN command SHOULD NOT 1393 be used except as a last resort, and it is recommended that client 1394 implementations have a means to disable any automatic use of the 1395 LOGIN command. 1397 Unless either the client is accessing IMAP service on IMAPS port 1398 [RFC8314], the STARTTLS command has been negotiated or some other 1399 mechanism that protects the session from password snooping has been 1400 provided, a server implementation MUST implement a configuration in 1401 which it advertises the LOGINDISABLED capability and does NOT permit 1402 the LOGIN command. Server sites SHOULD NOT use any configuration 1403 which permits the LOGIN command without such a protection mechanism 1404 against password snooping. A client implementation MUST NOT send a 1405 LOGIN command if the LOGINDISABLED capability is advertised. 1407 6.3. Client Commands - Authenticated State 1409 In the authenticated state, commands that manipulate mailboxes as 1410 atomic entities are permitted. Of these commands, the SELECT and 1411 EXAMINE commands will select a mailbox for access and enter the 1412 selected state. 1414 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1415 the following commands are valid in the authenticated state: ENABLE, 1416 SELECT, EXAMINE, NAMESPACE, CREATE, DELETE, RENAME, SUBSCRIBE, 1417 UNSUBSCRIBE, LIST, LSUB, STATUS, APPEND and IDLE. 1419 6.3.1. ENABLE Command 1421 Arguments: capability names 1423 Responses: no specific responses for this command 1425 Result: OK - Relevant capabilities enabled 1426 BAD - No arguments, or syntax error in an argument 1428 Several IMAP extensions allow the server to return unsolicited 1429 responses specific to these extensions in certain circumstances. 1430 However, servers cannot send those unsolicited responses (with the 1431 exception of response codes included in tagged or untagged OK/NO/BAD 1432 responses, which can always be sent) until they know that the clients 1433 support such extensions and thus won't choke on the extension 1434 response data. 1436 The ENABLE command provides an explicit indication from the client 1437 that it supports particular extensions. 1439 The ENABLE command takes a list of capability names, and requests the 1440 server to enable the named extensions. Once enabled using ENABLE, 1441 each extension remains active until the IMAP connection is closed. 1442 For each argument, the server does the following: 1444 o If the argument is not an extension known to the server, the 1445 server MUST ignore the argument. 1447 o If the argument is an extension known to the server, and it is not 1448 specifically permitted to be enabled using ENABLE, the server MUST 1449 ignore the argument. (Note that knowing about an extension 1450 doesn't necessarily imply supporting that extension.) 1452 o If the argument is an extension that is supported by the server 1453 and that needs to be enabled, the server MUST enable the extension 1454 for the duration of the connection. Note that once an extension 1455 is enabled, there is no way to disable it. 1457 If the ENABLE command is successful, the server MUST send an untagged 1458 ENABLED response Section 7.2.1. 1460 Clients SHOULD only include extensions that need to be enabled by the 1461 server. For example, a client can enable IMAP4rev2 specific 1462 behaviour when both IMAP4rev1 and IMAP4rev2 are advertised in the 1463 CAPABILITY response. Future RFCs may add to this list. 1465 The ENABLE command is only valid in the authenticated state, before 1466 any mailbox is selected. Clients MUST NOT issue ENABLE once they 1467 SELECT/EXAMINE a mailbox; however, server implementations don't have 1468 to check that no mailbox is selected or was previously selected 1469 during the duration of a connection. 1471 The ENABLE command can be issued multiple times in a session. It is 1472 additive; i.e., "ENABLE a b", followed by "ENABLE c" is the same as a 1473 single command "ENABLE a b c". When multiple ENABLE commands are 1474 issued, each corresponding ENABLED response SHOULD only contain 1475 extensions enabled by the corresponding ENABLE command. 1477 There are no limitations on pipelining ENABLE. For example, it is 1478 possible to send ENABLE and then immediately SELECT, or a LOGIN 1479 immediately followed by ENABLE. 1481 The server MUST NOT change the CAPABILITY list as a result of 1482 executing ENABLE; i.e., a CAPABILITY command issued right after an 1483 ENABLE command MUST list the same capabilities as a CAPABILITY 1484 command issued before the ENABLE command. This is demonstrated in 1485 the following example: 1487 C: t1 CAPABILITY 1488 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1489 S: t1 OK foo 1490 C: t2 ENABLE CONDSTORE X-GOOD-IDEA 1491 S: * ENABLED X-GOOD-IDEA 1492 S: t2 OK foo 1493 C: t3 CAPABILITY 1494 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1495 S: t3 OK foo again 1497 In the following example, the client enables CONDSTORE: 1499 C: a1 ENABLE CONDSTORE 1500 S: * ENABLED CONDSTORE 1501 S: a1 OK Conditional Store enabled 1503 6.3.1.1. Note to Designers of Extensions That May Use the ENABLE 1504 Command 1506 Designers of IMAP extensions are discouraged from creating extensions 1507 that require ENABLE unless there is no good alternative design. 1508 Specifically, extensions that cause potentially incompatible behavior 1509 changes to deployed server responses (and thus benefit from ENABLE) 1510 have a higher complexity cost than extensions that do not. 1512 6.3.2. SELECT Command 1514 Arguments: mailbox name 1516 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1517 REQUIRED OK untagged responses: PERMANENTFLAGS, 1518 UIDNEXT, UIDVALIDITY 1520 Result: OK - select completed, now in selected state 1521 NO - select failure, now in authenticated state: no 1522 such mailbox, can't access mailbox 1523 BAD - command unknown or arguments invalid 1525 The SELECT command selects a mailbox so that messages in the mailbox 1526 can be accessed. Before returning an OK to the client, the server 1527 MUST send the following untagged data to the client. Note that 1528 earlier versions of this protocol only required the FLAGS and EXISTS 1529 untagged data; consequently, client implementations SHOULD implement 1530 default behavior for missing data as discussed with the individual 1531 item. 1533 FLAGS Defined flags in the mailbox. See the description of the 1534 FLAGS response for more detail. 1536 EXISTS The number of messages in the mailbox. See the 1537 description of the EXISTS response for more detail. 1539 OK [PERMANENTFLAGS ()] A list of message flags that 1540 the client can change permanently. If this is missing, the client 1541 should assume that all flags can be changed permanently. 1543 OK [UIDNEXT ] The next unique identifier value. Refer to 1544 Section 2.3.1.1 for more information. If this is missing, the 1545 client can not make any assumptions about the next unique 1546 identifier value. 1548 OK [UIDVALIDITY ] The unique identifier validity value. Refer to 1549 Section 2.3.1.1 for more information. If this is missing, the 1550 server does not support unique identifiers. 1552 Only one mailbox can be selected at a time in a connection; 1553 simultaneous access to multiple mailboxes requires multiple 1554 connections. The SELECT command automatically deselects any 1555 currently selected mailbox before attempting the new selection. 1556 Consequently, if a mailbox is selected and a SELECT command that 1557 fails is attempted, no mailbox is selected. When deselecting a 1558 selected mailbox, the server MUST return an untagged OK response with 1559 the "[CLOSED]" response code when the currently selected mailbox is 1560 closed (see Paragraph 10). 1562 If the client is permitted to modify the mailbox, the server SHOULD 1563 prefix the text of the tagged OK response with the "[READ-WRITE]" 1564 response code. 1566 If the client is not permitted to modify the mailbox but is permitted 1567 read access, the mailbox is selected as read-only, and the server 1568 MUST prefix the text of the tagged OK response to SELECT with the 1569 "[READ-ONLY]" response code. Read-only access through SELECT differs 1570 from the EXAMINE command in that certain read-only mailboxes MAY 1571 permit the change of permanent state on a per-user (as opposed to 1572 global) basis. Netnews messages marked in a server-based .newsrc 1573 file are an example of such per-user permanent state that can be 1574 modified with read-only mailboxes. 1576 Example: C: A142 SELECT INBOX 1577 S: * 172 EXISTS 1578 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1579 S: * OK [UIDNEXT 4392] Predicted next UID 1580 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1581 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited 1582 S: A142 OK [READ-WRITE] SELECT completed 1584 6.3.3. EXAMINE Command 1586 Arguments: mailbox name 1588 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1589 REQUIRED OK untagged responses: PERMANENTFLAGS, 1590 UIDNEXT, UIDVALIDITY 1592 Result: OK - examine completed, now in selected state 1593 NO - examine failure, now in authenticated state: no 1594 such mailbox, can't access mailbox BAD - command unknown 1595 or arguments invalid 1597 The EXAMINE command is identical to SELECT and returns the same 1598 output; however, the selected mailbox is identified as read-only. No 1599 changes to the permanent state of the mailbox, including per-user 1600 state, are permitted. 1602 The text of the tagged OK response to the EXAMINE command MUST begin 1603 with the "[READ-ONLY]" response code. 1605 Example: C: A932 EXAMINE blurdybloop 1606 S: * 17 EXISTS 1607 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1608 S: * OK [UIDNEXT 4392] Predicted next UID 1609 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1610 S: * OK [PERMANENTFLAGS ()] No permanent flags permitted 1611 S: A932 OK [READ-ONLY] EXAMINE completed 1613 6.3.4. CREATE Command 1615 Arguments: mailbox name 1617 Responses: no specific responses for this command 1619 Result: OK - create completed 1620 NO - create failure: can't create mailbox with that name 1621 BAD - command unknown or arguments invalid 1623 The CREATE command creates a mailbox with the given name. An OK 1624 response is returned only if a new mailbox with that name has been 1625 created. It is an error to attempt to create INBOX or a mailbox with 1626 a name that refers to an extant mailbox. Any error in creation will 1627 return a tagged NO response. If a client attempts to create a UTF-8 1628 mailbox name that is not a valid Net-Unicode name, the server MUST 1629 reject the creation or convert the name to Net-Unicode prior to 1630 creating the mailbox. 1632 If the mailbox name is suffixed with the server's hierarchy separator 1633 character (as returned from the server by a LIST command), this is a 1634 declaration that the client intends to create mailbox names under 1635 this name in the hierarchy. Server implementations that do not 1636 require this declaration MUST ignore the declaration. In any case, 1637 the name created is without the trailing hierarchy delimiter. 1639 If the server's hierarchy separator character appears elsewhere in 1640 the name, the server SHOULD create any superior hierarchical names 1641 that are needed for the CREATE command to be successfully completed. 1642 In other words, an attempt to create "foo/bar/zap" on a server in 1643 which "/" is the hierarchy separator character SHOULD create foo/ and 1644 foo/bar/ if they do not already exist. 1646 If a new mailbox is created with the same name as a mailbox which was 1647 deleted, its unique identifiers MUST be greater than any unique 1648 identifiers used in the previous incarnation of the mailbox UNLESS 1649 the new incarnation has a different unique identifier validity value. 1650 See the description of the UID command for more detail. 1652 Example: C: A003 CREATE owatagusiam/ 1653 S: A003 OK CREATE completed 1654 C: A004 CREATE owatagusiam/blurdybloop 1655 S: A004 OK CREATE completed 1657 Note: The interpretation of this example depends on whether "/" 1658 was returned as the hierarchy separator from LIST. If "/" is the 1659 hierarchy separator, a new level of hierarchy named "owatagusiam" 1660 with a member called "blurdybloop" is created. Otherwise, two 1661 mailboxes at the same hierarchy level are created. 1663 6.3.5. DELETE Command 1665 Arguments: mailbox name 1667 Responses: no specific responses for this command 1669 Result: OK - delete completed 1670 NO - delete failure: can't delete mailbox with that name 1671 BAD - command unknown or arguments invalid 1673 The DELETE command permanently removes the mailbox with the given 1674 name. A tagged OK response is returned only if the mailbox has been 1675 deleted. It is an error to attempt to delete INBOX or a mailbox name 1676 that does not exist. 1678 The DELETE command MUST NOT remove inferior hierarchical names. For 1679 example, if a mailbox "foo" has an inferior "foo.bar" (assuming "." 1680 is the hierarchy delimiter character), removing "foo" MUST NOT remove 1681 "foo.bar". It is an error to attempt to delete a name that has 1682 inferior hierarchical names and also has the \Noselect mailbox name 1683 attribute (see the description of the LIST response for more 1684 details). 1686 It is permitted to delete a name that has inferior hierarchical names 1687 and does not have the \Noselect mailbox name attribute. If the 1688 server implementation does not permit deleting the name while 1689 inferior hierarchical names exists the \Noselect mailbox name 1690 attribute is set for that name. In any case, all messages in that 1691 mailbox are removed by the DELETE command. 1693 The value of the highest-used unique identifier of the deleted 1694 mailbox MUST be preserved so that a new mailbox created with the same 1695 name will not reuse the identifiers of the former incarnation, UNLESS 1696 the new incarnation has a different unique identifier validity value. 1697 See the description of the UID command for more detail. 1699 Examples: C: A682 LIST "" * 1700 S: * LIST () "/" blurdybloop 1701 S: * LIST (\Noselect) "/" foo 1702 S: * LIST () "/" foo/bar 1703 S: A682 OK LIST completed 1704 C: A683 DELETE blurdybloop 1705 S: A683 OK DELETE completed 1706 C: A684 DELETE foo 1707 S: A684 NO Name "foo" has inferior hierarchical names 1708 C: A685 DELETE foo/bar 1709 S: A685 OK DELETE Completed 1710 C: A686 LIST "" * 1711 S: * LIST (\Noselect) "/" foo 1712 S: A686 OK LIST completed 1713 C: A687 DELETE foo 1714 S: A687 OK DELETE Completed 1715 C: A82 LIST "" * 1716 S: * LIST () "." blurdybloop 1717 S: * LIST () "." foo 1718 S: * LIST () "." foo.bar 1719 S: A82 OK LIST completed 1720 C: A83 DELETE blurdybloop 1721 S: A83 OK DELETE completed 1722 C: A84 DELETE foo 1723 S: A84 OK DELETE Completed 1724 C: A85 LIST "" * 1725 S: * LIST () "." foo.bar 1726 S: A85 OK LIST completed 1727 C: A86 LIST "" % 1728 S: * LIST (\Noselect) "." foo 1729 S: A86 OK LIST completed 1731 6.3.6. RENAME Command 1733 Arguments: existing mailbox name 1734 new mailbox name 1736 Responses: no specific responses for this command 1738 Result: OK - rename completed 1739 NO - rename failure: can't rename mailbox with that name, 1740 can't rename to mailbox with that name 1741 BAD - command unknown or arguments invalid 1743 The RENAME command changes the name of a mailbox. A tagged OK 1744 response is returned only if the mailbox has been renamed. It is an 1745 error to attempt to rename from a mailbox name that does not exist or 1746 to a mailbox name that already exists. Any error in renaming will 1747 return a tagged NO response. 1749 If the name has inferior hierarchical names, then the inferior 1750 hierarchical names MUST also be renamed. For example, a rename of 1751 "foo" to "zap" will rename "foo/bar" (assuming "/" is the hierarchy 1752 delimiter character) to "zap/bar". 1754 If the server's hierarchy separator character appears in the name, 1755 the server SHOULD create any superior hierarchical names that are 1756 needed for the RENAME command to complete successfully. In other 1757 words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a 1758 server in which "/" is the hierarchy separator character SHOULD 1759 create baz/ and baz/rag/ if they do not already exist. 1761 The value of the highest-used unique identifier of the old mailbox 1762 name MUST be preserved so that a new mailbox created with the same 1763 name will not reuse the identifiers of the former incarnation, UNLESS 1764 the new incarnation has a different unique identifier validity value. 1765 See the description of the UID command for more detail. 1767 Renaming INBOX is permitted, and has special behavior. It moves all 1768 messages in INBOX to a new mailbox with the given name, leaving INBOX 1769 empty. If the server implementation supports inferior hierarchical 1770 names of INBOX, these are unaffected by a rename of INBOX. 1772 Examples: C: A682 LIST "" * 1773 S: * LIST () "/" blurdybloop 1774 S: * LIST (\Noselect) "/" foo 1775 S: * LIST () "/" foo/bar 1776 S: A682 OK LIST completed 1777 C: A683 RENAME blurdybloop sarasoop 1778 S: A683 OK RENAME completed 1779 C: A684 RENAME foo zowie 1780 S: A684 OK RENAME Completed 1781 C: A685 LIST "" * 1782 S: * LIST () "/" sarasoop 1783 S: * LIST (\Noselect) "/" zowie 1784 S: * LIST () "/" zowie/bar 1785 S: A685 OK LIST completed 1787 C: Z432 LIST "" * 1788 S: * LIST () "." INBOX 1789 S: * LIST () "." INBOX.bar 1790 S: Z432 OK LIST completed 1791 C: Z433 RENAME INBOX old-mail 1792 S: Z433 OK RENAME completed 1793 C: Z434 LIST "" * 1794 S: * LIST () "." INBOX 1795 S: * LIST () "." INBOX.bar 1796 S: * LIST () "." old-mail 1797 S: Z434 OK LIST completed 1799 6.3.7. SUBSCRIBE Command 1801 Arguments: mailbox 1803 Responses: no specific responses for this command 1805 Result: OK - subscribe completed 1806 NO - subscribe failure: can't subscribe to that name 1807 BAD - command unknown or arguments invalid 1809 The SUBSCRIBE command adds the specified mailbox name to the server's 1810 set of "active" or "subscribed" mailboxes as returned by the LSUB 1811 command. This command returns a tagged OK response only if the 1812 subscription is successful. 1814 A server MAY validate the mailbox argument to SUBSCRIBE to verify 1815 that it exists. However, it MUST NOT unilaterally remove an existing 1816 mailbox name from the subscription list even if a mailbox by that 1817 name no longer exists. 1819 Note: This requirement is because a server site can choose to 1820 routinely remove a mailbox with a well-known name (e.g., "system- 1821 alerts") after its contents expire, with the intention of 1822 recreating it when new contents are appropriate. 1824 Example: C: A002 SUBSCRIBE #news.comp.mail.mime 1825 S: A002 OK SUBSCRIBE completed 1827 6.3.8. UNSUBSCRIBE Command 1829 Arguments: mailbox name 1831 Responses: no specific responses for this command 1833 Result: OK - unsubscribe completed 1834 NO - unsubscribe failure: can't unsubscribe that name 1835 BAD - command unknown or arguments invalid 1837 The UNSUBSCRIBE command removes the specified mailbox name from the 1838 server's set of "active" or "subscribed" mailboxes as returned by the 1839 LSUB command. This command returns a tagged OK response only if the 1840 unsubscription is successful. 1842 Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime 1843 S: A002 OK UNSUBSCRIBE completed 1845 6.3.9. LIST Command 1847 Arguments: reference name 1848 mailbox name with possible wildcards 1850 Responses: untagged responses: LIST 1852 Result: OK - list completed 1853 NO - list failure: can't list that reference or name 1854 BAD - command unknown or arguments invalid 1856 The LIST command returns a subset of names from the complete set of 1857 all names available to the client. Zero or more untagged LIST 1858 replies are returned, containing the name attributes, hierarchy 1859 delimiter, and name; see the description of the LIST reply for more 1860 detail. 1862 The LIST command SHOULD return its data quickly, without undue delay. 1863 For example, it SHOULD NOT go to excess trouble to calculate the 1864 \Marked or \Unmarked status or perform other processing; if each name 1865 requires 1 second of processing, then a list of 1200 names would take 1866 20 minutes! 1867 An empty ("" string) reference name argument indicates that the 1868 mailbox name is interpreted as by SELECT. The returned mailbox names 1869 MUST match the supplied mailbox name pattern. A non-empty reference 1870 name argument is the name of a mailbox or a level of mailbox 1871 hierarchy, and indicates the context in which the mailbox name is 1872 interpreted. 1874 An empty ("" string) mailbox name argument is a special request to 1875 return the hierarchy delimiter and the root name of the name given in 1876 the reference. The value returned as the root MAY be the empty 1877 string if the reference is non-rooted or is an empty string. In all 1878 cases, a hierarchy delimiter (or NIL if there is no hierarchy) is 1879 returned. This permits a client to get the hierarchy delimiter (or 1880 find out that the mailbox names are flat) even when no mailboxes by 1881 that name currently exist. 1883 The reference and mailbox name arguments are interpreted into a 1884 canonical form that represents an unambiguous left-to-right 1885 hierarchy. The returned mailbox names will be in the interpreted 1886 form. 1888 Note: The interpretation of the reference argument is 1889 implementation-defined. It depends upon whether the server 1890 implementation has a concept of the "current working directory" 1891 and leading "break out characters", which override the current 1892 working directory. 1894 For example, on a server which exports a UNIX or NT filesystem, 1895 the reference argument contains the current working directory, and 1896 the mailbox name argument would contain the name as interpreted in 1897 the current working directory. 1899 If a server implementation has no concept of break out characters, 1900 the canonical form is normally the reference name appended with 1901 the mailbox name. Note that if the server implements the 1902 namespace convention (Section 5.1.2.1), "#" is a break out 1903 character and must be treated as such. 1905 If the reference argument is not a level of mailbox hierarchy 1906 (that is, it is a \NoInferiors name), and/or the reference 1907 argument does not end with the hierarchy delimiter, it is 1908 implementation-dependent how this is interpreted. For example, a 1909 reference of "foo/bar" and mailbox name of "rag/baz" could be 1910 interpreted as "foo/bar/rag/baz", "foo/barrag/baz", or "foo/rag/ 1911 baz". A client SHOULD NOT use such a reference argument except at 1912 the explicit request of the user. A hierarchical browser MUST NOT 1913 make any assumptions about server interpretation of the reference 1914 unless the reference is a level of mailbox hierarchy AND ends with 1915 the hierarchy delimiter. 1917 Any part of the reference argument that is included in the 1918 interpreted form SHOULD prefix the interpreted form. It SHOULD also 1919 be in the same form as the reference name argument. This rule 1920 permits the client to determine if the returned mailbox name is in 1921 the context of the reference argument, or if something about the 1922 mailbox argument overrode the reference argument. Without this rule, 1923 the client would have to have knowledge of the server's naming 1924 semantics including what characters are "breakouts" that override a 1925 naming context. 1927 For example, here are some examples of how references 1928 and mailbox names might be interpreted on a UNIX-based 1929 server: 1931 Reference Mailbox Name Interpretation 1932 ------------ ------------ -------------- 1933 ~smith/Mail/ foo.* ~smith/Mail/foo.* 1934 archive/ % archive/% 1935 #news. comp.mail.* #news.comp.mail.* 1936 ~smith/Mail/ /usr/doc/foo /usr/doc/foo 1937 archive/ ~fred/Mail/* ~fred/Mail/* 1939 The first three examples demonstrate interpretations in 1940 the context of the reference argument. Note that 1941 "~smith/Mail" SHOULD NOT be transformed into something 1942 like "/u2/users/smith/Mail", or it would be impossible 1943 for the client to determine that the interpretation was 1944 in the context of the reference. 1946 The character "*" is a wildcard, and matches zero or more characters 1947 at this position. The character "%" is similar to "*", but it does 1948 not match a hierarchy delimiter. If the "%" wildcard is the last 1949 character of a mailbox name argument, matching levels of hierarchy 1950 are also returned. If these levels of hierarchy are not also 1951 selectable mailboxes, they are returned with the \Noselect mailbox 1952 name attribute (see the description of the LIST response for more 1953 details). 1955 Server implementations are permitted to "hide" otherwise accessible 1956 mailboxes from the wildcard characters, by preventing certain 1957 characters or names from matching a wildcard in certain situations. 1958 For example, a UNIX-based server might restrict the interpretation of 1959 "*" so that an initial "/" character does not match. 1961 The special name INBOX is included in the output from LIST, if INBOX 1962 is supported by this server for this user and if the uppercase string 1963 "INBOX" matches the interpreted reference and mailbox name arguments 1964 with wildcards as described above. The criteria for omitting INBOX 1965 is whether SELECT INBOX will return failure; it is not relevant 1966 whether the user's real INBOX resides on this or some other server. 1968 Example: C: A101 LIST "" "" 1969 S: * LIST (\Noselect) "/" "" 1970 S: A101 OK LIST Completed 1971 C: A102 LIST #news.comp.mail.misc "" 1972 S: * LIST (\Noselect) "." #news. 1973 S: A102 OK LIST Completed 1974 C: A103 LIST /usr/staff/jones "" 1975 S: * LIST (\Noselect) "/" / 1976 S: A103 OK LIST Completed 1977 C: A202 LIST ~/Mail/ % 1978 S: * LIST (\Noselect) "/" ~/Mail/foo 1979 S: * LIST () "/" ~/Mail/meetings 1980 S: A202 OK LIST completed 1982 6.3.10. LSUB Command 1984 Arguments: reference name 1985 mailbox name with possible wildcards 1987 Responses: untagged responses: LSUB 1989 Result: OK - lsub completed 1990 NO - lsub failure: can't list that reference or name 1991 BAD - command unknown or arguments invalid 1993 The LSUB command returns a subset of names from the set of names that 1994 the user has declared as being "active" or "subscribed". Zero or 1995 more untagged LSUB replies are returned. The arguments to LSUB are 1996 in the same form as those for LIST. 1998 The returned untagged LSUB response MAY contain different mailbox 1999 flags from a LIST untagged response. If this should happen, the 2000 flags in the untagged LIST are considered more authoritative. 2002 A special situation occurs when using LSUB with the % wildcard. 2003 Consider what happens if "foo/bar" (with a hierarchy delimiter of 2004 "/") is subscribed but "foo" is not. A "%" wildcard to LSUB must 2005 return foo, not foo/bar, in the LSUB response, and it MUST be flagged 2006 with the \Noselect attribute. 2008 The server MUST NOT unilaterally remove an existing mailbox name from 2009 the subscription list even if a mailbox by that name no longer 2010 exists. 2012 Example: C: A002 LSUB "#news." "comp.mail.*" 2013 S: * LSUB () "." #news.comp.mail.mime 2014 S: * LSUB () "." #news.comp.mail.misc 2015 S: A002 OK LSUB completed 2016 C: A003 LSUB "#news." "comp.%" 2017 S: * LSUB (\NoSelect) "." #news.comp.mail 2018 S: A003 OK LSUB completed 2020 6.3.11. NAMESPACE Command 2022 Arguments: none 2024 Responses: REQUIRED untagged responses: NAMESPACE 2026 Result: OK - command completed 2027 NO - Can't complete the command 2028 BAD - arguments invalid 2030 The NAMESPACE command causes a single ungagged NAMESPACE response to 2031 be returned. The untagged NAMESPACE response contains the prefix and 2032 hierarchy delimiter to the server's Personal Namespace(s), Other 2033 Users' Namespace(s), and Shared Namespace(s) that the server wishes 2034 to expose. The response will contain a NIL for any namespace class 2035 that is not available. Namespace_Response_Extensions MAY be included 2036 in the response. Namespace_Response_Extensions which are not on the 2037 IETF standards track, MUST be prefixed with an "X-". 2039 Example 1: 2041 In this example a server supports a single personal namespace. No 2042 leading prefix is used on personal mailboxes and "/" is the hierarchy 2043 delimiter. 2045 C: A001 NAMESPACE 2046 S: * NAMESPACE (("" "/")) NIL NIL 2047 S: A001 OK NAMESPACE command completed 2049 Example 2: 2051 A user logged on anonymously to a server. No personal mailboxes are 2052 associated with the anonymous user and the user does not have access 2053 to the Other Users' Namespace. No prefix is required to access 2054 shared mailboxes and the hierarchy delimiter is "." 2055 C: A001 NAMESPACE 2056 S: * NAMESPACE NIL NIL (("" ".")) 2057 S: A001 OK NAMESPACE command completed 2059 Example 3: 2061 A server that contains a Personal Namespace and a single Shared 2062 Namespace. 2064 C: A001 NAMESPACE 2065 S: * NAMESPACE (("" "/")) NIL (("Public Folders/" "/")) 2066 S: A001 OK NAMESPACE command completed 2068 Example 4: 2070 A server that contains a Personal Namespace, Other Users' Namespace 2071 and multiple Shared Namespaces. Note that the hierarchy delimiter 2072 used within each namespace can be different. 2074 C: A001 NAMESPACE 2075 S: * NAMESPACE (("" "/")) (("~" "/")) (("#shared/" "/") 2076 ("#public/" "/")("#ftp/" "/")("#news." ".")) 2077 S: A001 OK NAMESPACE command completed 2079 The prefix string allows a client to do things such as automatically 2080 creating personal mailboxes or LISTing all available mailboxes within 2081 a namespace. 2083 Example 5: 2085 A server that supports only the Personal Namespace, with a leading 2086 prefix of INBOX to personal mailboxes and a hierarchy delimiter of 2087 "." 2089 C: A001 NAMESPACE 2090 S: * NAMESPACE (("INBOX." ".")) NIL NIL 2091 S: A001 OK NAMESPACE command completed 2093 < Automatically create a mailbox to store sent items.> 2095 C: A002 CREATE "INBOX.Sent Mail" 2096 S: A002 OK CREATE command completed 2098 Although typically a server will support only a single Personal 2099 Namespace, and a single Other User's Namespace, circumstances exist 2100 where there MAY be multiples of these, and a client MUST be prepared 2101 for them. If a client is configured such that it is required to 2102 create a certain mailbox, there can be circumstances where it is 2103 unclear which Personal Namespaces it should create the mailbox in. 2104 In these situations a client SHOULD let the user select which 2105 namespaces to create the mailbox in. 2107 Example 6: 2109 In this example, a server supports 2 Personal Namespaces. In 2110 addition to the regular Personal Namespace, the user has an 2111 additional personal namespace to allow access to mailboxes in an MH 2112 format mailstore. 2114 The client is configured to save a copy of all mail sent by the user 2115 into a mailbox called 'Sent Mail'. Furthermore, after a message is 2116 deleted from a mailbox, the client is configured to move that message 2117 to a mailbox called 'Deleted Items'. 2119 Note that this example demonstrates how some extension flags can be 2120 passed to further describe the #mh namespace. 2122 C: A001 NAMESPACE 2123 S: * NAMESPACE (("" "/")("#mh/" "/" "X-PARAM" ("FLAG1" "FLAG2"))) 2124 NIL NIL 2125 S: A001 OK NAMESPACE command completed 2127 < It is desired to keep only one copy of sent mail. It is unclear 2128 which Personal Namespace the client should use to create the 'Sent 2129 Mail' mailbox. The user is prompted to select a namespace and 2130 only one 'Sent Mail' mailbox is created. > 2132 C: A002 CREATE "Sent Mail" 2133 S: A002 OK CREATE command completed 2135 < The client is designed so that it keeps two 'Deleted Items' 2136 mailboxes, one for each namespace. > 2138 C: A003 CREATE "Delete Items" 2139 S: A003 OK CREATE command completed 2141 C: A004 CREATE "#mh/Deleted Items" 2142 S: A004 OK CREATE command completed 2144 The next level of hierarchy following the Other Users' Namespace 2145 prefix SHOULD consist of , where is a user name 2146 as per the LOGIN or AUTHENTICATE command. 2148 A client can construct a LIST command by appending a "%" to the Other 2149 Users' Namespace prefix to discover the Personal Namespaces of other 2150 users that are available to the currently authenticated user. 2152 In response to such a LIST command, a server SHOULD NOT return user 2153 names that have not granted access to their personal mailboxes to the 2154 user in question. 2156 A server MAY return a LIST response containing only the names of 2157 users that have explicitly granted access to the user in question. 2159 Alternatively, a server MAY return NO to such a LIST command, 2160 requiring that a user name be included with the Other Users' 2161 Namespace prefix before listing any other user's mailboxes. 2163 Example 7: 2165 A server that supports providing a list of other user's mailboxes 2166 that are accessible to the currently logged on user. 2168 C: A001 NAMESPACE 2169 S: * NAMESPACE (("" "/")) (("Other Users/" "/")) NIL 2170 S: A001 OK NAMESPACE command completed 2172 C: A002 LIST "" "Other Users/%" 2173 S: * LIST () "/" "Other Users/Mike" 2174 S: * LIST () "/" "Other Users/Karen" 2175 S: * LIST () "/" "Other Users/Matthew" 2176 S: * LIST () "/" "Other Users/Tesa" 2177 S: A002 OK LIST command completed 2179 Example 8: 2181 A server that does not support providing a list of other user's 2182 mailboxes that are accessible to the currently logged on user. The 2183 mailboxes are listable if the client includes the name of the other 2184 user with the Other Users' Namespace prefix. 2186 C: A001 NAMESPACE 2187 S: * NAMESPACE (("" "/")) (("#Users/" "/")) NIL 2188 S: A001 OK NAMESPACE command completed 2190 < In this example, the currently logged on user has access to the 2191 Personal Namespace of user Mike, but the server chose to suppress 2192 this information in the LIST response. However, by appending the 2193 user name Mike (received through user input) to the Other Users' 2194 Namespace prefix, the client is able to get a listing of the 2195 personal mailboxes of user Mike. > 2197 C: A002 LIST "" "#Users/%" 2198 S: A002 NO The requested item could not be found. 2200 C: A003 LIST "" "#Users/Mike/%" 2201 S: * LIST () "/" "#Users/Mike/INBOX" 2202 S: * LIST () "/" "#Users/Mike/Foo" 2203 S: A003 OK LIST command completed. 2205 A prefix string might not contain a hierarchy delimiter, because in 2206 some cases it is not needed as part of the prefix. 2208 Example 9: 2210 A server that allows access to the Other Users' Namespace by 2211 prefixing the others' mailboxes with a '~' followed by , 2212 where is a user name as per the LOGIN or AUTHENTICATE 2213 command. 2215 C: A001 NAMESPACE 2216 S: * NAMESPACE (("" "/")) (("~" "/")) NIL 2217 S: A001 OK NAMESPACE command completed 2219 < List the mailboxes for user mark > 2221 C: A002 LIST "" "~mark/%" 2222 S: * LIST () "/" "~mark/INBOX" 2223 S: * LIST () "/" "~mark/foo" 2224 S: A002 OK LIST command completed 2226 6.3.12. STATUS Command 2228 Arguments: mailbox name 2229 status data item names 2231 Responses: REQUIRED untagged responses: STATUS 2233 Result: OK - status completed 2234 NO - status failure: no status for that name 2235 BAD - command unknown or arguments invalid 2237 The STATUS command requests the status of the indicated mailbox. It 2238 does not change the currently selected mailbox, nor does it affect 2239 the state of any messages in the queried mailbox. 2241 The STATUS command provides an alternative to opening a second 2242 IMAP4rev2 connection and doing an EXAMINE command on a mailbox to 2243 query that mailbox's status without deselecting the current mailbox 2244 in the first IMAP4rev2 connection. 2246 Unlike the LIST command, the STATUS command is not guaranteed to be 2247 fast in its response. Under certain circumstances, it can be quite 2248 slow. In some implementations, the server is obliged to open the 2249 mailbox read-only internally to obtain certain status information. 2250 Also unlike the LIST command, the STATUS command does not accept 2251 wildcards. 2253 Note: The STATUS command is intended to access the status of 2254 mailboxes other than the currently selected mailbox. Because the 2255 STATUS command can cause the mailbox to be opened internally, and 2256 because this information is available by other means on the 2257 selected mailbox, the STATUS command SHOULD NOT be used on the 2258 currently selected mailbox. 2260 The STATUS command MUST NOT be used as a "check for new messages 2261 in the selected mailbox" operation (refer to sections Section 7, 2262 Section 7.3.1 for more information about the proper method for new 2263 message checking). 2265 Because the STATUS command is not guaranteed to be fast in its 2266 results, clients SHOULD NOT expect to be able to issue many 2267 consecutive STATUS commands and obtain reasonable performance. 2269 The currently defined status data items that can be requested are: 2271 MESSAGES The number of messages in the mailbox. 2273 UIDNEXT The next unique identifier value of the mailbox. Refer to 2274 Section 2.3.1.1 for more information. 2276 UIDVALIDITY The unique identifier validity value of the mailbox. 2277 Refer to Section 2.3.1.1 for more information. 2279 UNSEEN The number of messages which do not have the \Seen flag set. 2281 SIZE The total size of the mailbox in octets. This is not strictly 2282 required to be an exact value, but it MUST be equal to or greater 2283 than the sum of the values of the RFC822.SIZE FETCH message data 2284 items (see Section 6.4.6) of all messages in the mailbox. 2286 Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES) 2287 S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 2288 S: A042 OK STATUS completed 2290 6.3.13. APPEND Command 2292 Arguments: mailbox name 2293 OPTIONAL flag parenthesized list 2294 OPTIONAL date/time string 2295 message literal 2297 Responses: no specific responses for this command 2299 Result: OK - append completed 2300 NO - append error: can't append to that mailbox, error 2301 in flags or date/time or message text 2302 BAD - command unknown or arguments invalid 2304 The APPEND command appends the literal argument as a new message to 2305 the end of the specified destination mailbox. This argument SHOULD 2306 be in the format of an [RFC-5322] or [I18N-HDRS] message. 8-bit 2307 characters are permitted in the message. A server implementation 2308 that is unable to preserve 8-bit data properly MUST be able to 2309 reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB] 2310 content transfer encoding. 2312 Note: There may be exceptions, e.g., draft messages, in which 2313 required [RFC-5322] header lines are omitted in the message 2314 literal argument to APPEND. The full implications of doing so 2315 must be understood and carefully weighed. 2317 If a flag parenthesized list is specified, the flags SHOULD be set in 2318 the resulting message; otherwise, the flag list of the resulting 2319 message is set to empty by default. 2321 If a date-time is specified, the internal date SHOULD be set in the 2322 resulting message; otherwise, the internal date of the resulting 2323 message is set to the current date and time by default. 2325 If the append is unsuccessful for any reason, the mailbox MUST be 2326 restored to its state before the APPEND attempt; no partial appending 2327 is permitted. 2329 If the destination mailbox does not exist, a server MUST return an 2330 error, and MUST NOT automatically create the mailbox. Unless it is 2331 certain that the destination mailbox can not be created, the server 2332 MUST send the response code "[TRYCREATE]" as the prefix of the text 2333 of the tagged NO response. This gives a hint to the client that it 2334 can attempt a CREATE command and retry the APPEND if the CREATE is 2335 successful. 2337 On successful completion of an APPEND, the server SHOULD return an 2338 APPENDUID response code. 2340 In the case of a mailbox that has permissions set so that the client 2341 can APPEND to the mailbox, but not SELECT or EXAMINE it, the server 2342 SHOULD NOT send an APPENDUID response code as it would disclose 2343 information about the mailbox. 2345 In the case of a mailbox that has UIDNOTSTICKY status (see 2346 UIDNOTSTICKY response code definition), the server MAY omit the 2347 APPENDUID response code as it is not meaningful. 2349 If the server does not return the APPENDUID response codes, the 2350 client can discover this information by selecting the destination 2351 mailbox. The location of messages placed in the destination mailbox 2352 by APPEND can be determined by using FETCH and/or SEARCH commands 2353 (e.g., for Message-ID or some unique marker placed in the message in 2354 an APPEND). 2356 If the mailbox is currently selected, the normal new message actions 2357 SHOULD occur. Specifically, the server SHOULD notify the client 2358 immediately via an untagged EXISTS response. If the server does not 2359 do so, the client MAY issue a NOOP command (or failing that, a CHECK 2360 command) after one or more APPEND commands. 2362 Example: C: A003 APPEND saved-messages (\Seen) {310} 2363 S: + Ready for literal data 2364 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2365 C: From: Fred Foobar 2366 C: Subject: afternoon meeting 2367 C: To: mooch@owatagu.siam.edu 2368 C: Message-Id: 2369 C: MIME-Version: 1.0 2370 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2371 C: 2372 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2373 C: 2374 S: A003 OK APPEND completed 2376 Example: C: A003 APPEND saved-messages (\Seen) {297} 2377 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2378 C: From: Fred Foobar 2379 C: Subject: afternoon meeting 2380 C: To: mooch@example.com 2381 C: Message-Id: 2382 C: MIME-Version: 1.0 2383 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2384 C: 2385 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2386 C: 2387 S: A003 OK [APPENDUID 38505 3955] APPEND completed 2388 C: A004 COPY 2:4 meeting 2389 S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done 2390 C: A005 UID COPY 305:310 meeting 2391 S: A005 OK No matching messages, so nothing copied 2392 C: A006 COPY 2 funny 2393 S: A006 OK Done 2394 C: A007 SELECT funny 2395 S: * 1 EXISTS 2396 S: * OK [UIDVALIDITY 3857529045] Validity session-only 2397 S: * OK [UIDNEXT 2] Predicted next UID 2398 S: * NO [UIDNOTSTICKY] Non-persistent UIDs 2399 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 2400 S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited 2401 S: A007 OK [READ-WRITE] SELECT completed 2403 In this example, A003 and A004 demonstrate successful appending and 2404 copying to a mailbox that returns the UIDs assigned to the messages. 2405 A005 is an example in which no messages were copied; this is because 2406 in A003, we see that message 2 had UID 304, and message 3 had UID 2407 319; therefore, UIDs 305 through 310 do not exist (refer to 2408 Section 2.3.1.1 for further explanation). A006 is an example of a 2409 message being copied that did not return a COPYUID; and, as expected, 2410 A007 shows that the mail store containing that mailbox does not 2411 support persistent UIDs. 2413 Note: The APPEND command is not used for message delivery, because 2414 it does not provide a mechanism to transfer [SMTP] envelope 2415 information. 2417 6.3.14. IDLE Command 2419 Arguments: none 2421 Responses: continuation data will be requested; the client sends the 2422 continuation data "DONE" to end the command 2424 Result: OK - IDLE completed after client sent "DONE" 2425 NO - failure: the server will not allow the IDLE command 2426 at this time 2427 BAD - command unknown or arguments invalid 2429 Without the IDLE command a client requires to poll the server for 2430 changes to the selected mailbox (new mail, deletions, flag changes). 2431 It's often more desirable to have the server transmit updates to the 2432 client in real time. This allows a user to see new mail immediately. 2433 The IDLE command allows a client to tell the server that it's ready 2434 to accept such real-time updates. 2436 The IDLE command is sent from the client to the server when the 2437 client is ready to accept unsolicited mailbox update messages. The 2438 server requests a response to the IDLE command using the continuation 2439 ("+") response. The IDLE command remains active until the client 2440 responds to the continuation, and as long as an IDLE command is 2441 active, the server is now free to send untagged EXISTS, EXPUNGE, 2442 FETCH, and other responses at any time. If the server choose to send 2443 unsolicited FETCH responses, they MUST include UID FETCH item. 2445 The IDLE command is terminated by the receipt of a "DONE" 2446 continuation from the client; such response satisfies the server's 2447 continuation request. At that point, the server MAY send any 2448 remaining queued untagged responses and then MUST immediately send 2449 the tagged response to the IDLE command and prepare to process other 2450 commands. As in the base specification, the processing of any new 2451 command may cause the sending of unsolicited untagged responses, 2452 subject to the ambiguity limitations. The client MUST NOT send a 2453 command while the server is waiting for the DONE, since the server 2454 will not be able to distinguish a command from a continuation. 2456 The server MAY consider a client inactive if it has an IDLE command 2457 running, and if such a server has an inactivity timeout it MAY log 2458 the client off implicitly at the end of its timeout period. Because 2459 of that, clients using IDLE are advised to terminate the IDLE and re- 2460 issue it at least every 29 minutes to avoid being logged off. This 2461 still allows a client to receive immediate mailbox updates even 2462 though it need only "poll" at half hour intervals. 2464 Example: C: A001 SELECT INBOX 2465 S: * FLAGS (\Deleted \Seen \Flagged) 2466 S: * OK [PERMANENTFLAGS (\Deleted \Seen \Flagged)] Limited 2467 S: * 3 EXISTS 2468 S: * OK [UIDVALIDITY 1] 2469 S: A001 OK [READ-WRITE] SELECT completed 2470 C: A002 IDLE 2471 S: + idling 2472 ...time passes; new mail arrives... 2473 S: * 4 EXISTS 2474 C: DONE 2475 S: A002 OK IDLE terminated 2476 ...another client expunges message 2 now... 2477 C: A003 FETCH 4 ALL 2478 S: * 4 FETCH (...) 2479 S: A003 OK FETCH completed 2480 C: A004 IDLE 2481 S: * 2 EXPUNGE 2482 S: * 3 EXISTS 2483 S: + idling 2484 ...time passes; another client expunges message 3... 2485 S: * 3 EXPUNGE 2486 S: * 2 EXISTS 2487 ...time passes; new mail arrives... 2488 S: * 3 EXISTS 2489 C: DONE 2490 S: A004 OK IDLE terminated 2491 C: A005 FETCH 3 ALL 2492 S: * 3 FETCH (...) 2493 S: A005 OK FETCH completed 2494 C: A006 IDLE 2496 6.4. Client Commands - Selected State 2498 In the selected state, commands that manipulate messages in a mailbox 2499 are permitted. 2501 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 2502 and the authenticated state commands (SELECT, EXAMINE, NAMESPACE, 2503 CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB , STATUS, 2504 and APPEND), the following commands are valid in the selected state: 2505 CHECK, CLOSE, UNSELECT, EXPUNGE, SEARCH, FETCH, STORE, COPY, MOVE, 2506 and UID. 2508 6.4.1. CHECK Command 2510 Arguments: none 2512 Responses: no specific responses for this command 2514 Result: OK - check completed 2515 BAD - command unknown or arguments invalid 2517 The CHECK command requests a checkpoint of the currently selected 2518 mailbox. A checkpoint refers to any implementation-dependent 2519 housekeeping associated with the mailbox (e.g., resolving the 2520 server's in-memory state of the mailbox with the state on its disk) 2521 that is not normally executed as part of each command. A checkpoint 2522 MAY take a non-instantaneous amount of real time to complete. If a 2523 server implementation has no such housekeeping considerations, CHECK 2524 is equivalent to NOOP. 2526 There is no guarantee that an EXISTS untagged response will happen as 2527 a result of CHECK. NOOP, not CHECK, SHOULD be used for new message 2528 polling. 2530 Example: C: FXXZ CHECK 2531 S: FXXZ OK CHECK Completed 2533 6.4.2. CLOSE Command 2535 Arguments: none 2537 Responses: no specific responses for this command 2539 Result: OK - close completed, now in authenticated state 2540 BAD - command unknown or arguments invalid 2542 The CLOSE command permanently removes all messages that have the 2543 \Deleted flag set from the currently selected mailbox, and returns to 2544 the authenticated state from the selected state. No untagged EXPUNGE 2545 responses are sent. 2547 No messages are removed, and no error is given, if the mailbox is 2548 selected by an EXAMINE command or is otherwise selected read-only. 2550 Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command 2551 MAY be issued without previously issuing a CLOSE command. The 2552 SELECT, EXAMINE, and LOGOUT commands implicitly close the currently 2553 selected mailbox without doing an expunge. However, when many 2554 messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT sequence is 2555 considerably faster than an EXPUNGE-LOGOUT or EXPUNGE-SELECT because 2556 no untagged EXPUNGE responses (which the client would probably 2557 ignore) are sent. 2559 Example: C: A341 CLOSE 2560 S: A341 OK CLOSE completed 2562 6.4.3. UNSELECT Command 2564 Arguments: none 2566 Responses: no specific responses for this command 2568 Result: OK - unselect completed, now in authenticated state 2569 BAD - no mailbox selected, or argument supplied but none 2570 permitted 2572 The UNSELECT command frees server's resources associated with the 2573 selected mailbox and returns the server to the authenticated state. 2574 This command performs the same actions as CLOSE, except that no 2575 messages are permanently removed from the currently selected mailbox. 2577 Example: C: A342 UNSELECT 2578 S: A342 OK Unselect completed 2580 6.4.4. EXPUNGE Command 2582 Arguments: none 2584 Responses: untagged responses: EXPUNGE 2586 Result: OK - expunge completed 2587 NO - expunge failure: can't expunge (e.g., permission 2588 denied) 2589 BAD - command unknown or arguments invalid 2591 The EXPUNGE command permanently removes all messages that have the 2592 \Deleted flag set from the currently selected mailbox. Before 2593 returning an OK to the client, an untagged EXPUNGE response is sent 2594 for each message that is removed. 2596 Example: C: A202 EXPUNGE 2597 S: * 3 EXPUNGE 2598 S: * 3 EXPUNGE 2599 S: * 5 EXPUNGE 2600 S: * 8 EXPUNGE 2601 S: A202 OK EXPUNGE completed 2603 Note: In this example, messages 3, 4, 7, and 11 had the \Deleted flag 2604 set. See the description of the EXPUNGE response for further 2605 explanation. 2607 6.4.5. SEARCH Command 2609 Arguments: OPTIONAL result specifier 2610 OPTIONAL [CHARSET] specification 2611 searching criteria (one or more) 2613 Responses: REQUIRED untagged response: ESEARCH 2615 Result: OK - search completed 2616 NO - search error: can't search that [CHARSET] or 2617 criteria 2618 BAD - command unknown or arguments invalid 2620 The SEARCH command searches the mailbox for messages that match the 2621 given searching criteria. 2623 The SEARCH command may contain result options. Result options 2624 control what kind of information is returned about messages matching 2625 the search criteria in an untagged ESEARCH response. If no result 2626 option is specified or empty list of options is specified "()", ALL 2627 is assumed (see below). The order of individual options is 2628 arbitrary. Individual options may contain parameters enclosed in 2629 parentheses (*). If an option has parameters, they consist of atoms 2630 and/or strings and/or lists in a specific order. Any options not 2631 defined by extensions that the server supports must be rejected with 2632 a BAD response. 2634 (*) - if an option has a mandatory parameter, which can always be 2635 represented as a number or a sequence-set, the option parameter does 2636 not need the enclosing (). See ABNF for more details. 2638 This document specifies the following result options: 2640 MIN 2642 Return the lowest message number/UID that satisfies the SEARCH 2643 criteria. 2645 If the SEARCH results in no matches, the server MUST NOT 2646 include the MIN result option in the ESEARCH response; however, 2647 it still MUST send the ESEARCH response. 2649 MAX 2650 Return the highest message number/UID that satisfies the SEARCH 2651 criteria. 2653 If the SEARCH results in no matches, the server MUST NOT 2654 include the MAX result option in the ESEARCH response; however, 2655 it still MUST send the ESEARCH response. 2657 ALL 2659 Return all message numbers/UIDs that satisfy the SEARCH 2660 criteria using the sequence-set syntax. Note, the client MUST 2661 NOT assume that messages/UIDs will be listed in any particular 2662 order. 2664 If the SEARCH results in no matches, the server MUST NOT 2665 include the ALL result option in the ESEARCH response; however, 2666 it still MUST send the ESEARCH response. 2668 COUNT Return number of the messages that satisfy the SEARCH 2669 criteria. This result option MUST always be included in the 2670 ESEARCH response. 2672 Note: future extensions to this document can allow servers to return 2673 multiple ESEARCH responses for a single extended SEARCH command. 2674 However all options specified above MUST result in a single ESEARCH 2675 response. These extensions will have to describe how results from 2676 multiple ESEARCH responses are to be amalgamated. 2678 Searching criteria consist of one or more search keys. 2680 When multiple keys are specified, the result is the intersection (AND 2681 function) of all the messages that match those keys. For example, 2682 the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers to all 2683 deleted messages from Smith that were placed in the mailbox since 2684 February 1, 1994. A search key can also be a parenthesized list of 2685 one or more search keys (e.g., for use with the OR and NOT keys). 2687 Server implementations MAY exclude [MIME-IMB] body parts with 2688 terminal content media types other than TEXT and MESSAGE from 2689 consideration in SEARCH matching. 2691 The OPTIONAL [CHARSET] specification consists of the word "CHARSET" 2692 followed by a registered [CHARSET]. It indicates the [CHARSET] of 2693 the strings that appear in the search criteria. [MIME-IMB] content 2694 transfer encodings, and [MIME-HDRS] strings in [RFC-5322]/[MIME-IMB] 2695 headers, MUST be decoded before comparing text. US-ASCII and UTF-8 2696 charsets MUST be supported; other [CHARSET]s MAY be supported. If 2697 "CHARSET" is not provided, an IMAP4rev2 server MUST assume UTF-8. 2699 If the server does not support the specified [CHARSET], it MUST 2700 return a tagged NO response (not a BAD). This response SHOULD 2701 contain the BADCHARSET response code, which MAY list the [CHARSET]s 2702 supported by the server. 2704 In all search keys that use strings, a message matches the key if the 2705 string is a substring of the associated text. The matching SHOULD be 2706 case-insensitive for characters within ASCII range. Consider using 2707 [IMAP-I18N] for language-sensitive case-insensitive searching. Note 2708 that the empty string is a substring; this is useful when doing a 2709 HEADER search in order to test for a header field presence in the 2710 message. 2712 The defined search keys are as follows. Refer to the Formal Syntax 2713 section for the precise syntactic definitions of the arguments. 2715 Messages with message sequence numbers corresponding 2716 to the specified message sequence number set. 2718 ALL All messages in the mailbox; the default initial key for ANDing. 2720 ANSWERED Messages with the \Answered flag set. 2722 BCC Messages that contain the specified string in the 2723 envelope structure's BCC field. 2725 BEFORE Messages whose internal date (disregarding time and 2726 timezone) is earlier than the specified date. 2728 BODY Messages that contain the specified string in the body 2729 of the message. 2731 CC Messages that contain the specified string in the 2732 envelope structure's CC field. 2734 DELETED Messages with the \Deleted flag set. 2736 DRAFT Messages with the \Draft flag set. 2738 FLAGGED Messages with the \Flagged flag set. 2740 FROM Messages that contain the specified string in the 2741 envelope structure's FROM field. 2743 HEADER Messages that have a header with the 2744 specified field-name (as defined in [RFC-5322]) and that contains 2745 the specified string in the text of the header (what comes after 2746 the colon). If the string to search is zero-length, this matches 2747 all messages that have a header line with the specified field-name 2748 regardless of the contents. 2750 KEYWORD Messages with the specified keyword flag set. 2752 LARGER Messages with an [RFC-5322] size larger than the 2753 specified number of octets. 2755 NEW [[Fix this]] Messages that have the \Recent flag set but not the 2756 \Seen flag. This is functionally equivalent to "(RECENT UNSEEN)". 2758 NOT Messages that do not match the specified search 2759 key. 2761 ON Messages whose internal date (disregarding time and 2762 timezone) is within the specified date. 2764 OR Messages that match either search 2765 key. 2767 SEEN Messages that have the \Seen flag set. 2769 SENTBEFORE Messages whose [RFC-5322] Date: header 2770 (disregarding time and timezone) is earlier than the specified 2771 date. 2773 SENTON Messages whose [RFC-5322] Date: header (disregarding 2774 time and timezone) is within the specified date. 2776 SENTSINCE Messages whose [RFC-5322] Date: header 2777 (disregarding time and timezone) is within or later than the 2778 specified date. 2780 SINCE Messages whose internal date (disregarding time and 2781 timezone) is within or later than the specified date. 2783 SMALLER Messages with an [RFC-5322] size smaller than the 2784 specified number of octets. 2786 SUBJECT Messages that contain the specified string in the 2787 envelope structure's SUBJECT field. 2789 TEXT Messages that contain the specified string in the 2790 header or body of the message. 2792 TO Messages that contain the specified string in the 2793 envelope structure's TO field. 2795 UID Messages with unique identifiers corresponding to 2796 the specified unique identifier set. Sequence set ranges are 2797 permitted. 2799 UNANSWERED Messages that do not have the \Answered flag set. 2801 UNDELETED Messages that do not have the \Deleted flag set. 2803 UNDRAFT Messages that do not have the \Draft flag set. 2805 UNFLAGGED Messages that do not have the \Flagged flag set. 2807 UNKEYWORD Messages that do not have the specified keyword 2808 flag set. 2810 UNSEEN Messages that do not have the \Seen flag set. 2812 Example: C: A282 SEARCH RETURN (MIN COUNT) FLAGGED 2813 SINCE 1-Feb-1994 NOT FROM "Smith" 2814 S: * ESEARCH (TAG "A282") MIN 2 COUNT 3 2815 S: A282 OK SEARCH completed 2817 Example: C: A283 SEARCH RETURN () FLAGGED 2818 SINCE 1-Feb-1994 NOT FROM "Smith" 2819 S: * ESEARCH (TAG "A283") ALL 2,10:11 2820 S: A283 OK SEARCH completed 2822 Example: C: A284 SEARCH TEXT "string not in mailbox" 2823 S: * ESEARCH (TAG "A284") 2824 S: A284 OK SEARCH completed 2825 C: A285 SEARCH CHARSET UTF-8 TEXT {6} 2826 S: + Ready for literal text 2827 C: XXXXXX 2828 S: * ESEARCH (TAG "A285") ALL 43 2829 S: A285 OK SEARCH completed 2831 Note: Since this document is restricted to 7-bit ASCII text, it is 2832 not possible to show actual UTF-8 data. The "XXXXXX" is a 2833 placeholder for what would be 6 octets of 8-bit data in an actual 2834 transaction. 2836 The following example demonstrates finding the first unseen message 2837 in the mailbox: 2839 Example: C: A284 SEARCH RETURN (MIN) UNSEEN 2840 S: * ESEARCH (TAG "A284") MIN 4 2841 S: A284 OK SEARCH completed 2843 The following example demonstrates that if the ESEARCH UID indicator 2844 is present, all data in the ESEARCH response is referring to UIDs; 2845 for example, the MIN result specifier will be followed by a UID. 2847 Example: C: A285 UID SEARCH RETURN (MIN MAX) 1:5000 2848 S: * ESEARCH (TAG "A285") UID MIN 7 MAX 3800 2849 S: A285 OK SEARCH completed 2851 The following example demonstrates returning the number of deleted 2852 messages: 2854 Example: C: A286 SEARCH RETURN (COUNT) DELETED 2855 S: * ESEARCH (TAG "A286") COUNT 15 2856 S: A286 OK SEARCH completed 2858 6.4.6. FETCH Command 2860 Arguments: sequence set 2861 message data item names or macro 2863 Responses: untagged responses: FETCH 2865 Result: OK - fetch completed 2866 NO - fetch error: can't fetch that data 2867 BAD - command unknown or arguments invalid 2869 The FETCH command retrieves data associated with a message in the 2870 mailbox. The data items to be fetched can be either a single atom or 2871 a parenthesized list. 2873 Most data items, identified in the formal syntax under the msg-att- 2874 static rule, are static and MUST NOT change for any particular 2875 message. Other data items, identified in the formal syntax under the 2876 msg-att-dynamic rule, MAY change, either as a result of a STORE 2877 command or due to external events. 2879 For example, if a client receives an ENVELOPE for a message when 2880 it already knows the envelope, it can safely ignore the newly 2881 transmitted envelope. 2883 There are three macros which specify commonly-used sets of data 2884 items, and can be used instead of data items. A macro must be used 2885 by itself, and not in conjunction with other macros or data items. 2887 ALL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) 2889 FAST Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE) 2890 FULL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE 2891 BODY) 2893 The currently defined data items that can be fetched are: 2895 BODY Non-extensible form of BODYSTRUCTURE. 2897 BODY[
]<> 2899 The text of a particular body section. The section 2900 specification is a set of zero or more part specifiers 2901 delimited by periods. A part specifier is either a part number 2902 or one of the following: HEADER, HEADER.FIELDS, 2903 HEADER.FIELDS.NOT, MIME, and TEXT. An empty section 2904 specification refers to the entire message, including the 2905 header. 2907 Every message has at least one part number. Non-[MIME-IMB] 2908 messages, and non-multipart [MIME-IMB] messages with no 2909 encapsulated message, only have a part 1. 2911 Multipart messages are assigned consecutive part numbers, as 2912 they occur in the message. If a particular part is of type 2913 message or multipart, its parts MUST be indicated by a period 2914 followed by the part number within that nested multipart part. 2916 A part of type MESSAGE/RFC822 or MESSAGE/GLOBAL also has nested 2917 part numbers, referring to parts of the MESSAGE part's body. 2919 The HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, and TEXT part 2920 specifiers can be the sole part specifier or can be prefixed by 2921 one or more numeric part specifiers, provided that the numeric 2922 part specifier refers to a part of type MESSAGE/RFC822 or 2923 MESSAGE/GLOBAL. The MIME part specifier MUST be prefixed by 2924 one or more numeric part specifiers. 2926 The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part 2927 specifiers refer to the [RFC-5322] header of the message or of 2928 an encapsulated [MIME-IMT] MESSAGE/RFC822 or MESSAGE/GLOBAL 2929 message. HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a 2930 list of field-name (as defined in [RFC-5322]) names, and return 2931 a subset of the header. The subset returned by HEADER.FIELDS 2932 contains only those header fields with a field-name that 2933 matches one of the names in the list; similarly, the subset 2934 returned by HEADER.FIELDS.NOT contains only the header fields 2935 with a non-matching field-name. The field-matching is ASCII 2936 range case-insensitive but otherwise exact. Subsetting does 2937 not exclude the [RFC-5322] delimiting blank line between the 2938 header and the body; the blank line is included in all header 2939 fetches, except in the case of a message which has no body and 2940 no blank line. 2942 The MIME part specifier refers to the [MIME-IMB] header for 2943 this part. 2945 The TEXT part specifier refers to the text body of the message, 2946 omitting the [RFC-5322] header. 2948 Here is an example of a complex message with some of its 2949 part specifiers: 2951 HEADER ([RFC-5322] header of the message) 2952 TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2953 1 TEXT/PLAIN 2954 2 APPLICATION/OCTET-STREAM 2955 3 MESSAGE/RFC822 2956 3.HEADER ([RFC-5322] header of the message) 2957 3.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2958 3.1 TEXT/PLAIN 2959 3.2 APPLICATION/OCTET-STREAM 2960 4 MULTIPART/MIXED 2961 4.1 IMAGE/GIF 2962 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF) 2963 4.2 MESSAGE/RFC822 2964 4.2.HEADER ([RFC-5322] header of the message) 2965 4.2.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2966 4.2.1 TEXT/PLAIN 2967 4.2.2 MULTIPART/ALTERNATIVE 2968 4.2.2.1 TEXT/PLAIN 2969 4.2.2.2 TEXT/RICHTEXT 2971 It is possible to fetch a substring of the designated text. 2972 This is done by appending an open angle bracket ("<"), the 2973 octet position of the first desired octet, a period, the 2974 maximum number of octets desired, and a close angle bracket 2975 (">") to the part specifier. If the starting octet is beyond 2976 the end of the text, an empty string is returned. 2978 Any partial fetch that attempts to read beyond the end of the 2979 text is truncated as appropriate. A partial fetch that starts 2980 at octet 0 is returned as a partial fetch, even if this 2981 truncation happened. 2983 Note: This means that BODY[]<0.2048> of a 1500-octet message 2984 will return BODY[]<0> with a literal of size 1500, not 2985 BODY[]. 2987 Note: A substring fetch of a HEADER.FIELDS or 2988 HEADER.FIELDS.NOT part specifier is calculated after 2989 subsetting the header. 2991 The \Seen flag is implicitly set; if this causes the flags to 2992 change, they SHOULD be included as part of the FETCH responses. 2994 BODY.PEEK[
]<> An alternate form of BODY[
] 2995 that does not implicitly set the \Seen flag. 2997 BODYSTRUCTURE The [MIME-IMB] body structure of the message. This is 2998 computed by the server by parsing the [MIME-IMB] header fields in 2999 the [RFC-5322] header and [MIME-IMB] headers. 3001 ENVELOPE The envelope structure of the message. This is computed by 3002 the server by parsing the [RFC-5322] header into the component 3003 parts, defaulting various fields as necessary. 3005 FLAGS The flags that are set for this message. 3007 INTERNALDATE The internal date of the message. 3009 RFC822 Functionally equivalent to BODY[], differing in the syntax of 3010 the resulting untagged FETCH data (RFC822 is returned). 3012 RFC822.HEADER Functionally equivalent to BODY.PEEK[HEADER], 3013 differing in the syntax of the resulting untagged FETCH data 3014 (RFC822.HEADER is returned). 3016 RFC822.SIZE The [RFC-5322] size of the message. 3018 RFC822.TEXT Functionally equivalent to BODY[TEXT], differing in the 3019 syntax of the resulting untagged FETCH data (RFC822.TEXT is 3020 returned). 3022 UID The unique identifier for the message. 3024 Example: C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)]) 3025 S: * 2 FETCH .... 3026 S: * 3 FETCH .... 3027 S: * 4 FETCH .... 3028 S: A654 OK FETCH completed 3030 6.4.7. STORE Command 3032 Arguments: sequence set 3033 message data item name 3034 value for message data item 3036 Responses: untagged responses: FETCH 3038 Result: OK - store completed 3039 NO - store error: can't store that data 3040 BAD - command unknown or arguments invalid 3042 The STORE command alters data associated with a message in the 3043 mailbox. Normally, STORE will return the updated value of the data 3044 with an untagged FETCH response. A suffix of ".SILENT" in the data 3045 item name prevents the untagged FETCH, and the server SHOULD assume 3046 that the client has determined the updated value itself or does not 3047 care about the updated value. 3049 Note: Regardless of whether or not the ".SILENT" suffix was used, 3050 the server SHOULD send an untagged FETCH response if a change to a 3051 message's flags from an external source is observed. The intent 3052 is that the status of the flags is determinate without a race 3053 condition. 3055 The currently defined data items that can be stored are: 3057 FLAGS Replace the flags for the message with the 3058 argument. The new value of the flags is returned as if a FETCH of 3059 those flags was done. 3061 FLAGS.SILENT Equivalent to FLAGS, but without returning 3062 a new value. 3064 +FLAGS Add the argument to the flags for the message. 3065 The new value of the flags is returned as if a FETCH of those 3066 flags was done. 3068 +FLAGS.SILENT Equivalent to +FLAGS, but without 3069 returning a new value. 3071 -FLAGS Remove the argument from the flags for the 3072 message. The new value of the flags is returned as if a FETCH of 3073 those flags was done. 3075 -FLAGS.SILENT Equivalent to -FLAGS, but without 3076 returning a new value. 3078 Example: C: A003 STORE 2:4 +FLAGS (\Deleted) 3079 S: * 2 FETCH (FLAGS (\Deleted \Seen)) 3080 S: * 3 FETCH (FLAGS (\Deleted)) 3081 S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen)) 3082 S: A003 OK STORE completed 3084 6.4.8. COPY Command 3086 Arguments: sequence set 3087 mailbox name 3089 Responses: no specific responses for this command 3091 Result: OK - copy completed 3092 NO - copy error: can't copy those messages or to that 3093 name 3094 BAD - command unknown or arguments invalid 3096 The COPY command copies the specified message(s) to the end of the 3097 specified destination mailbox. The flags and internal date of the 3098 message(s) SHOULD be preserved in the copy. 3100 If the destination mailbox does not exist, a server SHOULD return an 3101 error. It SHOULD NOT automatically create the mailbox. Unless it is 3102 certain that the destination mailbox can not be created, the server 3103 MUST send the response code "[TRYCREATE]" as the prefix of the text 3104 of the tagged NO response. This gives a hint to the client that it 3105 can attempt a CREATE command and retry the COPY if the CREATE is 3106 successful. 3108 If the COPY command is unsuccessful for any reason, server 3109 implementations MUST restore the destination mailbox to its state 3110 before the COPY attempt. 3112 On successful completion of a COPY, the server SHOULD return a 3113 COPYUID response code. 3115 In the case of a mailbox that has permissions set so that the client 3116 can COPY to the mailbox, but not SELECT or EXAMINE it, the server 3117 SHOULD NOT send an COPYUID response code as it would disclose 3118 information about the mailbox. 3120 In the case of a mailbox that has UIDNOTSTICKY status (see the 3121 UIDNOTSTICKY response code), the server MAY omit the COPYUID response 3122 code as it is not meaningful. 3124 If the server does not return the COPYUID response code, the client 3125 can discover this information by selecting the destination mailbox. 3126 The location of messages placed in the destination mailbox by COPY 3127 can be determined by using FETCH and/or SEARCH commands (e.g., for 3128 Message-ID). 3130 Example: C: A003 COPY 2:4 MEETING 3131 S: A003 OK COPY completed 3133 6.4.9. MOVE Command 3135 Arguments: sequence set 3136 mailbox name 3138 Responses: no specific responses for this command 3140 Result: OK - move completed 3141 NO - move error: can't move those messages or to that 3142 name 3143 BAD - command unknown or arguments invalid 3145 The MOVE command moves the specified message(s) to the end of the 3146 specified destination mailbox. The flags and internal date of the 3147 message(s) SHOULD be preserved. 3149 This means that a new message is created in the target mailbox with a 3150 new UID, the original message is removed from the source mailbox, and 3151 it appears to the client as a single action. This has the same 3152 effect for each message as this sequence: 3154 1. [UID] COPY 3156 2. [UID] STORE +FLAGS.SILENT \DELETED 3158 3. UID EXPUNGE 3160 Although the effect of the MOVE is the same as the preceding steps, 3161 the semantics are not identical: The intermediate states produced by 3162 those steps do not occur, and the response codes are different. In 3163 particular, though the COPY and EXPUNGE response codes will be 3164 returned, response codes for a STORE MUST NOT be generated and the 3165 \Deleted flag MUST NOT be set for any message. 3167 Because a MOVE applies to a set of messages, it might fail partway 3168 through the set. Regardless of whether the command is successful in 3169 moving the entire set, each individual message SHOULD either be moved 3170 or unaffected. The server MUST leave each message in a state where 3171 it is in at least one of the source or target mailboxes (no message 3172 can be lost or orphaned). The server SHOULD NOT leave any message in 3173 both mailboxes (it would be bad for a partial failure to result in a 3174 bunch of duplicate messages). This is true even if the server 3175 returns a tagged NO response to the command. 3177 Because of the similarity of MOVE to COPY, extensions that affect 3178 COPY affect MOVE in the same way. Response codes such as TRYCREATE 3179 (see Section 7.1), as well as those defined by extensions, are sent 3180 as appropriate. 3182 Servers SHOULD send COPYUID in response to a UID MOVE (see 3183 Section 6.4.10) command. For additional information see Section 7.1. 3185 Servers are also advised to send the COPYUID response code in an 3186 untagged OK before sending EXPUNGE or moved responses. (Sending 3187 COPYUID in the tagged OK, as described in the UIDPLUS specification, 3188 means that clients first receive an EXPUNGE for a message and 3189 afterwards COPYUID for the same message. It can be unnecessarily 3190 difficult to process that sequence usefully.) 3192 An example: 3193 C: a UID MOVE 42:69 foo 3194 S: * OK [COPYUID 432432 42:69 1202:1229] 3195 S: * 22 EXPUNGE 3196 S: (more expunges) 3197 S: a OK Done 3199 Note that the server may send unrelated EXPUNGE responses as well, if 3200 any happen to have been expunged at the same time; this is normal 3201 IMAP operation. 3203 Note that moving a message to the currently selected mailbox (that 3204 is, where the source and target mailboxes are the same) is allowed 3205 when copying the message to the currently selected mailbox is 3206 allowed. 3208 The server may send EXPUNGE responses before the tagged response, so 3209 the client cannot safely send more commands with message sequence 3210 number arguments while the server is processing MOVE. 3212 MOVE and UID MOVE can be pipelined with other commands, but care has 3213 to be taken. Both commands modify sequence numbers and also allow 3214 unrelated EXPUNGE responses. The renumbering of other messages in 3215 the source mailbox following any EXPUNGE response can be surprising 3216 and makes it unsafe to pipeline any command that relies on message 3217 sequence numbers after a MOVE or UID MOVE. Similarly, MOVE cannot be 3218 pipelined with a command that might cause message renumbering. See 3219 Section 5.5, for more information about ambiguities as well as 3220 handling requirements for both clients and servers. 3222 6.4.10. UID Command 3224 Arguments: command name 3225 command arguments 3227 Responses: untagged responses: FETCH, ESEARCH 3229 Result: OK - UID command completed 3230 NO - UID command error 3231 BAD - command unknown or arguments invalid 3233 The UID command has three forms. In the first form, it takes as its 3234 arguments a COPY, MOVE, FETCH, or STORE command with arguments 3235 appropriate for the associated command. However, the numbers in the 3236 sequence set argument are unique identifiers instead of message 3237 sequence numbers. Sequence set ranges are permitted, but there is no 3238 guarantee that unique identifiers will be contiguous. 3240 A non-existent unique identifier is ignored without any error message 3241 generated. Thus, it is possible for a UID FETCH command to return an 3242 OK without any data or a UID COPY, UID MOVE or UID STORE to return an 3243 OK without performing any operations. 3245 In the second form, the UID command takes an EXPUNGE command with an 3246 extra parameter the specified a sequence set of UIDs to operate on. 3247 The UID EXPUNGE command permanently removes all messages that both 3248 have the \Deleted flag set and have a UID that is included in the 3249 specified sequence set from the currently selected mailbox. If a 3250 message either does not have the \Deleted flag set or has a UID that 3251 is not included in the specified sequence set, it is not affected. 3253 UID EXPUNGE is particularly useful for disconnected use clients. 3254 By using UID EXPUNGE instead of EXPUNGE when resynchronizing with 3255 the server, the client can ensure that it does not inadvertantly 3256 remove any messages that have been marked as \Deleted by other 3257 clients between the time that the client was last connected and 3258 the time the client resynchronizes. 3260 Example: C: A003 UID EXPUNGE 3000:3002 3261 S: * 3 EXPUNGE 3262 S: * 3 EXPUNGE 3263 S: * 3 EXPUNGE 3264 S: A003 OK UID EXPUNGE completed 3266 In the third form, the UID command takes a SEARCH command with SEARCH 3267 command arguments. The interpretation of the arguments is the same 3268 as with SEARCH; however, the numbers returned in a ESEARCH response 3269 for a UID SEARCH command are unique identifiers instead of message 3270 sequence numbers. Also, the corresponding ESEARCH response MUST 3271 include the UID indicator. For example, the command UID SEARCH 1:100 3272 UID 443:557 returns the unique identifiers corresponding to the 3273 intersection of two sequence sets, the message sequence number range 3274 1:100 and the UID range 443:557. 3276 Note: in the above example, the UID range 443:557 appears. The 3277 same comment about a non-existent unique identifier being ignored 3278 without any error message also applies here. Hence, even if 3279 neither UID 443 or 557 exist, this range is valid and would 3280 include an existing UID 495. 3282 Also note that a UID range of 559:* always includes the UID of the 3283 last message in the mailbox, even if 559 is higher than any 3284 assigned UID value. This is because the contents of a range are 3285 independent of the order of the range endpoints. Thus, any UID 3286 range with * as one of the endpoints indicates at least one 3287 message (the message with the highest numbered UID), unless the 3288 mailbox is empty. 3290 The number after the "*" in an untagged FETCH or EXPUNGE response is 3291 always a message sequence number, not a unique identifier, even for a 3292 UID command response. However, server implementations MUST 3293 implicitly include the UID message data item as part of any FETCH 3294 response caused by a UID command, regardless of whether a UID was 3295 specified as a message data item to the FETCH. 3297 Note: The rule about including the UID message data item as part of a 3298 FETCH response primarily applies to the UID FETCH and UID STORE 3299 commands, including a UID FETCH command that does not include UID as 3300 a message data item. Although it is unlikely that the other UID 3301 commands will cause an untagged FETCH, this rule applies to these 3302 commands as well. 3304 Example: C: A999 UID FETCH 4827313:4828442 FLAGS 3305 S: * 23 FETCH (FLAGS (\Seen) UID 4827313) 3306 S: * 24 FETCH (FLAGS (\Seen) UID 4827943) 3307 S: * 25 FETCH (FLAGS (\Seen) UID 4828442) 3308 S: A999 OK UID FETCH completed 3310 6.5. Client Commands - Experimental/Expansion 3312 6.5.1. X Command 3314 Arguments: implementation defined 3316 Responses: implementation defined 3318 Result: OK - command completed 3319 NO - failure 3320 BAD - command unknown or arguments invalid 3322 Any command prefixed with an X is an experimental command. Commands 3323 which are not part of this specification, a standard or standards- 3324 track revision of this specification, or an IESG-approved 3325 experimental protocol, MUST use the X prefix. 3327 Any added untagged responses issued by an experimental command MUST 3328 also be prefixed with an X. Server implementations MUST NOT send any 3329 such untagged responses, unless the client requested it by issuing 3330 the associated experimental command. 3332 Example: C: a441 CAPABILITY 3333 S: * CAPABILITY IMAP4rev2 XPIG-LATIN 3334 S: a441 OK CAPABILITY completed 3335 C: A442 XPIG-LATIN 3336 S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay 3337 S: A442 OK XPIG-LATIN ompleted-cay 3339 7. Server Responses 3341 Server responses are in three forms: status responses, server data, 3342 and command continuation request. The information contained in a 3343 server response, identified by "Contents:" in the response 3344 descriptions below, is described by function, not by syntax. The 3345 precise syntax of server responses is described in the Formal Syntax 3346 section. 3348 The client MUST be prepared to accept any response at all times. 3350 Status responses can be tagged or untagged. Tagged status responses 3351 indicate the completion result (OK, NO, or BAD status) of a client 3352 command, and have a tag matching the command. 3354 Some status responses, and all server data, are untagged. An 3355 untagged response is indicated by the token "*" instead of a tag. 3356 Untagged status responses indicate server greeting, or server status 3357 that does not indicate the completion of a command (for example, an 3358 impending system shutdown alert). For historical reasons, untagged 3359 server data responses are also called "unsolicited data", although 3360 strictly speaking, only unilateral server data is truly 3361 "unsolicited". 3363 Certain server data MUST be recorded by the client when it is 3364 received; this is noted in the description of that data. Such data 3365 conveys critical information which affects the interpretation of all 3366 subsequent commands and responses (e.g., updates reflecting the 3367 creation or destruction of messages). 3369 Other server data SHOULD be recorded for later reference; if the 3370 client does not need to record the data, or if recording the data has 3371 no obvious purpose (e.g., a SEARCH response when no SEARCH command is 3372 in progress), the data SHOULD be ignored. 3374 An example of unilateral untagged server data occurs when the IMAP 3375 connection is in the selected state. In the selected state, the 3376 server checks the mailbox for new messages as part of command 3377 execution. Normally, this is part of the execution of every command; 3378 hence, a NOOP command suffices to check for new messages. If new 3379 messages are found, the server sends untagged EXISTS response 3380 reflecting the new size of the mailbox. Server implementations that 3381 offer multiple simultaneous access to the same mailbox SHOULD also 3382 send appropriate unilateral untagged FETCH and EXPUNGE responses if 3383 another agent changes the state of any message flags or expunges any 3384 messages. 3386 Command continuation request responses use the token "+" instead of a 3387 tag. These responses are sent by the server to indicate acceptance 3388 of an incomplete client command and readiness for the remainder of 3389 the command. 3391 7.1. Server Responses - Status Responses 3393 Status responses are OK, NO, BAD, PREAUTH and BYE. OK, NO, and BAD 3394 can be tagged or untagged. PREAUTH and BYE are always untagged. 3396 Status responses MAY include an OPTIONAL "response code". A response 3397 code consists of data inside square brackets in the form of an atom, 3398 possibly followed by a space and arguments. The response code 3399 contains additional information or status codes for client software 3400 beyond the OK/NO/BAD condition, and are defined when there is a 3401 specific action that a client can take based upon the additional 3402 information. 3404 The currently defined response codes are: 3406 ALERT The human-readable text contains a special alert that MUST be 3407 presented to the user in a fashion that calls the user's attention 3408 to the message. 3410 ALREADYEXISTS 3412 The operation attempts to create something that already exists, 3413 such as when the CREATE or RENAME directories attempt to create 3414 a mailbox and there is already one of that name. 3416 C: o RENAME this that 3417 S: o NO [ALREADYEXISTS] Mailbox "that" already exists 3419 APPENDUID 3420 Followed by the UIDVALIDITY of the destination mailbox and the 3421 UID assigned to the appended message in the destination 3422 mailbox, indicates that the message has been appended to the 3423 destination mailbox with that UID. 3425 If the server also supports the [MULTIAPPEND] extension, and if 3426 multiple messages were appended in the APPEND command, then the 3427 second value is a UID set containing the UIDs assigned to the 3428 appended messages, in the order they were transmitted in the 3429 APPEND command. This UID set may not contain extraneous UIDs 3430 or the symbol "*". 3432 Note: the UID set form of the APPENDUID response code MUST 3433 NOT be used if only a single message was appended. In 3434 particular, a server MUST NOT send a range such as 123:123. 3435 This is because a client that does not support [MULTIAPPEND] 3436 expects only a single UID and not a UID set. 3438 UIDs are assigned in strictly ascending order in the mailbox 3439 (refer to Section 2.3.1.1); note that a range of 12:10 is 3440 exactly equivalent to 10:12 and refers to the sequence 3441 10,11,12. 3443 This response code is returned in a tagged OK response to the 3444 APPEND command. 3446 AUTHENTICATIONFAILED 3448 Authentication failed for some reason on which the server is 3449 unwilling to elaborate. Typically, this includes "unknown 3450 user" and "bad password". 3452 This is the same as not sending any response code, except that 3453 when a client sees AUTHENTICATIONFAILED, it knows that the 3454 problem wasn't, e.g., UNAVAILABLE, so there's no point in 3455 trying the same login/password again later. 3457 C: b LOGIN "fred" "foo" 3458 S: b NO [AUTHENTICATIONFAILED] Authentication failed 3460 AUTHORIZATIONFAILED Authentication succeeded in using the 3461 authentication identity, but the server cannot or will not allow 3462 the authentication identity to act as the requested authorization 3463 identity. This is only applicable when the authentication and 3464 authorization identities are different. C: c1 AUTHENTICATE PLAIN 3465 [...] 3466 S: c1 NO [AUTHORIZATIONFAILED] No such authorization-ID 3467 C: c2 AUTHENTICATE PLAIN 3468 [...] 3469 S: c2 NO [AUTHORIZATIONFAILED] Authenticator is not an admin 3471 BADCHARSET Optionally followed by a parenthesized list of charsets. 3472 A SEARCH failed because the given charset is not supported by this 3473 implementation. If the optional list of charsets is given, this 3474 lists the charsets that are supported by this implementation. 3476 CANNOT 3478 The operation violates some invariant of the server and can 3479 never succeed. 3481 C: l create "///////" 3482 S: l NO [CANNOT] Adjacent slashes are not supported 3484 CAPABILITY Followed by a list of capabilities. This can appear in 3485 the initial OK or PREAUTH response to transmit an initial 3486 capabilities list. This makes it unnecessary for a client to send 3487 a separate CAPABILITY command if it recognizes this response. 3489 CLIENTBUG 3491 The server has detected a client bug. This can accompany all 3492 of OK, NO, and BAD, depending on what the client bug is. 3494 C: k1 select "/archive/projects/experiment-iv" 3495 [...] 3496 S: k1 OK [READ-ONLY] Done 3497 C: k2 status "/archive/projects/experiment-iv" (messages) 3498 [...] 3499 S: k2 OK [CLIENTBUG] Done 3501 CLOSED 3503 The CLOSED response code has no parameters. A server return 3504 the CLOSED response code when the currently selected mailbox is 3505 closed implicitly using the SELECT/EXAMINE command on another 3506 mailbox. The CLOSED response code serves as a boundary between 3507 responses for the previously opened mailbox (which was closed) 3508 and the newly selected mailbox; all responses before the CLOSED 3509 response code relate to the mailbox that was closed, and all 3510 subsequent responses relate to the newly opened mailbox. 3512 There is no need to return the CLOSED response code on 3513 completion of the CLOSE or the UNSELECT command (or similar), 3514 whose purpose is to close the currently selected mailbox 3515 without opening a new one. 3517 The server can also return an unsolicited CLOSED response code 3518 when it wants to force the client to return to authenticated 3519 state. For example, the server can do that when the mailbox 3520 requires repairs or is deleted in another session. 3522 CONTACTADMIN 3524 The user should contact the system administrator or support 3525 desk. 3527 C: e login "fred" "foo" 3528 S: e OK [CONTACTADMIN] 3530 COPYUID 3532 Followed by the UIDVALIDITY of the destination mailbox, a UID 3533 set containing the UIDs of the message(s) in the source mailbox 3534 that were copied to the destination mailbox and containing the 3535 UIDs assigned to the copied message(s) in the destination 3536 mailbox, indicates that the message(s) have been copied to the 3537 destination mailbox with the stated UID(s). 3539 The source UID set is in the order the message(s) were copied; 3540 the destination UID set corresponds to the source UID set and 3541 is in the same order. Neither of the UID sets may contain 3542 extraneous UIDs or the symbol "*". 3544 UIDs are assigned in strictly ascending order in the mailbox 3545 (refer to Section 2.3.1.1); note that a range of 12:10 is 3546 exactly equivalent to 10:12 and refers to the sequence 3547 10,11,12. 3549 This response code is returned in a tagged OK response to the 3550 COPY command. 3552 CORRUPTION 3554 The server discovered that some relevant data (e.g., the 3555 mailbox) are corrupt. This response code does not include any 3556 information about what's corrupt, but the server can write that 3557 to its logfiles. 3559 C: i select "/archive/projects/experiment-iv" 3560 S: i NO [CORRUPTION] Cannot open mailbox 3562 EXPIRED 3564 Either authentication succeeded or the server no longer had the 3565 necessary data; either way, access is no longer permitted using 3566 that passphrase. The client or user should get a new 3567 passphrase. 3569 C: d login "fred" "foo" 3570 S: d NO [EXPIRED] That password isn't valid any more 3572 EXPUNGEISSUED 3574 Someone else has issued an EXPUNGE for the same mailbox. The 3575 client may want to issue NOOP soon. [IMAP-MULTIACCESS] 3576 discusses this subject in depth. 3578 C: h search from fred@example.com 3579 S: * SEARCH 1 2 3 5 8 13 21 42 3580 S: h OK [EXPUNGEISSUED] Search completed 3582 INUSE 3584 An operation has not been carried out because it involves 3585 sawing off a branch someone else is sitting on. Someone else 3586 may be holding an exclusive lock needed for this operation, or 3587 the operation may involve deleting a resource someone else is 3588 using, typically a mailbox. 3590 The operation may succeed if the client tries again later. 3592 C: g delete "/archive/projects/experiment-iv" 3593 S: g NO [INUSE] Mailbox in use 3595 LIMIT 3597 The operation ran up against an implementation limit of some 3598 kind, such as the number of flags on a single message or the 3599 number of flags used in a mailbox. 3601 C: m STORE 42 FLAGS f1 f2 f3 f4 f5 ... f250 3602 S: m NO [LIMIT] At most 32 flags in one mailbox supported 3604 NONEXISTENT 3606 The operation attempts to delete something that does not exist. 3607 Similar to ALREADYEXISTS. 3609 C: p RENAME this that 3610 S: p NO [NONEXISTENT] No such mailbox 3612 NOPERM 3614 The access control system (e.g., Access Control List (ACL), see 3615 [RFC4314] does not permit this user to carry out an operation, 3616 such as selecting or creating a mailbox. 3618 C: f select "/archive/projects/experiment-iv" 3619 S: f NO [NOPERM] Access denied 3621 OVERQUOTA 3623 The user would be over quota after the operation. (The user 3624 may or may not be over quota already.) 3626 Note that if the server sends OVERQUOTA but doesn't support the 3627 IMAP QUOTA extension defined by [RFC2087], then there is a 3628 quota, but the client cannot find out what the quota is. 3630 C: n1 uid copy 1:* oldmail 3631 S: n1 NO [OVERQUOTA] Sorry 3633 C: n2 uid copy 1:* oldmail 3634 S: n2 OK [OVERQUOTA] You are now over your soft quota 3636 PARSE The human-readable text represents an error in parsing the 3637 [RFC-5322] header or [MIME-IMB] headers of a message in the 3638 mailbox. 3640 PERMANENTFLAGS Followed by a parenthesized list of flags, indicates 3641 which of the known flags the client can change permanently. Any 3642 flags that are in the FLAGS untagged response, but not the 3643 PERMANENTFLAGS list, can not be set permanently. If the client 3644 attempts to STORE a flag that is not in the PERMANENTFLAGS list, 3645 the server will either ignore the change or store the state change 3646 for the remainder of the current session only. The PERMANENTFLAGS 3647 list can also include the special flag \*, which indicates that it 3648 is possible to create new keywords by attempting to store those 3649 flags in the mailbox. 3651 PRIVACYREQUIRED 3653 The operation is not permitted due to a lack of privacy. If 3654 Transport Layer Security (TLS) is not in use, the client could 3655 try STARTTLS (see Section 6.2.1) and then repeat the operation. 3657 C: d login "fred" "foo" 3658 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3660 C: d select inbox 3661 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3663 READ-ONLY The mailbox is selected read-only, or its access while 3664 selected has changed from read-write to read-only. 3666 READ-WRITE The mailbox is selected read-write, or its access while 3667 selected has changed from read-only to read-write. 3669 SERVERBUG 3671 The server encountered a bug in itself or violated one of its 3672 own invariants. 3674 C: j select "/archive/projects/experiment-iv" 3675 S: j NO [SERVERBUG] This should not happen 3677 TRYCREATE An APPEND or COPY attempt is failing because the target 3678 mailbox does not exist (as opposed to some other reason). This is 3679 a hint to the client that the operation can succeed if the mailbox 3680 is first created by the CREATE command. 3682 UIDNEXT Followed by a decimal number, indicates the next unique 3683 identifier value. Refer to Section 2.3.1.1 for more information. 3685 UIDNOTSTICKY 3687 The selected mailbox is supported by a mail store that does not 3688 support persistent UIDs; that is, UIDVALIDITY will be different 3689 each time the mailbox is selected. Consequently, APPEND or 3690 COPY to this mailbox will not return an APPENDUID or COPYUID 3691 response code. 3693 This response code is returned in an untagged NO response to 3694 the SELECT command. 3696 Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores. 3697 This facility exists to support legacy mail stores in which 3698 it is technically infeasible to support persistent UIDs. 3699 This should be avoided when designing new mail stores. 3701 UIDVALIDITY Followed by a decimal number, indicates the unique 3702 identifier validity value. Refer to Section 2.3.1.1 for more 3703 information. 3705 UNAVAILABLE 3707 Temporary failure because a subsystem is down. For example, an 3708 IMAP server that uses a Lightweight Directory Access Protocol 3709 (LDAP) or Radius server for authentication might use this 3710 response code when the LDAP/Radius server is down. 3712 C: a LOGIN "fred" "foo" 3713 S: a NO [UNAVAILABLE] User's backend down for maintenance 3715 Additional response codes defined by particular client or server 3716 implementations SHOULD be prefixed with an "X" until they are added 3717 to a revision of this protocol. Client implementations SHOULD ignore 3718 response codes that they do not recognize. 3720 7.1.1. OK Response 3722 Contents: OPTIONAL response code 3723 human-readable text 3725 The OK response indicates an information message from the server. 3726 When tagged, it indicates successful completion of the associated 3727 command. The human-readable text MAY be presented to the user as an 3728 information message. The untagged form indicates an information-only 3729 message; the nature of the information MAY be indicated by a response 3730 code. 3732 The untagged form is also used as one of three possible greetings at 3733 connection startup. It indicates that the connection is not yet 3734 authenticated and that a LOGIN or an AUTHENTICATE command is needed. 3736 Example: S: * OK IMAP4rev2 server ready 3737 C: A001 LOGIN fred blurdybloop 3738 S: * OK [ALERT] System shutdown in 10 minutes 3739 S: A001 OK LOGIN Completed 3741 7.1.2. NO Response 3743 Contents: OPTIONAL response code 3744 human-readable text 3746 The NO response indicates an operational error message from the 3747 server. When tagged, it indicates unsuccessful completion of the 3748 associated command. The untagged form indicates a warning; the 3749 command can still complete successfully. The human-readable text 3750 describes the condition. 3752 Example: C: A222 COPY 1:2 owatagusiam 3753 S: * NO Disk is 98% full, please delete unnecessary data 3754 S: A222 OK COPY completed 3755 C: A223 COPY 3:200 blurdybloop 3756 S: * NO Disk is 98% full, please delete unnecessary data 3757 S: * NO Disk is 99% full, please delete unnecessary data 3758 S: A223 NO COPY failed: disk is full 3760 7.1.3. BAD Response 3762 Contents: OPTIONAL response code 3763 human-readable text 3765 The BAD response indicates an error message from the server. When 3766 tagged, it reports a protocol-level error in the client's command; 3767 the tag indicates the command that caused the error. The untagged 3768 form indicates a protocol-level error for which the associated 3769 command can not be determined; it can also indicate an internal 3770 server failure. The human-readable text describes the condition. 3772 Example: C: ...very long command line... 3773 S: * BAD Command line too long 3774 C: ...empty line... 3775 S: * BAD Empty command line 3776 C: A443 EXPUNGE 3777 S: * BAD Disk crash, attempting salvage to a new disk! 3778 S: * OK Salvage successful, no data lost 3779 S: A443 OK Expunge completed 3781 7.1.4. PREAUTH Response 3783 Contents: OPTIONAL response code 3784 human-readable text 3786 The PREAUTH response is always untagged, and is one of three possible 3787 greetings at connection startup. It indicates that the connection 3788 has already been authenticated by external means; thus no LOGIN/ 3789 AUTHENTICATE command is needed. 3791 Example: S: * PREAUTH IMAP4rev2 server logged in as Smith 3793 7.1.5. BYE Response 3795 Contents: OPTIONAL response code 3796 human-readable text 3798 The BYE response is always untagged, and indicates that the server is 3799 about to close the connection. The human-readable text MAY be 3800 displayed to the user in a status report by the client. The BYE 3801 response is sent under one of four conditions: 3803 1. as part of a normal logout sequence. The server will close the 3804 connection after sending the tagged OK response to the LOGOUT 3805 command. 3807 2. as a panic shutdown announcement. The server closes the 3808 connection immediately. 3810 3. as an announcement of an inactivity autologout. The server 3811 closes the connection immediately. 3813 4. as one of three possible greetings at connection startup, 3814 indicating that the server is not willing to accept a connection 3815 from this client. The server closes the connection immediately. 3817 The difference between a BYE that occurs as part of a normal LOGOUT 3818 sequence (the first case) and a BYE that occurs because of a failure 3819 (the other three cases) is that the connection closes immediately in 3820 the failure case. In all cases the client SHOULD continue to read 3821 response data from the server until the connection is closed; this 3822 will ensure that any pending untagged or completion responses are 3823 read and processed. 3825 Example: S: * BYE Autologout; idle for too long 3827 7.2. Server Responses - Server and Mailbox Status 3829 These responses are always untagged. This is how server and mailbox 3830 status data are transmitted from the server to the client. Many of 3831 these responses typically result from a command with the same name. 3833 7.2.1. The ENABLED Response 3835 Contents: capability listing 3837 The ENABLED response occurs as a result of an ENABLE command. The 3838 capability listing contains a space-separated listing of capability 3839 names that the server supports and that were successfully enabled. 3841 The ENABLED response may contain no capabilities, which means that no 3842 extensions listed by the client were successfully enabled. 3844 7.2.2. CAPABILITY Response 3846 Contents: capability listing 3848 The CAPABILITY response occurs as a result of a CAPABILITY command. 3849 The capability listing contains a space-separated listing of 3850 capability names that the server supports. The capability listing 3851 MUST include the atom "IMAP4rev2". 3853 In addition, client and server implementations MUST implement the 3854 STARTTLS, LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) 3855 capabilities. See the Security Considerations section for important 3856 information. 3858 A capability name which begins with "AUTH=" indicates that the server 3859 supports that particular authentication mechanism. 3861 The LOGINDISABLED capability indicates that the LOGIN command is 3862 disabled, and that the server will respond with a tagged NO response 3863 to any attempt to use the LOGIN command even if the user name and 3864 password are valid. An IMAP client MUST NOT issue the LOGIN command 3865 if the server advertises the LOGINDISABLED capability. 3867 Other capability names indicate that the server supports an 3868 extension, revision, or amendment to the IMAP4rev2 protocol. Server 3869 responses MUST conform to this document until the client issues a 3870 command that uses the associated capability. 3872 Capability names MUST either begin with "X" or be standard or 3873 standards-track IMAP4rev2 extensions, revisions, or amendments 3874 registered with IANA. A server MUST NOT offer unregistered or non- 3875 standard capability names, unless such names are prefixed with an 3876 "X". 3878 Client implementations SHOULD NOT require any capability name other 3879 than "IMAP4rev2", and MUST ignore any unknown capability names. 3881 A server MAY send capabilities automatically, by using the CAPABILITY 3882 response code in the initial PREAUTH or OK responses, and by sending 3883 an updated CAPABILITY response code in the tagged OK response as part 3884 of a successful authentication. It is unnecessary for a client to 3885 send a separate CAPABILITY command if it recognizes these automatic 3886 capabilities. 3888 Example: S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI XPIG-LATIN 3890 7.2.3. LIST Response 3892 Contents: name attributes 3893 hierarchy delimiter 3894 name 3896 The LIST response occurs as a result of a LIST command. It returns a 3897 single name that matches the LIST specification. There can be 3898 multiple LIST responses for a single LIST command. 3900 The following base name attributes are defined: 3902 \Noinferiors It is not possible for any child levels of hierarchy to 3903 exist under this name; no child levels exist now and none can be 3904 created in the future. 3906 \Noselect It is not possible to use this name as a selectable 3907 mailbox. 3909 \HasChildren The presence of this attribute indicates that the 3910 mailbox has child mailboxes. A server SHOULD NOT set this 3911 attribute if there are child mailboxes and the user does not have 3912 permission to access any of them. In this case, \HasNoChildren 3913 SHOULD be used. In many cases, however, a server may not be able 3914 to efficiently compute whether a user has access to any child 3915 mailbox. Note that even though the \HasChildren attribute for a 3916 mailbox must be correct at the time of processing of the mailbox, 3917 a client must be prepared to deal with a situation when a mailbox 3918 is marked with the \HasChildren attribute, but no child mailbox 3919 appears in the response to the LIST command. This might happen, 3920 for example, due to children mailboxes being deleted or made 3921 inaccessible to the user (using access control) by another client 3922 before the server is able to list them. 3924 \HasNoChildren The presence of this attribute indicates that the 3925 mailbox has NO child mailboxes that are accessible to the 3926 currently authenticated user. 3928 \Marked The mailbox has been marked "interesting" by the server; the 3929 mailbox probably contains messages that have been added since the 3930 last time the mailbox was selected. 3932 \Unmarked The mailbox does not contain any additional messages since 3933 the last time the mailbox was selected. 3935 It is an error for the server to return both a \HasChildren and a 3936 \HasNoChildren attribute in the same LIST response. 3938 Note: the \HasNoChildren attribute should not be confused with the 3939 \NoInferiors attribute, which indicates that no child mailboxes 3940 exist now and none can be created in the future. 3942 If it is not feasible for the server to determine whether or not the 3943 mailbox is "interesting", the server SHOULD NOT send either \Marked 3944 or \Unmarked. The server MUST NOT send more than one of \Marked, 3945 \Unmarked, and \Noselect for a single mailbox, and MAY send none of 3946 these. 3948 In addition to the base name attributes defined above, an IMAP server 3949 MAY also include any or all of the following attributes that denote 3950 "role" (or "special-use") of a mailbox. These attributes are 3951 included along with base attributes defined above. A given mailbox 3952 may have none, one, or more than one of these attributes. In some 3953 cases, a special use is advice to a client about what to put in that 3954 mailbox. In other cases, it's advice to a client about what to 3955 expect to find there. 3957 \All This mailbox presents all messages in the user's message store. 3958 Implementations MAY omit some messages, such as, perhaps, those in 3959 \Trash and \Junk. When this special use is supported, it is 3960 almost certain to represent a virtual mailbox. 3962 \Archive This mailbox is used to archive messages. The meaning of 3963 an "archival" mailbox is server-dependent; typically, it will be 3964 used to get messages out of the inbox, or otherwise keep them out 3965 of the user's way, while still making them accessible. 3967 \Drafts This mailbox is used to hold draft messages -- typically, 3968 messages that are being composed but have not yet been sent. In 3969 some server implementations, this might be a virtual mailbox, 3970 containing messages from other mailboxes that are marked with the 3971 "\Draft" message flag. Alternatively, this might just be advice 3972 that a client put drafts here. 3974 \Flagged This mailbox presents all messages marked in some way as 3975 "important". When this special use is supported, it is likely to 3976 represent a virtual mailbox collecting messages (from other 3977 mailboxes) that are marked with the "\Flagged" message flag. 3979 \Junk This mailbox is where messages deemed to be junk mail are 3980 held. Some server implementations might put messages here 3981 automatically. Alternatively, this might just be advice to a 3982 client-side spam filter. 3984 \Sent This mailbox is used to hold copies of messages that have been 3985 sent. Some server implementations might put messages here 3986 automatically. Alternatively, this might just be advice that a 3987 client save sent messages here. 3989 \Trash This mailbox is used to hold messages that have been deleted 3990 or marked for deletion. In some server implementations, this 3991 might be a virtual mailbox, containing messages from other 3992 mailboxes that are marked with the "\Deleted" message flag. 3993 Alternatively, this might just be advice that a client that 3994 chooses not to use the IMAP "\Deleted" model should use this as 3995 its trash location. In server implementations that strictly 3996 expect the IMAP "\Deleted" model, this special use is likely not 3997 to be supported. 3999 All of special-use attributes are OPTIONAL, and any given server or 4000 message store may support any combination of the attributes, or none 4001 at all. In most cases, there will likely be at most one mailbox with 4002 a given attribute for a given user, but in some server or message 4003 store implementations it might be possible for multiple mailboxes to 4004 have the same special-use attribute. 4006 Special-use attributes are likely to be user-specific. User Adam 4007 might share his \Sent mailbox with user Barb, but that mailbox is 4008 unlikely to also serve as Barb's \Sent mailbox. 4010 The hierarchy delimiter is a character used to delimit levels of 4011 hierarchy in a mailbox name. A client can use it to create child 4012 mailboxes, and to search higher or lower levels of naming hierarchy. 4013 All children of a top-level hierarchy node MUST use the same 4014 separator character. A NIL hierarchy delimiter means that no 4015 hierarchy exists; the name is a "flat" name. 4017 The name represents an unambiguous left-to-right hierarchy, and MUST 4018 be valid for use as a reference in LIST and LSUB commands. Unless 4019 \Noselect is indicated, the name MUST also be valid as an argument 4020 for commands, such as SELECT, that accept mailbox names. 4022 Example: S: * LIST (\Noselect) "/" ~/Mail/foo 4024 7.2.4. LSUB Response 4026 Contents: name attributes 4027 hierarchy delimiter 4028 name 4030 The LSUB response occurs as a result of an LSUB command. It returns 4031 a single name that matches the LSUB specification. There can be 4032 multiple LSUB responses for a single LSUB command. The data is 4033 identical in format to the LIST response. 4035 Example: S: * LSUB () "." #news.comp.mail.misc 4037 7.2.5. NAMESPACE Response 4039 Contents: the prefix and hierarchy delimiter to the server's 4040 Personal Namespace(s), Other Users' Namespace(s), and 4041 Shared Namespace(s) 4043 The NAMESPACE response occurs as a result of a NAMESPACE command. It 4044 contains the prefix and hierarchy delimiter to the server's Personal 4045 Namespace(s), Other Users' Namespace(s), and Shared Namespace(s) that 4046 the server wishes to expose. The response will contain a NIL for any 4047 namespace class that is not available. Namespace_Response_Extensions 4048 MAY be included in the response. Namespace_Response_Extensions which 4049 are not on the IETF standards track, MUST be prefixed with an "X-". 4051 Example: S: * NAMESPACE (("" "/")) (("~" "/")) NIL 4053 7.2.6. STATUS Response 4055 Contents: name 4056 status parenthesized list 4058 The STATUS response occurs as a result of an STATUS command. It 4059 returns the mailbox name that matches the STATUS specification and 4060 the requested mailbox status information. 4062 Example: S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 4064 7.2.7. ESEARCH Response 4066 Contents: one or more search-return-data pairs 4068 The ESEARCH response occurs as a result of a SEARCH or UID SEARCH 4069 command. 4071 The ESEARCH response starts with an optional search correlator. If 4072 it is missing, then the response was not caused by a particular IMAP 4073 command, whereas if it is present, it contains the tag of the command 4074 that caused the response to be returned. 4076 The search correlator is followed by an optional UID indicator. If 4077 this indicator is present, all data in the ESEARCH response refers to 4078 UIDs, otherwise all returned data refers to message numbers. 4080 The rest of the ESEARCH response contains one or more search data 4081 pairs. Each pair starts with unique return item name, followed by a 4082 space and the corresponding data. Search data pairs may be returned 4083 in any order. Unless specified otherwise by an extension, any return 4084 item name SHOULD appear only once in an ESEARCH response. 4086 [[TBD: describe the most common search data pairs returned.]] 4088 Example: S: * ESEARCH UID COUNT 5 ALL 4:19,21,28 4090 Example: S: * ESEARCH (TAG "a567") UID COUNT 5 ALL 4:19,21,28 4092 Example: S: * ESEARCH COUNT 5 ALL 1:17,21 4094 7.2.8. FLAGS Response 4096 Contents: flag parenthesized list 4098 The FLAGS response occurs as a result of a SELECT or EXAMINE command. 4099 The flag parenthesized list identifies the flags (at a minimum, the 4100 system-defined flags) that are applicable for this mailbox. Flags 4101 other than the system flags can also exist, depending on server 4102 implementation. 4104 The update from the FLAGS response MUST be recorded by the client. 4106 Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4108 7.3. Server Responses - Mailbox Size 4110 These responses are always untagged. This is how changes in the size 4111 of the mailbox are transmitted from the server to the client. 4112 Immediately following the "*" token is a number that represents a 4113 message count. 4115 7.3.1. EXISTS Response 4117 Contents: none 4119 The EXISTS response reports the number of messages in the mailbox. 4120 This response occurs as a result of a SELECT or EXAMINE command, and 4121 if the size of the mailbox changes (e.g., new messages). 4123 The update from the EXISTS response MUST be recorded by the client. 4125 Example: S: * 23 EXISTS 4127 7.4. Server Responses - Message Status 4129 These responses are always untagged. This is how message data are 4130 transmitted from the server to the client, often as a result of a 4131 command with the same name. Immediately following the "*" token is a 4132 number that represents a message sequence number. 4134 7.4.1. EXPUNGE Response 4136 Contents: none 4138 The EXPUNGE response reports that the specified message sequence 4139 number has been permanently removed from the mailbox. The message 4140 sequence number for each successive message in the mailbox is 4141 immediately decremented by 1, and this decrement is reflected in 4142 message sequence numbers in subsequent responses (including other 4143 untagged EXPUNGE responses). 4145 The EXPUNGE response also decrements the number of messages in the 4146 mailbox; it is not necessary to send an EXISTS response with the new 4147 value. 4149 As a result of the immediate decrement rule, message sequence numbers 4150 that appear in a set of successive EXPUNGE responses depend upon 4151 whether the messages are removed starting from lower numbers to 4152 higher numbers, or from higher numbers to lower numbers. For 4153 example, if the last 5 messages in a 9-message mailbox are expunged, 4154 a "lower to higher" server will send five untagged EXPUNGE responses 4155 for message sequence number 5, whereas a "higher to lower server" 4156 will send successive untagged EXPUNGE responses for message sequence 4157 numbers 9, 8, 7, 6, and 5. 4159 An EXPUNGE response MUST NOT be sent when no command is in progress, 4160 nor while responding to a FETCH, STORE, or SEARCH command. This rule 4161 is necessary to prevent a loss of synchronization of message sequence 4162 numbers between client and server. A command is not "in progress" 4163 until the complete command has been received; in particular, a 4164 command is not "in progress" during the negotiation of command 4165 continuation. 4167 Note: UID FETCH, UID STORE, and UID SEARCH are different commands 4168 from FETCH, STORE, and SEARCH. An EXPUNGE response MAY be sent 4169 during a UID command. 4171 The update from the EXPUNGE response MUST be recorded by the client. 4173 Example: S: * 44 EXPUNGE 4175 7.4.2. FETCH Response 4177 Contents: message data 4179 The FETCH response returns data about a message to the client. The 4180 data are pairs of data item names and their values in parentheses. 4181 This response occurs as the result of a FETCH or STORE command, as 4182 well as by unilateral server decision (e.g., flag updates). 4184 The current data items are: 4186 BODY A form of BODYSTRUCTURE without extension data. 4188 BODY[
]<> 4190 A string expressing the body contents of the specified section. 4191 The string SHOULD be interpreted by the client according to the 4192 content transfer encoding, body type, and subtype. 4194 If the origin octet is specified, this string is a substring of 4195 the entire body contents, starting at that origin octet. This 4196 means that BODY[]<0> MAY be truncated, but BODY[] is NEVER 4197 truncated. 4199 Note: The origin octet facility MUST NOT be used by a server 4200 in a FETCH response unless the client specifically requested 4201 it by means of a FETCH of a BODY[
]<> data 4202 item. 4204 8-bit textual data is permitted if a [CHARSET] identifier is 4205 part of the body parameter parenthesized list for this section. 4206 Note that headers (part specifiers HEADER or MIME, or the 4207 header portion of a MESSAGE/RFC822 or MESSAGE/GLOBAL part), MAY 4208 be in UTF-8. Note also that the [RFC-5322] delimiting blank 4209 line between the header and the body is not affected by header 4210 line subsetting; the blank line is always included as part of 4211 header data, except in the case of a message which has no body 4212 and no blank line. 4214 Non-textual data such as binary data MUST be transfer encoded 4215 into a textual form, such as BASE64, prior to being sent to the 4216 client. To derive the original binary data, the client MUST 4217 decode the transfer encoded string. 4219 BODYSTRUCTURE 4221 A parenthesized list that describes the [MIME-IMB] body 4222 structure of a message. This is computed by the server by 4223 parsing the [MIME-IMB] header fields, defaulting various fields 4224 as necessary. 4226 For example, a simple text message of 48 lines and 2279 octets 4227 can have a body structure of: ("TEXT" "PLAIN" ("CHARSET" "US- 4228 ASCII") NIL NIL "7BIT" 2279 48) 4230 Multiple parts are indicated by parenthesis nesting. Instead 4231 of a body type as the first element of the parenthesized list, 4232 there is a sequence of one or more nested body structures. The 4233 second element of the parenthesized list is the multipart 4234 subtype (mixed, digest, parallel, alternative, etc.). 4236 For example, a two part message consisting of a text and a 4237 BASE64-encoded text attachment can have a body structure of: 4238 (("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1152 4239 23)("TEXT" "PLAIN" ("CHARSET" "US-ASCII" "NAME" "cc.diff") 4240 "<960723163407.20117h@cac.washington.edu>" "Compiler diff" 4241 "BASE64" 4554 73) "MIXED") 4243 Extension data follows the multipart subtype. Extension data 4244 is never returned with the BODY fetch, but can be returned with 4245 a BODYSTRUCTURE fetch. Extension data, if present, MUST be in 4246 the defined order. The extension data of a multipart body part 4247 are in the following order: 4249 body parameter parenthesized list A parenthesized list of 4250 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4251 "bar" is the value of "foo", and "rag" is the value of 4252 "baz"] as defined in [MIME-IMB]. 4254 body disposition A parenthesized list, consisting of a 4255 disposition type string, followed by a parenthesized list of 4256 disposition attribute/value pairs as defined in 4257 [DISPOSITION]. 4259 body language A string or parenthesized list giving the body 4260 language value as defined in [LANGUAGE-TAGS]. 4262 body location A string giving the body content URI as defined 4263 in [LOCATION]. 4265 Any following extension data are not yet defined in this 4266 version of the protocol. Such extension data can consist of 4267 zero or more NILs, strings, numbers, or potentially nested 4268 parenthesized lists of such data. Client implementations that 4269 do a BODYSTRUCTURE fetch MUST be prepared to accept such 4270 extension data. Server implementations MUST NOT send such 4271 extension data until it has been defined by a revision of this 4272 protocol. 4274 The basic fields of a non-multipart body part are in the 4275 following order: 4277 body type A string giving the content media type name as 4278 defined in [MIME-IMB]. 4280 body subtype A string giving the content subtype name as 4281 defined in [MIME-IMB]. 4283 body parameter parenthesized list A parenthesized list of 4284 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4285 "bar" is the value of "foo" and "rag" is the value of "baz"] 4286 as defined in [MIME-IMB]. 4288 body id A string giving the content id as defined in 4289 [MIME-IMB]. 4291 body description A string giving the content description as 4292 defined in [MIME-IMB]. 4294 body encoding A string giving the content transfer encoding as 4295 defined in [MIME-IMB]. 4297 body size A number giving the size of the body in octets. 4298 Note that this size is the size in its transfer encoding and 4299 not the resulting size after any decoding. 4301 A body type of type MESSAGE and subtype RFC822 contains, 4302 immediately after the basic fields, the envelope structure, 4303 body structure, and size in text lines of the encapsulated 4304 message. 4306 A body type of type TEXT contains, immediately after the basic 4307 fields, the size of the body in text lines. Note that this 4308 size is the size in its content transfer encoding and not the 4309 resulting size after any decoding. 4311 Extension data follows the basic fields and the type-specific 4312 fields listed above. Extension data is never returned with the 4313 BODY fetch, but can be returned with a BODYSTRUCTURE fetch. 4314 Extension data, if present, MUST be in the defined order. 4316 The extension data of a non-multipart body part are in the 4317 following order: 4319 body MD5 A string giving the body MD5 value as defined in 4320 [MD5]. 4322 body disposition A parenthesized list with the same content 4323 and function as the body disposition for a multipart body 4324 part. 4326 body language A string or parenthesized list giving the body 4327 language value as defined in [LANGUAGE-TAGS]. 4329 body location A string giving the body content URI as defined 4330 in [LOCATION]. 4332 Any following extension data are not yet defined in this 4333 version of the protocol, and would be as described above under 4334 multipart extension data. 4336 ENVELOPE 4338 A parenthesized list that describes the envelope structure of a 4339 message. This is computed by the server by parsing the 4340 [RFC-5322] header into the component parts, defaulting various 4341 fields as necessary. 4343 The fields of the envelope structure are in the following 4344 order: date, subject, from, sender, reply-to, to, cc, bcc, in- 4345 reply-to, and message-id. The date, subject, in-reply-to, and 4346 message-id fields are strings. The from, sender, reply-to, to, 4347 cc, and bcc fields are parenthesized lists of address 4348 structures. 4350 An address structure is a parenthesized list that describes an 4351 electronic mail address. The fields of an address structure 4352 are in the following order: personal name, [SMTP] at-domain- 4353 list (source route), mailbox name, and host name. 4355 [RFC-5322] group syntax is indicated by a special form of 4356 address structure in which the host name field is NIL. If the 4357 mailbox name field is also NIL, this is an end of group marker 4358 (semi-colon in RFC 822 syntax). If the mailbox name field is 4359 non-NIL, this is a start of group marker, and the mailbox name 4360 field holds the group name phrase. 4362 If the Date, Subject, In-Reply-To, and Message-ID header lines 4363 are absent in the [RFC-5322] header, the corresponding member 4364 of the envelope is NIL; if these header lines are present but 4365 empty the corresponding member of the envelope is the empty 4366 string. 4368 Note: some servers may return a NIL envelope member in the 4369 "present but empty" case. Clients SHOULD treat NIL and 4370 empty string as identical. 4372 Note: [RFC-5322] requires that all messages have a valid 4373 Date header. Therefore, the date member in the envelope can 4374 not be NIL or the empty string. 4376 Note: [RFC-5322] requires that the In-Reply-To and Message- 4377 ID headers, if present, have non-empty content. Therefore, 4378 the in-reply-to and message-id members in the envelope can 4379 not be the empty string. 4381 If the From, To, Cc, and Bcc header lines are absent in the 4382 [RFC-5322] header, or are present but empty, the corresponding 4383 member of the envelope is NIL. 4385 If the Sender or Reply-To lines are absent in the [RFC-5322] 4386 header, or are present but empty, the server sets the 4387 corresponding member of the envelope to be the same value as 4388 the from member (the client is not expected to know to do 4389 this). 4391 Note: [RFC-5322] requires that all messages have a valid 4392 From header. Therefore, the from, sender, and reply-to 4393 members in the envelope can not be NIL. 4395 FLAGS A parenthesized list of flags that are set for this message. 4397 INTERNALDATE A string representing the internal date of the message. 4399 RFC822 Equivalent to BODY[]. 4401 RFC822.HEADER Equivalent to BODY[HEADER]. Note that this did not 4402 result in \Seen being set, because RFC822.HEADER response data 4403 occurs as a result of a FETCH of RFC822.HEADER. BODY[HEADER] 4404 response data occurs as a result of a FETCH of BODY[HEADER] (which 4405 sets \Seen) or BODY.PEEK[HEADER] (which does not set \Seen). 4407 RFC822.SIZE A number expressing the [RFC-5322] size of the message. 4409 RFC822.TEXT Equivalent to BODY[TEXT]. 4411 UID A number expressing the unique identifier of the message. 4413 Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827) 4415 7.5. Server Responses - Command Continuation Request 4417 The command continuation request response is indicated by a "+" token 4418 instead of a tag. This form of response indicates that the server is 4419 ready to accept the continuation of a command from the client. The 4420 remainder of this response is a line of text. 4422 This response is used in the AUTHENTICATE command to transmit server 4423 data to the client, and request additional client data. This 4424 response is also used if an argument to any command is a 4425 synchronizing literal. 4427 The client is not permitted to send the octets of the synchronizing 4428 literal unless the server indicates that it is expected. This 4429 permits the server to process commands and reject errors on a line- 4430 by-line basis. The remainder of the command, including the CRLF that 4431 terminates a command, follows the octets of the literal. If there 4432 are any additional command arguments, the literal octets are followed 4433 by a space and those arguments. 4435 Example: C: A001 LOGIN {11} 4436 S: + Ready for additional command text 4437 C: FRED FOOBAR {7} 4438 S: + Ready for additional command text 4439 C: fat man 4440 S: A001 OK LOGIN completed 4441 C: A044 BLURDYBLOOP {102856} 4442 S: A044 BAD No such command as "BLURDYBLOOP" 4444 8. Sample IMAP4rev2 connection 4446 The following is a transcript of an IMAP4rev2 connection. A long 4447 line in this sample is broken for editorial clarity. 4449 S: * OK IMAP4rev2 Service Ready 4450 C: a001 login mrc secret 4451 S: a001 OK LOGIN completed 4452 C: a002 select inbox 4453 S: * 18 EXISTS 4454 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4455 S: * OK [UIDVALIDITY 3857529045] UIDs valid 4456 S: a002 OK [READ-WRITE] SELECT completed 4457 C: a003 fetch 12 full 4458 S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" 4459 RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" 4460 "IMAP4rev2 WG mtg summary and minutes" 4461 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4462 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4463 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4464 ((NIL NIL "imap" "cac.washington.edu")) 4465 ((NIL NIL "minutes" "CNRI.Reston.VA.US") 4466 ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL 4467 "") 4468 BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 4469 92)) 4470 S: a003 OK FETCH completed 4471 C: a004 fetch 12 body[header] 4472 S: * 12 FETCH (BODY[HEADER] {342} 4473 S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT) 4474 S: From: Terry Gray 4475 S: Subject: IMAP4rev2 WG mtg summary and minutes 4476 S: To: imap@cac.washington.edu 4477 S: cc: minutes@CNRI.Reston.VA.US, John Klensin 4478 S: Message-Id: 4479 S: MIME-Version: 1.0 4480 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 4481 S: 4482 S: ) 4483 S: a004 OK FETCH completed 4484 C: a005 store 12 +flags \deleted 4485 S: * 12 FETCH (FLAGS (\Seen \Deleted)) 4486 S: a005 OK +FLAGS completed 4487 C: a006 logout 4488 S: * BYE IMAP4rev2 server terminating connection 4489 S: a006 OK LOGOUT completed 4491 9. Formal Syntax 4493 The following syntax specification uses the Augmented Backus-Naur 4494 Form (ABNF) notation as specified in [ABNF]. 4496 In the case of alternative or optional rules in which a later rule 4497 overlaps an earlier rule, the rule which is listed earlier MUST take 4498 priority. For example, "\Seen" when parsed as a flag is the \Seen 4499 flag name and not a flag-extension, even though "\Seen" can be parsed 4500 as a flag-extension. Some, but not all, instances of this rule are 4501 noted below. 4503 Note: [ABNF] rules MUST be followed strictly; in particular: 4505 (1) Except as noted otherwise, all alphabetic characters are case- 4506 insensitive. The use of upper or lower case characters to define 4507 token strings is for editorial clarity only. Implementations MUST 4508 accept these strings in a case-insensitive fashion. 4510 (2) In all cases, SP refers to exactly one space. It is NOT 4511 permitted to substitute TAB, insert additional spaces, or 4512 otherwise treat SP as being equivalent to LWSP. 4514 (3) The ASCII NUL character, %x00, MUST NOT be used at any time. 4516 address = "(" addr-name SP addr-adl SP addr-mailbox SP 4517 addr-host ")" 4519 addr-adl = nstring 4520 ; Holds route from [RFC-5322] route-addr if 4521 ; non-NIL 4523 addr-host = nstring 4524 ; NIL indicates [RFC-5322] group syntax. 4525 ; Otherwise, holds [RFC-5322] domain name 4527 addr-mailbox = nstring 4528 ; NIL indicates end of [RFC-5322] group; if 4529 ; non-NIL and addr-host is NIL, holds 4530 ; [RFC-5322] group name. 4531 ; Otherwise, holds [RFC-5322] local-part 4532 ; after removing [RFC-5322] quoting 4534 addr-name = nstring 4535 ; If non-NIL, holds phrase from [RFC-5322] 4536 ; mailbox after removing [RFC-5322] quoting 4538 append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP 4539 literal 4541 append-uid = uniqueid 4543 astring = 1*ASTRING-CHAR / string 4544 ASTRING-CHAR = ATOM-CHAR / resp-specials 4546 atom = 1*ATOM-CHAR 4548 ATOM-CHAR = 4550 atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / 4551 quoted-specials / resp-specials 4553 authenticate = "AUTHENTICATE" SP auth-type [SP initial-resp] 4554 *(CRLF base64) 4556 auth-type = atom 4557 ; Defined by [SASL] 4559 base64 = *(4base64-char) [base64-terminal] 4561 base64-char = ALPHA / DIGIT / "+" / "/" 4562 ; Case-sensitive 4564 base64-terminal = (2base64-char "==") / (3base64-char "=") 4566 body = "(" (body-type-1part / body-type-mpart) ")" 4568 body-extension = nstring / number / 4569 "(" body-extension *(SP body-extension) ")" 4570 ; Future expansion. Client implementations 4571 ; MUST accept body-extension fields. Server 4572 ; implementations MUST NOT generate 4573 ; body-extension fields except as defined by 4574 ; future standard or standards-track 4575 ; revisions of this specification. 4577 body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang 4578 [SP body-fld-loc *(SP body-extension)]]] 4579 ; MUST NOT be returned on non-extensible 4580 ; "BODY" fetch 4582 body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang 4583 [SP body-fld-loc *(SP body-extension)]]] 4584 ; MUST NOT be returned on non-extensible 4585 ; "BODY" fetch 4587 body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP 4588 body-fld-enc SP body-fld-octets 4590 body-fld-desc = nstring 4591 body-fld-dsp = "(" string SP body-fld-param ")" / nil 4593 body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ 4594 "QUOTED-PRINTABLE") DQUOTE) / string 4596 body-fld-id = nstring 4598 body-fld-lang = nstring / "(" string *(SP string) ")" 4600 body-fld-loc = nstring 4602 body-fld-lines = number 4604 body-fld-md5 = nstring 4606 body-fld-octets = number 4608 body-fld-param = "(" string SP string *(SP string SP string) ")" / nil 4610 body-type-1part = (body-type-basic / body-type-msg / body-type-text) 4611 [SP body-ext-1part] 4613 body-type-basic = media-basic SP body-fields 4614 ; MESSAGE subtype MUST NOT be "RFC822" or "GLOBAL" 4616 body-type-mpart = 1*body SP media-subtype 4617 [SP body-ext-mpart] 4618 ; MULTIPART body part 4620 body-type-msg = media-message SP body-fields SP envelope 4621 SP body SP body-fld-lines 4623 body-type-text = media-text SP body-fields SP body-fld-lines 4625 capability = ("AUTH=" auth-type) / atom 4626 ; New capabilities MUST begin with "X" or be 4627 ; registered with IANA as standard or 4628 ; standards-track 4630 capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev2" 4631 *(SP capability) 4632 ; Servers MUST implement the STARTTLS, AUTH=PLAIN, 4633 ; and LOGINDISABLED capabilities 4634 ; Servers which offer RFC 1730 compatibility MUST 4635 ; list "IMAP4" as the first capability. 4637 CHAR8 = %x01-ff 4638 ; any OCTET except NUL, %x00 4640 charset = atom / quoted 4642 command = tag SP (command-any / command-auth / command-nonauth / 4643 command-select) CRLF 4644 ; Modal based on state 4646 command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / enable / x-command 4647 ; Valid in all states 4649 command-auth = append / create / delete / examine / list / lsub / 4650 Namespace-Command / 4651 rename / select / status / subscribe / unsubscribe / 4652 idle 4653 ; Valid only in Authenticated or Selected state 4655 command-nonauth = login / authenticate / "STARTTLS" 4656 ; Valid only when in Not Authenticated state 4658 command-select = "CHECK" / "CLOSE" / "UNSELECT" / "EXPUNGE" / copy / 4659 move / fetch / store / search / uid 4660 ; Valid only when in Selected state 4662 continue-req = "+" SP (resp-text / base64) CRLF 4664 copy = "COPY" SP sequence-set SP mailbox 4666 create = "CREATE" SP mailbox 4667 ; Use of INBOX gives a NO error 4669 date = date-text / DQUOTE date-text DQUOTE 4671 date-day = 1*2DIGIT 4672 ; Day of month 4674 date-day-fixed = (SP DIGIT) / 2DIGIT 4675 ; Fixed-format version of date-day 4677 date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / 4678 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" 4680 date-text = date-day "-" date-month "-" date-year 4682 date-year = 4DIGIT 4684 date-time = DQUOTE date-day-fixed "-" date-month "-" date-year 4685 SP time SP zone DQUOTE 4687 delete = "DELETE" SP mailbox 4688 ; Use of INBOX gives a NO error 4690 digit-nz = %x31-39 4691 ; 1-9 4693 enable = "ENABLE" 1*(SP capability) 4695 enable-data = "ENABLED" *(SP capability) 4697 envelope = "(" env-date SP env-subject SP env-from SP 4698 env-sender SP env-reply-to SP env-to SP env-cc SP 4699 env-bcc SP env-in-reply-to SP env-message-id ")" 4701 env-bcc = "(" 1*address ")" / nil 4703 env-cc = "(" 1*address ")" / nil 4705 env-date = nstring 4707 env-from = "(" 1*address ")" / nil 4709 env-in-reply-to = nstring 4711 env-message-id = nstring 4713 env-reply-to = "(" 1*address ")" / nil 4715 env-sender = "(" 1*address ")" / nil 4717 env-subject = nstring 4719 env-to = "(" 1*address ")" / nil 4721 esearch-response = "ESEARCH" [search-correlator] [SP "UID"] 4722 *(SP search-return-data) 4723 ; ESEARCH response replaces SEARCH response 4724 ; from IMAP4rev1. 4726 examine = "EXAMINE" SP mailbox 4728 fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" / 4729 fetch-att / "(" fetch-att *(SP fetch-att) ")") 4731 fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" / 4732 "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] / 4733 "BODY" ["STRUCTURE"] / "UID" / 4734 "BODY" section [partial] / 4735 "BODY.PEEK" section [partial] 4737 flag = "\Answered" / "\Flagged" / "\Deleted" / 4738 "\Seen" / "\Draft" / flag-keyword / flag-extension 4739 ; Does not include "\Recent" 4741 flag-extension = "\" atom 4742 ; Future expansion. Client implementations 4743 ; MUST accept flag-extension flags. Server 4744 ; implementations MUST NOT generate 4745 ; flag-extension flags except as defined by 4746 ; future standard or standards-track 4747 ; revisions of this specification. 4748 ; "\Recent" was defined in RFC 3501 4749 ; and is now deprecated. 4751 flag-fetch = flag 4753 flag-keyword = "$MDNSent" / "$Forwarded" / atom 4755 flag-list = "(" [flag *(SP flag)] ")" 4757 flag-perm = flag / "\*" 4759 greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF 4761 header-fld-name = astring 4763 header-list = "(" header-fld-name *(SP header-fld-name) ")" 4765 idle = "IDLE" CRLF "DONE" 4767 initial-resp = (base64 / "=") 4768 ; "initial response" defined in 4769 ; Section 5.1 of [RFC4422] 4771 list = "LIST" SP mailbox SP list-mailbox 4773 list-mailbox = 1*list-char / string 4775 list-char = ATOM-CHAR / list-wildcards / resp-specials 4777 list-wildcards = "%" / "*" 4779 literal = "{" number ["+"] "}" CRLF *CHAR8 4780 ; Number represents the number of CHAR8s. 4781 ; A non-synchronizing literal is distinguished from 4782 ; a synchronizing literal by presence of the "+" 4783 ; before the closing "}". 4784 ; Non synchronizing literals are not allowed when 4785 ; sent from server to the client. 4787 login = "LOGIN" SP userid SP password 4789 lsub = "LSUB" SP mailbox SP list-mailbox 4791 mailbox = "INBOX" / astring 4792 ; INBOX is case-insensitive. All case variants of 4793 ; INBOX (e.g., "iNbOx") MUST be interpreted as INBOX 4794 ; not as an astring. An astring which consists of 4795 ; the case-insensitive sequence "I" "N" "B" "O" "X" 4796 ; is considered to be INBOX and not an astring. 4797 ; Refer to section 5.1 for further 4798 ; semantic details of mailbox names. 4800 mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list / 4801 "LSUB" SP mailbox-list / esearch-response / 4802 "STATUS" SP mailbox SP "(" [status-att-list] ")" / 4803 number SP "EXISTS" / Namespace-Response 4805 mailbox-list = "(" [mbx-list-flags] ")" SP 4806 (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox 4808 mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag 4809 *(SP mbx-list-oflag) / 4810 mbx-list-oflag *(SP mbx-list-oflag) 4812 mbx-list-oflag = "\Noinferiors" / flag-extension 4813 ; Other flags; multiple possible per LIST response 4815 mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked" 4816 ; Selectability flags; only one per LIST response 4818 media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / 4819 "MESSAGE" / "VIDEO" / "FONT") DQUOTE) / string) SP 4820 media-subtype 4821 ; Defined in [MIME-IMT]. 4822 ; FONT defined in RFC YYYY. 4824 media-message = DQUOTE "MESSAGE" DQUOTE SP 4825 DQUOTE ("RFC822" / "GLOBAL") DQUOTE 4826 ; Defined in [MIME-IMT] 4828 media-subtype = string 4829 ; Defined in [MIME-IMT] 4831 media-text = DQUOTE "TEXT" DQUOTE SP media-subtype 4832 ; Defined in [MIME-IMT] 4834 message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) 4836 move = "MOVE" SP sequence-set SP mailbox 4838 msg-att = "(" (msg-att-dynamic / msg-att-static) 4839 *(SP (msg-att-dynamic / msg-att-static)) ")" 4841 msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")" 4842 ; MAY change for a message 4844 msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time / 4845 "RFC822" [".HEADER" / ".TEXT"] SP nstring / 4846 "RFC822.SIZE" SP number / 4847 "BODY" ["STRUCTURE"] SP body / 4848 "BODY" section ["<" number ">"] SP nstring / 4849 "UID" SP uniqueid 4850 ; MUST NOT change for a message 4852 Namespace = nil / "(" 1*Namespace-Descr ")" 4854 Namespace-Command = "NAMESPACE" 4856 Namespace-Descr = "(" string SP 4857 (DQUOTE QUOTED-CHAR DQUOTE / nil) 4858 *(Namespace-Response-Extension) ")" 4860 Namespace-Response-Extension = SP string SP 4861 "(" string *(SP string) ")" 4863 Namespace-Response = "NAMESPACE" SP Namespace 4864 SP Namespace SP Namespace 4865 ; The first Namespace is the Personal Namespace(s) 4866 ; The second Namespace is the Other Users' Namespace(s) 4867 ; The third Namespace is the Shared Namespace(s) 4869 nil = "NIL" 4871 nstring = string / nil 4873 number = 1*DIGIT 4874 ; Unsigned 32-bit integer 4875 ; (0 <= n < 4,294,967,296) 4877 number64 = 1*DIGIT 4878 ; Unsigned 63-bit integer 4879 ; (0 <= n <= 9,223,372,036,854,775,807) 4881 nz-number = digit-nz *DIGIT 4882 ; Non-zero unsigned 32-bit integer 4883 ; (0 < n < 4,294,967,296) 4885 password = astring 4887 partial-range = number ["." nz-number] 4888 ; Copied from RFC 5092 (IMAP URL) 4890 partial = "<" number "." nz-number ">" 4891 ; Partial FETCH request. 0-based offset of 4892 ; the first octet, followed by the number of octets 4893 ; in the fragment. 4895 quoted = DQUOTE *QUOTED-CHAR DQUOTE 4897 QUOTED-CHAR = / 4898 "\" quoted-specials / UTF8-2 / UTF8-3 / UTF8-4 4900 quoted-specials = DQUOTE / "\" 4902 rename = "RENAME" SP mailbox SP mailbox 4903 ; Use of INBOX as a destination gives a NO error 4905 response = *(continue-req / response-data) response-done 4907 response-data = "*" SP (resp-cond-state / resp-cond-bye / 4908 mailbox-data / message-data / capability-data / 4909 enable-data) CRLF 4911 response-done = response-tagged / response-fatal 4913 response-fatal = "*" SP resp-cond-bye CRLF 4914 ; Server closes connection immediately 4916 response-tagged = tag SP resp-cond-state CRLF 4918 resp-code-apnd = "APPENDUID" SP nz-number SP append-uid 4920 resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set 4922 resp-cond-auth = ("OK" / "PREAUTH") SP resp-text 4923 ; Authentication condition 4925 resp-cond-bye = "BYE" SP resp-text 4927 resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text 4928 ; Status condition 4930 resp-specials = "]" 4932 ;; ////Can we make "text" optional? Will this have any bad side effects? 4933 resp-text = ["[" resp-text-code "]" SP] text 4935 resp-text-code = "ALERT" / 4936 "BADCHARSET" [SP "(" charset *(SP charset) ")" ] / 4937 capability-data / "PARSE" / 4938 "PERMANENTFLAGS" SP "(" 4939 [flag-perm *(SP flag-perm)] ")" / 4940 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / 4941 "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number / 4942 resp-code-apnd / resp-code-copy / "UIDNOTSTICKY" / 4943 "UNAVAILABLE" / "AUTHENTICATIONFAILED" / 4944 "AUTHORIZATIONFAILED" / "EXPIRED" / 4945 "PRIVACYREQUIRED" / "CONTACTADMIN" / "NOPERM" / 4946 "INUSE" / "EXPUNGEISSUED" / "CORRUPTION" / 4947 "SERVERBUG" / "CLIENTBUG" / "CANNOT" / 4948 "LIMIT" / "OVERQUOTA" / "ALREADYEXISTS" / 4949 "NONEXISTENT" / 4950 "CLOSED" / 4951 atom [SP 1*] 4953 search = "SEARCH" [search-return-opts] 4954 SP search-program 4956 search-correlator = SP "(" "TAG" SP tag-string ")" 4958 search-key = "ALL" / "ANSWERED" / "BCC" SP astring / 4959 "BEFORE" SP date / "BODY" SP astring / 4960 "CC" SP astring / "DELETED" / "FLAGGED" / 4961 "FROM" SP astring / "KEYWORD" SP flag-keyword / 4962 "NEW" / "OLD" / "ON" SP date / "SEEN" / 4963 "SINCE" SP date / "SUBJECT" SP astring / 4964 "TEXT" SP astring / "TO" SP astring / 4965 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" / 4966 "UNKEYWORD" SP flag-keyword / "UNSEEN" / 4967 ; Above this line were in [IMAP2] 4968 "DRAFT" / "HEADER" SP header-fld-name SP astring / 4969 "LARGER" SP number / "NOT" SP search-key / 4970 "OR" SP search-key SP search-key / 4971 "SENTBEFORE" SP date / "SENTON" SP date / 4972 "SENTSINCE" SP date / "SMALLER" SP number / 4973 "UID" SP sequence-set / "UNDRAFT" / sequence-set / 4974 "(" search-key *(SP search-key) ")" 4976 search-modifier-name = tagged-ext-label 4977 search-mod-params = tagged-ext-val 4978 ; This non-terminal shows recommended syntax 4979 ; for future extensions. 4981 search-program = ["CHARSET" SP charset SP] 4982 search-key *(SP search-key) 4983 ; CHARSET argument to SEARCH MUST be 4984 ; registered with IANA. 4986 search-ret-data-ext = search-modifier-name SP search-return-value 4987 ; Note that not every SEARCH return option 4988 ; is required to have the corresponding 4989 ; ESEARCH return data. 4991 search-return-data = "MIN" SP nz-number / 4992 "MAX" SP nz-number / 4993 "ALL" SP sequence-set / 4994 "COUNT" SP number / 4995 search-ret-data-ext 4996 ; All return data items conform to 4997 ; search-ret-data-ext syntax 4999 search-return-opts = SP "RETURN" SP "(" [search-return-opt 5000 *(SP search-return-opt)] ")" 5002 search-return-opt = "MIN" / "MAX" / "ALL" / "COUNT" / 5003 search-ret-opt-ext 5004 ; conforms to generic search-ret-opt-ext 5005 ; syntax 5007 search-ret-opt-ext = search-modifier-name [SP search-mod-params] 5009 search-return-value = tagged-ext-val 5010 ; Data for the returned search option. 5011 ; A single "nz-number"/"number"/"number64" value 5012 ; can be returned as an atom (i.e., without 5013 ; quoting). A sequence-set can be returned 5014 ; as an atom as well. 5016 section = "[" [section-spec] "]" 5018 section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list / 5019 "TEXT" 5020 ; top-level or MESSAGE/RFC822 or MESSAGE/GLOBAL part 5022 section-part = nz-number *("." nz-number) 5023 ; body part reference. 5024 ; Allows for accessing nested body parts. 5026 section-spec = section-msgtext / (section-part ["." section-text]) 5028 section-text = section-msgtext / "MIME" 5029 ; text other than actual body part (headers, etc.) 5031 select = "SELECT" SP mailbox 5033 seq-number = nz-number / "*" 5034 ; message sequence number (COPY, FETCH, STORE 5035 ; commands) or unique identifier (UID COPY, 5036 ; UID FETCH, UID STORE commands). 5037 ; * represents the largest number in use. In 5038 ; the case of message sequence numbers, it is 5039 ; the number of messages in a non-empty mailbox. 5040 ; In the case of unique identifiers, it is the 5041 ; unique identifier of the last message in the 5042 ; mailbox or, if the mailbox is empty, the 5043 ; mailbox's current UIDNEXT value. 5044 ; The server should respond with a tagged BAD 5045 ; response to a command that uses a message 5046 ; sequence number greater than the number of 5047 ; messages in the selected mailbox. This 5048 ; includes "*" if the selected mailbox is empty. 5050 seq-range = seq-number ":" seq-number 5051 ; two seq-number values and all values between 5052 ; these two regardless of order. 5053 ; Example: 2:4 and 4:2 are equivalent and indicate 5054 ; values 2, 3, and 4. 5055 ; Example: a unique identifier sequence range of 5056 ; 3291:* includes the UID of the last message in 5057 ; the mailbox, even if that value is less than 3291. 5059 sequence-set = (seq-number / seq-range) ["," sequence-set] 5060 ; set of seq-number values, regardless of order. 5061 ; Servers MAY coalesce overlaps and/or execute the 5062 ; sequence in any order. 5063 ; Example: a message sequence number set of 5064 ; 2,4:7,9,12:* for a mailbox with 15 messages is 5065 ; equivalent to 2,4,5,6,7,9,12,13,14,15 5066 ; Example: a message sequence number set of *:4,5:7 5067 ; for a mailbox with 10 messages is equivalent to 5068 ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and 5069 ; overlap coalesced to be 4,5,6,7,8,9,10. 5071 status = "STATUS" SP mailbox SP 5072 "(" status-att *(SP status-att) ")" 5074 status-att = "MESSAGES" / "UIDNEXT" / "UIDVALIDITY" / 5075 "UNSEEN" / "SIZE" 5077 status-att-val = ("MESSAGES" SP number) / 5078 ("UIDNEXT" SP nz-number) / 5079 ("UIDVALIDITY" SP nz-number) / 5080 ("UNSEEN" SP number) / 5081 ("SIZE" SP number64) 5082 ; Extensions to the STATUS responses 5083 ; should extend this production. 5084 ; Extensions should use the generic 5085 ; syntax defined by tagged-ext. 5087 status-att-list = status-att-val *(SP status-att-val) 5089 store = "STORE" SP sequence-set SP store-att-flags 5091 store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP 5092 (flag-list / (flag *(SP flag))) 5094 string = quoted / literal 5096 subscribe = "SUBSCRIBE" SP mailbox 5098 tag = 1* 5100 tagged-ext-label = tagged-label-fchar *tagged-label-char 5101 ;; Is a valid RFC 3501 "atom". 5103 tagged-label-fchar = ALPHA / "-" / "_" / "." 5105 tagged-label-char = tagged-label-fchar / DIGIT / ":" 5107 tagged-ext-comp = astring / 5108 tagged-ext-comp *(SP tagged-ext-comp) / 5109 "(" tagged-ext-comp ")" 5110 ;; Extensions that follow this general 5111 ;; syntax should use nstring instead of 5112 ;; astring when appropriate in the context 5113 ;; of the extension. 5114 ;; Note that a message set or a "number" 5115 ;; can always be represented as an "atom". 5116 ;; An URL should be represented as 5117 ;; a "quoted" string. 5119 tagged-ext-simple = sequence-set / number / number64 5121 tagged-ext-val = tagged-ext-simple / 5122 "(" [tagged-ext-comp] ")" 5124 text = 1*TEXT-CHAR 5126 TEXT-CHAR = 5128 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 5129 ; Hours minutes seconds 5131 uid = "UID" SP 5132 (copy / move / fetch / search / store / uid-expunge) 5133 ; Unique identifiers used instead of message 5134 ; sequence numbers 5136 uid-expunge = "EXPUNGE" SP sequence-set 5137 ; Unique identifiers used instead of message 5138 ; sequence numbers 5140 uid-set = (uniqueid / uid-range) *("," uid-set) 5142 uid-range = (uniqueid ":" uniqueid) 5143 ; two uniqueid values and all values 5144 ; between these two regards of order. 5145 ; Example: 2:4 and 4:2 are equivalent. 5147 uniqueid = nz-number 5148 ; Strictly ascending 5150 unsubscribe = "UNSUBSCRIBE" SP mailbox 5152 userid = astring 5154 UTF8-2 = 5156 UTF8-3 = 5158 UTF8-4 = 5160 x-command = "X" atom 5162 zone = ("+" / "-") 4DIGIT 5163 ; Signed four-digit value of hhmm representing 5164 ; hours and minutes east of Greenwich (that is, 5165 ; the amount that the given time differs from 5166 ; Universal Time). Subtracting the timezone 5167 ; from the given time will give the UT form. 5168 ; The Universal Time zone is "+0000". 5170 10. Author's Note 5172 This document is a revision or rewrite of earlier documents, and 5173 supercedes the protocol specification in those documents: RFC 2060, 5174 RFC 1730, unpublished IMAP2bis.TXT document, RFC 1176, and RFC 1064. 5176 11. Security Considerations 5178 IMAP4rev2 protocol transactions, including electronic mail data, are 5179 sent in the clear over the network unless protection from snooping is 5180 negotiated. This can be accomplished either by the use of IMAPS 5181 service, STARTTLS command, negotiated privacy protection in the 5182 AUTHENTICATE command, or some other protection mechanism. 5184 11.1. STARTTLS Security Considerations 5186 IMAP client and server implementations MUST comply with relevant TLS 5187 recommendations from [RFC8314]. Additionally, when using TLS 1.2, 5188 IMAP implementations MUST implement 5189 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite, and SHOULD 5190 implement the TLS_RSA_WITH_AES_128_CBC_SHA [TLS] cipher suite. This 5191 is important as it assures that any two compliant implementations can 5192 be configured to interoperate. Other TLS cipher suites recommended 5193 in RFC 7525 are RECOMMENDED: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 5194 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 and 5195 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384. All other cipher suites are 5196 OPTIONAL. Note that this is a change from section 2.1 of [IMAP-TLS]. 5198 During the [TLS] negotiation, the client MUST check its understanding 5199 of the server hostname against the server's identity as presented in 5200 the server Certificate message, in order to prevent man-in-the-middle 5201 attacks. This procedure is described in [RFC7817]. 5203 Both the client and server MUST check the result of the STARTTLS 5204 command and subsequent [TLS] negotiation to see whether acceptable 5205 authentication and/or privacy was achieved. 5207 11.2. COPYUID and APPENDUID response codes 5209 The COPYUID and APPENDUID response codes return information about the 5210 mailbox, which may be considered sensitive if the mailbox has 5211 permissions set that permit the client to COPY or APPEND to the 5212 mailbox, but not SELECT or EXAMINE it. 5214 Consequently, these response codes SHOULD NOT be issued if the client 5215 does not have access to SELECT or EXAMINE the mailbox. 5217 11.3. Other Security Considerations 5219 A server error message for an AUTHENTICATE command which fails due to 5220 invalid credentials SHOULD NOT detail why the credentials are 5221 invalid. 5223 Use of the LOGIN command sends passwords in the clear. This can be 5224 avoided by using the AUTHENTICATE command with a [SASL] mechanism 5225 that does not use plaintext passwords, by first negotiating 5226 encryption via STARTTLS or some other protection mechanism. 5228 A server implementation MUST implement a configuration that, at the 5229 time of authentication, requires: 5230 (1) The STARTTLS command has been negotiated. 5231 OR 5232 (2) Some other mechanism that protects the session from password 5233 snooping has been provided. 5234 OR 5235 (3) The following measures are in place: 5236 (a) The LOGINDISABLED capability is advertised, and [SASL] mechanisms 5237 (such as PLAIN) using plaintext passwords are NOT advertised in the 5238 CAPABILITY list. 5239 AND 5240 (b) The LOGIN command returns an error even if the password is 5241 correct. 5242 AND 5243 (c) The AUTHENTICATE command returns an error with all [SASL] 5244 mechanisms that use plaintext passwords, even if the password is 5245 correct. 5247 A server error message for a failing LOGIN command SHOULD NOT specify 5248 that the user name, as opposed to the password, is invalid. 5250 A server SHOULD have mechanisms in place to limit or delay failed 5251 AUTHENTICATE/LOGIN attempts. 5253 Additional security considerations are discussed in the section 5254 discussing the AUTHENTICATE and LOGIN commands. 5256 12. IANA Considerations 5258 IANA is requested to update "Service Names and Transport Protocol 5259 Port Numbers" registry as follows: 5261 1. Registration for TCP "imap" port 143 should be updated to point 5262 to this document and RFC 3501. 5264 2. Registration for TCP "imaps" port 993 should be updated to point 5265 to this document, RFC 8314 and RFC 3501. 5267 3. Both UDP port 143 and UDP port 993 should be marked as "Reserved" 5268 in the registry. 5270 Additional IANA actions are specified in subsection of this section. 5272 12.1. Updates to IMAP4 Capabilities registry 5274 IMAP4 capabilities are registered by publishing a standards track or 5275 IESG approved informational or experimental RFC. The registry is 5276 currently located at: http://www.iana.org/assignments/ 5277 imap4-capabilities 5279 As this specification revises the STARTTLS and LOGINDISABLED 5280 extensions previously defined in [IMAP-TLS], IANA is requested to 5281 update registry entries for these 2 extensions to point to this 5282 document. 5284 12.2. GSSAPI/SASL service name 5286 GSSAPI/Kerberos/SASL service names are registered by publishing a 5287 standards track or IESG approved experimental RFC. The registry is 5288 currently located at: http://www.iana.org/assignments/gssapi-service- 5289 names 5291 IANA is requested to update the "imap" service name previously 5292 registered in RFC 3501, to point to this document. 5294 13. References 5296 13.1. Normative References 5298 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 5299 Specifications: ABNF", STD 68, RFC 5234, January 2008, 5300 . 5302 [ANONYMOUS] 5303 Zeilenga, K., "Anonymous Simple Authentication and 5304 Security Layer (SASL) Mechanism", RFC 4505, June 2006, 5305 . 5307 [CHARSET] Freed, N. and J. Postel, "IANA Charset Registration 5308 Procedures", BCP 19, RFC 2978, October 2000, 5309 . 5311 [DIGEST-MD5] 5312 Leach, P. and C. Newman, "Using Digest Authentication as a 5313 SASL Mechanism", RFC 2831, May 2000, 5314 . 5316 [DISPOSITION] 5317 Troost, R., Dorner, S., and K. Moore, Ed., "Communicating 5318 Presentation Information in Internet Messages: The 5319 Content-Disposition Header Field", RFC 2183, August 1997, 5320 . 5322 [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 5323 Security Layer (SASL) Mechanism", RFC 4616, August 2006, 5324 . 5326 [KEYWORDS] 5327 Bradner, S., "Key words for use in RFCs to Indicate 5328 Requirement Levels", BCP 14, RFC 2119, March 1997, 5329 . 5331 [LANGUAGE-TAGS] 5332 Alvestrand, H., "Content Language Headers", RFC 3282, May 5333 2002, . 5335 [LOCATION] 5336 Palme, J., Hopmann, A., and N. Shelness, "MIME 5337 Encapsulation of Aggregate Documents, such as HTML 5338 (MHTML)", RFC 2557, March 1999, 5339 . 5341 [MD5] Myers, J. and M. Rose, "The Content-MD5 Header Field", 5342 RFC 1864, October 1995, 5343 . 5345 [MIME-HDRS] 5346 Moore, K., "MIME (Multipurpose Internet Mail Extensions) 5347 Part Three: Message Header Extensions for Non-ASCII Text", 5348 RFC 2047, November 1996, 5349 . 5351 [MIME-IMB] 5352 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5353 Extensions (MIME) Part One: Format of Internet Message 5354 Bodies", RFC 2045, November 1996, 5355 . 5357 [MIME-IMT] 5358 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5359 Extensions (MIME) Part Two: Media Types", RFC 2046, 5360 November 1996, . 5362 [RFC-5322] 5363 Resnick, P., Ed., "Internet Message Format", RFC 5322, 5364 October 2008, . 5366 [SASL] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 5367 Authentication and Security Layer (SASL)", RFC 4422, June 5368 2006, . 5370 [TLS] Dierks, T. and E. Rescorla, "The Transport Layer Security 5371 (TLS) Protocol Version 1.2", RFC 5246, August 2008, 5372 . 5374 [UTF-7] Goldsmith, D. and M. Davis, "UTF-7 A Mail-Safe 5375 Transformation Format of Unicode", RFC 2152, May 1997, 5376 . 5378 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 5379 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 5380 2003, . 5382 [MULTIAPPEND] 5383 Crispin, M., "Internet Message Access Protocol (IMAP) - 5384 MULTIAPPEND Extension", RFC 3502, March 2003, 5385 . 5387 [IMAP-IMPLEMENTATION] 5388 Leiba, B., "IMAP4 Implementation Recommendations", 5389 RFC 2683, September 1999, 5390 . 5392 [IMAP-MULTIACCESS] 5393 Gahrns, M., "IMAP4 Multi-Accessed Mailbox Practice", 5394 RFC 2180, July 1997, 5395 . 5397 [NET-UNICODE] 5398 Klensin, J. and M. Padlipsky, "Unicode Format for Network 5399 Interchange", RFC 5198, DOI 10.17487/RFC5198, March 2008, 5400 . 5402 [I18N-HDRS] 5403 Yang, A., Steele, S., and N. Freed, "Internationalized 5404 Email Headers", RFC 6532, DOI 10.17487/RFC6532, February 5405 2012, . 5407 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 5408 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 5409 . 5411 [RFC7817] Melnikov, A., "Updated Transport Layer Security (TLS) 5412 Server Identity Check Procedure for Email-Related 5413 Protocols", RFC 7817, DOI 10.17487/RFC7817, March 2016, 5414 . 5416 [RFC7888] Melnikov, A., Ed., "IMAP4 Non-synchronizing Literals", 5417 RFC 7888, DOI 10.17487/RFC7888, May 2016, 5418 . 5420 [RFC8314] Moore, K. and C. Newman, "Cleartext Considered Obsolete: 5421 Use of Transport Layer Security (TLS) for Email Submission 5422 and Access", RFC 8314, DOI 10.17487/RFC8314, January 2018, 5423 . 5425 13.2. Informative References (related protocols) 5427 [IMAP-DISC] 5428 Melnikov, A., Ed., "Synchronization Operations for 5429 Disconnected IMAP4 Clients", RFC 4549, June 2006, 5430 . 5432 [IMAP-I18N] 5433 Newman, C., Gulbrandsen, A., and A. Melnikov, "Internet 5434 Message Access Protocol Internationalization", RFC 5255, 5435 DOI 10.17487/RFC5255, June 2008, 5436 . 5438 [IMAP-MODEL] 5439 Crispin, M., "Distributed Electronic Mail Models in 5440 IMAP4", RFC 1733, December 1994, 5441 . 5443 [IMAP-UTF-8] 5444 Resnick, P., Ed., Newman, C., Ed., and S. Shen, Ed., "IMAP 5445 Support for UTF-8", RFC 6855, DOI 10.17487/RFC6855, March 5446 2013, . 5448 [ACAP] Newman, C. and J. G. Myers, "ACAP -- Application 5449 Configuration Access Protocol", RFC 2244, November 1997, 5450 . 5452 [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 5453 October 2008, . 5455 [RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", 5456 RFC 4314, December 2005, 5457 . 5459 [RFC2087] Myers, J., "IMAP4 QUOTA extension", RFC 2087, January 5460 1997, . 5462 [IMAP-URL] 5463 Melnikov, A., Ed. and C. Newman, "IMAP URL Scheme", 5464 RFC 5092, DOI 10.17487/RFC5092, November 2007, 5465 . 5467 13.3. Informative References (historical aspects of IMAP and related 5468 protocols) 5470 [IMAP-COMPAT] 5471 Crispin, M., "IMAP4 Compatibility with IMAP2bis", 5472 RFC 2061, December 1996, 5473 . 5475 [IMAP-HISTORICAL] 5476 Crispin, M., "IMAP4 Compatibility with IMAP2 and 5477 IMAP2bis", RFC 1732, December 1994, 5478 . 5480 [IMAP-OBSOLETE] 5481 Crispin, M., "Internet Message Access Protocol - Obsolete 5482 Syntax", RFC 2062, December 1996, 5483 . 5485 [IMAP2] Crispin, M., "Interactive Mail Access Protocol: Version 5486 2", RFC 1176, August 1990, 5487 . 5489 [RFC-822] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 5490 TEXT MESSAGES", STD 11, RFC 822, August 1982, 5491 . 5493 [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, 5494 RFC 821, August 1982, 5495 . 5497 [IMAP-TLS] 5498 Newman, C., "Using TLS with IMAP, POP3 and ACAP", 5499 RFC 2595, June 1999, 5500 . 5502 Appendix A. Backward compatibility with IMAP4rev1 5504 An implementation that wants to remain compatible with IMAP4rev1 can 5505 advertise both IMAP4rev1 and IMAP4rev2 in its CAPABILITY response/ 5506 response code. While some IMAP4rev1 responses were removed in 5507 IMAP4rev2, their presence will not break IMAP4rev2-only clients. 5509 If both IMAP4rev1 and IMAP4rev2 are advertised, an IMAP client that 5510 wants to use IMAP4rev2 MUST issue an "ENABLE IMAP4rev2" command. 5512 Servers advertising both IMAP4rev1 and IMAP4rev2 SHOULD NOT generate 5513 UTF-8 quoted strings unless the client has issued "ENABLE IMAP4rev2". 5514 Consider implementation of mechanisms described or referenced in 5515 [IMAP-UTF-8] to achieve this goal. 5517 Servers advertising both IMAP4rev1 and IMAP4rev2, and clients 5518 intending to be compatible with IMAP4rev1 servers MUST be compatible 5519 with the international mailbox naming convention described in the 5520 following subsection. 5522 A.1. Mailbox International Naming Convention 5524 By convention, international mailbox names in IMAP4rev2 are specified 5525 using a modified version of the UTF-7 encoding described in [UTF-7]. 5526 Modified UTF-7 may also be usable in servers that implement an 5527 earlier version of this protocol. 5529 In modified UTF-7, printable US-ASCII characters, except for "&", 5530 represent themselves; that is, characters with octet values 0x20-0x25 5531 and 0x27-0x7e. The character "&" (0x26) is represented by the two- 5532 octet sequence "&-". 5534 All other characters (octet values 0x00-0x1f and 0x7f-0xff) are 5535 represented in modified BASE64, with a further modification from 5536 [UTF-7] that "," is used instead of "/". Modified BASE64 MUST NOT be 5537 used to represent any printing US-ASCII character which can represent 5538 itself. Only characters inside the modified BASE64 alphabet are 5539 permitted in modified BASE64 text. 5541 "&" is used to shift to modified BASE64 and "-" to shift back to US- 5542 ASCII. There is no implicit shift from BASE64 to US-ASCII, and null 5543 shifts ("-&" while in BASE64; note that "&-" while in US-ASCII means 5544 "&") are not permitted. However, all names start in US-ASCII, and 5545 MUST end in US-ASCII; that is, a name that ends with a non-ASCII 5546 ISO-10646 character MUST end with a "-"). 5548 The purpose of these modifications is to correct the following 5549 problems with UTF-7: 5551 1. UTF-7 uses the "+" character for shifting; this conflicts with 5552 the common use of "+" in mailbox names, in particular USENET 5553 newsgroup names. 5555 2. UTF-7's encoding is BASE64 which uses the "/" character; this 5556 conflicts with the use of "/" as a popular hierarchy delimiter. 5558 3. UTF-7 prohibits the unencoded usage of "\"; this conflicts with 5559 the use of "\" as a popular hierarchy delimiter. 5561 4. UTF-7 prohibits the unencoded usage of "~"; this conflicts with 5562 the use of "~" in some servers as a home directory indicator. 5564 5. UTF-7 permits multiple alternate forms to represent the same 5565 string; in particular, printable US-ASCII characters can be 5566 represented in encoded form. 5568 Although modified UTF-7 is a convention, it establishes certain 5569 requirements on server handling of any mailbox name with an embedded 5570 "&" character. In particular, server implementations MUST preserve 5571 the exact form of the modified BASE64 portion of a modified UTF-7 5572 name and treat that text as case-sensitive, even if names are 5573 otherwise case-insensitive or case-folded. 5575 Server implementations SHOULD verify that any mailbox name with an 5576 embedded "&" character, used as an argument to CREATE, is: in the 5577 correctly modified UTF-7 syntax, has no superfluous shifts, and has 5578 no encoding in modified BASE64 of any printing US-ASCII character 5579 which can represent itself. However, client implementations MUST NOT 5580 depend upon the server doing this, and SHOULD NOT attempt to create a 5581 mailbox name with an embedded "&" character unless it complies with 5582 the modified UTF-7 syntax. 5584 Server implementations which export a mail store that does not follow 5585 the modified UTF-7 convention MUST convert to modified UTF-7 any 5586 mailbox name that contains either non-ASCII characters or the "&" 5587 character. 5589 For example, here is a mailbox name which mixes English, Chinese, 5590 and Japanese text: ~peter/mail/&U,BTFw-/&ZeVnLIqe- 5591 For example, the string "&Jjo!" is not a valid mailbox name 5592 because it does not contain a shift to US-ASCII before the "!". 5593 The correct form is "&Jjo-!". The string "&U,BTFw-&ZeVnLIqe-" is 5594 not permitted because it contains a superfluous shift. The 5595 correct form is "&U,BTF2XlZyyKng-". 5597 Appendix B. Changes from RFC 3501 / IMAP4rev1 5599 The following is the plan for remaining changes. The plan might 5600 change over time. 5602 1. Fold in the following extensions/RFC: RFC 5530 (IMAP Response 5603 Codes, done), UIDPLUS (done), ENABLE (done), ESEARCH (done), 5604 SPECIAL-USE (list of new mailbox attributes is done), LITERAL- 5605 (done), NAMESPACE (done), SASL-IR (done), IDLE (done), MOVE 5606 (done). 5608 2. Add CLOSED response code (from CONDSTORE) - done 5610 3. Add support for $MDNSent and $Forwarded IMAP keywords - done. 5611 Add more examples showing their use? Also add other keywords 5612 like $Phishing, $Junk, $NonJunk? 5614 4. Require all unsolicited FETCH updates to include UID - done. 5616 5. Update recommendations on TLS ciphers to match UTA WG work (as 5617 per RFC 8314, RFC 7525 and RFC 7817) - done. 5619 6. Possibly fold in the following extensions/RFC: Base LIST- 5620 EXTENDED syntax plus deprecate LSUB (replace it with LIST 5621 \Subscribed) minus the requirement to support multiple list 5622 patterns, STATUS-in-LIST, SEARCHRES, BINARY (only the FETCH 5623 changes on leaf body part and make APPEND related ones optional. 5624 See the mailing list discussion), Unique mailstore IDs for 5625 messages (OBJECTID extension, RFC 8474) -- rough consensus to 5626 keep it as an extension. 5628 7. Add STATUS SIZE (total mailbox size) - done Add STATUS DELETED 5629 (number of messages with \Deleted flag set)? Or DELETEDSIZE? 5631 8. Deprecate features: What should we do with NEW search key (which 5632 implies RECENT): deprecate it or just redefine it to ignore 5633 RECENT state? 5635 9. Drop UTF-7, all mailboxes are always in UTF-8 - done. 5637 10. Revise IANA registration of IMAP extensions and give advice on 5638 use of "X-" convention. 5640 11. Allow word-based searching (as per Chris Newman)? 5642 The following changes since RFC 3501 were done so far: 5644 1. Folded in IMAP UNSELECT (RFC 3691), UIDPLUS (RFC 4315), ESEARCH 5645 (RFC 4731), ENABLE (RFC 5161), IDLE (RFC 2177), SASL-IR (RFC 5646 4959) and MOVE (RFC 6851) extensions. Also folded RFC 5530. 5648 2. SEARCH command now requires to return ESEARCH response (SEARCH 5649 response is now deprecated). 5651 3. Added CLOSED response code from RFC 7162. 5653 4. Updated to use modern TLS-related recommendations as per RFC 5654 8314, RFC 7817, RFC 7525. 5656 5. For future extensibility extended ABNF for tagged-ext-simple to 5657 allow for bare number64. 5659 6. Added SHOULD level requirement on IMAP servers to support 5660 $MDNSent and $Forwarded keywords. 5662 7. Added STATUS SIZE. 5664 8. Mailbox names and message headers now allow for UTF-8. Support 5665 for Modified UTF-7 in mailbox names is not required, unless 5666 compatibility with IMAP4rev1 is desired. 5668 9. UNSEEN response code on SELECT/EXAMINE is now deprecated. 5670 10. RECENT response on SELECT/EXAMINE, \Recent flag, RECENT STATUS 5671 item are now deprecated. 5673 Appendix C. Acknowledgement 5675 Earlier versions of this document were edited by Mark Crispin. 5676 Sadly, he is no longer available to help with this work. Editors of 5677 this revisions are hoping that Mark would have approved. 5679 Chris Newman has contributed text on I18N and use of UTF-8 in 5680 messages and mailbox names. 5682 Thank you to Tony Hansen for helping with the index generation. 5684 This document incorporate text from RFC 4315, RFC 4466, RFC 4731, RFC 5685 5161, RFC 6154 so work done by authors/editors of these documents is 5686 appreciated. 5688 Index 5690 $ 5691 $Forwarded (predefined flag) 12 5692 $MDNSent (predefined flag) 12 5694 + 5695 +FLAGS 67 5696 +FLAGS.SILENT 67 5698 - 5699 -FLAGS 67 5700 -FLAGS.SILENT 67 5702 A 5703 ALERT (response code) 74 5704 ALL (fetch item) 63 5705 ALL (search key) 60 5706 ALL (search result option) 59 5707 ALREADYEXISTS (response code) 74 5708 ANSWERED (search key) 60 5709 APPEND (command) 51 5710 APPENDUID (response code) 74 5711 AUTHENTICATE (command) 27 5712 AUTHENTICATIONFAILED (response code) 75 5713 AUTHORIZATIONFAILED (response code) 75 5715 B 5716 BAD (response) 82 5717 BADCHARSET (response code) 76 5718 BCC (search key) 60 5719 BEFORE (search key) 60 5720 BODY (fetch item) 64 5721 BODY (fetch result) 91 5722 BODY (search key) 60 5723 BODY.PEEK[
]<> (fetch item) 66 5724 BODYSTRUCTURE (fetch item) 66 5725 BODYSTRUCTURE (fetch result) 91 5726 BODY[
]<> (fetch result) 91 5727 BODY[
]<> (fetch item) 64 5728 BYE (response) 83 5729 Body Structure (message attribute) 13 5731 C 5732 CANNOT (response code) 76 5733 CAPABILITY (command) 24 5734 CAPABILITY (response code) 76 5735 CAPABILITY (response) 84 5736 CC (search key) 60 5737 CHECK (command) 56 5738 CLIENTBUG (response code) 76 5739 CLOSE (command) 56 5740 CLOSED (response code) 76 5741 CONTACTADMIN (response code) 77 5742 COPY (command) 68 5743 COPYUID (response code) 77 5744 CORRUPTION (response code) 77 5745 COUNT (search result option) 59 5746 CREATE (command) 35 5748 D 5749 DELETE (command) 36 5750 DELETED (search key) 60 5751 DRAFT (search key) 60 5753 E 5754 ENABLE (command) 31 5755 ENVELOPE (fetch item) 66 5756 ENVELOPE (fetch result) 94 5757 ESEARCH (response) 88 5758 EXAMINE (command) 35 5759 EXPIRED (response code) 78 5760 EXPUNGE (command) 57 5761 EXPUNGE (response) 90 5762 EXPUNGEISSUED (response code) 78 5763 Envelope Structure (message attribute) 13 5765 F 5766 FAST (fetch item) 63 5767 FETCH (command) 63 5768 FETCH (response) 91 5769 FLAGGED (search key) 60 5770 FLAGS (fetch item) 66 5771 FLAGS (fetch result) 95 5772 FLAGS (response) 89 5773 FLAGS (store command data item) 67 5774 FLAGS.SILENT (store command data item) 67 5775 FROM (search key) 60 5776 FULL (fetch item) 64 5777 Flags (message attribute) 11 5779 H 5780 HEADER (part specifier) 64 5781 HEADER (search key) 60 5782 HEADER.FIELDS (part specifier) 64 5783 HEADER.FIELDS.NOT (part specifier) 64 5785 I 5786 IDLE (command) 53 5787 INTERNALDATE (fetch item) 66 5788 INTERNALDATE (fetch result) 95 5789 INUSE (response code) 78 5790 Internal Date (message attribute) 12 5792 K 5793 KEYWORD (search key) 61 5794 Keyword (type of flag) 12 5796 L 5797 LARGER (search key) 61 5798 LIMIT (response code) 78 5799 LIST (command) 41 5800 LIST (response) 85 5801 LOGOUT (command) 25 5802 LSUB (command) 44 5803 LSUB (response) 87 5805 M 5806 MAX (search result option) 58 5807 MAY (specification requirement term) 5 5808 MESSAGES (status item) 50 5809 MIME (part specifier) 65 5810 MIN (search result option) 58 5811 MOVE (command) 69 5812 MUST (specification requirement term) 5 5813 MUST NOT (specification requirement term) 5 5814 Message Sequence Number (message attribute) 11 5816 N 5817 NAMESPACE (command) 45 5818 NAMESPACE (response) 88 5819 NEW (search key) 61 5820 NO (response) 81 5821 NONEXISTENT (response code) 78 5822 NOOP (command) 25 5823 NOPERM (response code) 79 5824 NOT (search key) 61 5826 O 5827 OK (response) 81 5828 ON (search key) 61 5829 OPTIONAL (specification requirement term) 5 5830 OR (search key) 61 5831 OVERQUOTA (response code) 79 5833 P 5834 PARSE (response code) 79 5835 PERMANENTFLAGS (response code) 79 5836 PREAUTH (response) 82 5837 PRIVACYREQUIRED (response code) 79 5838 Permanent Flag (class of flag) 12 5839 Predefined keywords 12 5841 R 5842 READ-ONLY (response code) 80 5843 READ-WRITE (response code) 80 5844 RECOMMENDED (specification requirement term) 5 5845 RENAME (command) 38 5846 REQUIRED (specification requirement term) 5 5847 RFC822 (fetch item) 66 5848 RFC822 (fetch result) 95 5849 RFC822.HEADER (fetch item) 66 5850 RFC822.HEADER (fetch result) 95 5851 RFC822.SIZE (fetch item) 66 5852 RFC822.SIZE (fetch result) 95 5853 RFC822.TEXT (fetch item) 66 5854 RFC822.TEXT (fetch result) 95 5856 S 5857 SEARCH (command) 58 5858 SEEN (search key) 61 5859 SELECT (command) 33 5860 SENTBEFORE (search key) 61 5861 SENTON (search key) 61 5862 SENTSINCE (search key) 61 5863 SERVERBUG (response code) 80 5864 SHOULD (specification requirement term) 5 5865 SHOULD NOT (specification requirement term) 5 5866 SINCE (search key) 61 5867 SIZE (status item) 51 5868 SMALLER (search key) 61 5869 STARTTLS (command) 26 5870 STATUS (command) 49 5871 STATUS (response) 88 5872 STORE (command) 66 5873 SUBJECT (search key) 61 5874 SUBSCRIBE (command) 40 5875 Session Flag (class of flag) 12 5876 System Flag (type of flag) 11 5878 T 5879 TEXT (part specifier) 64 5880 TEXT (search key) 61 5881 TO (search key) 61 5882 TRYCREATE (response code) 80 5884 U 5885 UID (command) 70 5886 UID (fetch item) 66 5887 UID (fetch result) 95 5888 UID (search key) 62 5889 UIDNEXT (response code) 80 5890 UIDNEXT (status item) 50 5891 UIDNOTSTICKY (response code) 80 5892 UIDVALIDITY (response code) 81 5893 UIDVALIDITY (status item) 50 5894 UNANSWERED (search key) 62 5895 UNAVAILABLE (response code) 81 5896 UNDELETED (search key) 62 5897 UNDRAFT (search key) 62 5898 UNFLAGGED (search key) 62 5899 UNKEYWORD (search key) 62 5900 UNSEEN (search key) 62 5901 UNSEEN (status item) 50 5902 UNSELECT (command) 57 5903 UNSUBSCRIBE (command) 41 5904 Unique Identifier (UID) (message attribute) 9 5906 X 5907 X (command) 72 5909 [ 5910 [RFC-5322] Size (message attribute) 13 5912 \ 5913 \All (mailbox name attribute) 86 5914 \Answered (system flag) 11 5915 \Archive (mailbox name attribute) 86 5916 \Deleted (system flag) 11 5917 \Draft (system flag) 12 5918 \Drafts (mailbox name attribute) 86 5919 \Flagged (mailbox name attribute) 86 5920 \Flagged (system flag) 11 5921 \HasChildren (mailbox name attribute) 85 5922 \HasNoChildren (mailbox name attribute) 85 5923 \Junk (mailbox name attribute) 86 5924 \Marked (mailbox name attribute) 85 5925 \Noinferiors (mailbox name attribute) 85 5926 \Noselect (mailbox name attribute) 85 5927 \Recent (system flag) 12 5928 \Seen (system flag) 11 5929 \Sent (mailbox name attribute) 86 5930 \Trash (mailbox name attribute) 87 5931 \Unmarked (mailbox name attribute) 85 5933 Authors' Addresses 5935 Alexey Melnikov (editor) 5936 Isode Ltd 5937 14 Castle Mews 5938 Hampton, Middlesex TW12 2NP 5939 UK 5941 Email: Alexey.Melnikov@isode.com 5943 Barry Leiba (editor) 5944 Huawei Technologies 5946 Phone: +1 646 827 0648 5947 Email: barryleiba@computer.org 5948 URI: http://internetmessagingtechnology.org/