idnits 2.17.1 draft-ietf-extra-imap4rev2-04.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 (March 9, 2019) is 1875 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 5576, but not defined == Missing Reference: 'IMAP-OBSOLETE' is mentioned on line 5571, but not defined == Missing Reference: 'IMAP-COMPAT' is mentioned on line 5561, but not defined == Missing Reference: 'IMAP-HISTORICAL' is mentioned on line 5566, but not defined == Missing Reference: 'RFC-822' is mentioned on line 5580, but not defined ** Obsolete undefined reference: RFC 822 (Obsoleted by RFC 2822) == Missing Reference: 'HEADER' is mentioned on line 4545, but not defined == Missing Reference: 'IMAP-DISC' is mentioned on line 5514, but not defined == Missing Reference: 'SMTP' is mentioned on line 5539, but not defined == Missing Reference: 'IMAP-URL' is mentioned on line 5553, but not defined == Missing Reference: 'UIDVALIDITY 3857529045' is mentioned on line 4528, but not defined == Missing Reference: 'UIDNEXT 4392' is mentioned on line 1611, but not defined == Missing Reference: 'UIDNEXT 2' is mentioned on line 2400, but not defined == Missing Reference: 'UIDVALIDITY 1' is mentioned on line 2471, but not defined == Missing Reference: 'IMAP-I18N' is mentioned on line 5519, but not defined == Missing Reference: 'TEXT' is mentioned on line 4482, but not defined == Missing Reference: 'UID' is mentioned on line 3185, but not defined == Missing Reference: 'RFC4314' is mentioned on line 5546, but not defined == Missing Reference: 'RFC2087' is mentioned on line 5550, but not defined ** Obsolete undefined reference: RFC 2087 (Obsoleted by RFC 9208) == Missing Reference: 'READ-WRITE' is mentioned on line 4529, but not defined == Missing Reference: 'RFC4422' is mentioned on line 4844, but not defined == Missing Reference: 'IMAP-TLS' is mentioned on line 5588, but not defined == Missing Reference: 'IMAP-MODEL' is mentioned on line 5525, but not defined == Missing Reference: 'IMAP-UTF-8' is mentioned on line 5606, but not defined == Missing Reference: 'ACAP' is mentioned on line 5535, but not defined == Missing Reference: 'RFC3516' is mentioned on line 5692, but not defined == Missing Reference: 'RFC-821' is mentioned on line 5584, 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 (~~), 28 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: September 10, 2019 March 9, 2019 8 INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev2 9 draft-ietf-extra-imap4rev2-04 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, RFC 2045 and RFC 2231 parsing, 23 searching, and selective fetching of message attributes, texts, and 24 portions thereof. Messages in IMAP4rev2 are accessed by the use of 25 numbers. 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 September 10, 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 . . . . . . . . . . . . . . . . . . . . . 20 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 . . . . . . . . . . . . . . . . . . . . 22 114 5.5. Multiple Commands in Progress (Command Pipelining) . . . 22 115 6. Client Commands . . . . . . . . . . . . . . . . . . . . . . . 23 116 6.1. Client Commands - Any State . . . . . . . . . . . . . . . 24 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 . . . . . . . . . . . . . . . . . . . . 67 147 6.4.8. COPY Command . . . . . . . . . . . . . . . . . . . . 68 148 6.4.9. MOVE Command . . . . . . . . . . . . . . . . . . . . 69 149 6.4.10. UID Command . . . . . . . . . . . . . . . . . . . . . 71 150 6.5. Client Commands - Experimental/Expansion . . . . . . . . 73 151 6.5.1. X Command . . . . . . . . . . . . . . . . . . . 73 152 7. Server Responses . . . . . . . . . . . . . . . . . . . . . . 74 153 7.1. Server Responses - Status Responses . . . . . . . . . . . 75 154 7.1.1. OK Response . . . . . . . . . . . . . . . . . . . . . 82 155 7.1.2. NO Response . . . . . . . . . . . . . . . . . . . . . 82 156 7.1.3. BAD Response . . . . . . . . . . . . . . . . . . . . 83 157 7.1.4. PREAUTH Response . . . . . . . . . . . . . . . . . . 83 158 7.1.5. BYE Response . . . . . . . . . . . . . . . . . . . . 83 159 7.2. Server Responses - Server and Mailbox Status . . . . . . 84 160 7.2.1. The ENABLED Response . . . . . . . . . . . . . . . . 84 161 7.2.2. CAPABILITY Response . . . . . . . . . . . . . . . . . 84 162 7.2.3. LIST Response . . . . . . . . . . . . . . . . . . . . 85 163 7.2.4. LSUB Response . . . . . . . . . . . . . . . . . . . . 88 164 7.2.5. NAMESPACE Response . . . . . . . . . . . . . . . . . 89 165 7.2.6. STATUS Response . . . . . . . . . . . . . . . . . . . 89 166 7.2.7. ESEARCH Response . . . . . . . . . . . . . . . . . . 89 167 7.2.8. FLAGS Response . . . . . . . . . . . . . . . . . . . 90 168 7.3. Server Responses - Mailbox Size . . . . . . . . . . . . . 90 169 7.3.1. EXISTS Response . . . . . . . . . . . . . . . . . . . 90 170 7.4. Server Responses - Message Status . . . . . . . . . . . . 90 171 7.4.1. EXPUNGE Response . . . . . . . . . . . . . . . . . . 91 172 7.4.2. FETCH Response . . . . . . . . . . . . . . . . . . . 91 173 7.5. Server Responses - Command Continuation Request . . . . . 97 174 8. Sample IMAP4rev2 connection . . . . . . . . . . . . . . . . . 98 175 9. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 99 176 10. Author's Note . . . . . . . . . . . . . . . . . . . . . . . . 114 177 11. Security Considerations . . . . . . . . . . . . . . . . . . . 114 178 11.1. STARTTLS Security Considerations . . . . . . . . . . . . 114 179 11.2. COPYUID and APPENDUID response codes . . . . . . . . . . 115 180 11.3. Other Security Considerations . . . . . . . . . . . . . 115 181 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 116 182 12.1. Updates to IMAP4 Capabilities registry . . . . . . . . . 116 183 12.2. GSSAPI/SASL service name . . . . . . . . . . . . . . . . 116 184 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 116 185 13.1. Normative References . . . . . . . . . . . . . . . . . . 116 186 13.2. Informative References (related protocols) . . . . . . . 119 187 13.3. Informative References (historical aspects of IMAP and 188 related protocols) . . . . . . . . . . . . . . . . . . . 120 189 Appendix A. Backward compatibility with IMAP4rev1 . . . . . . . 121 190 A.1. Mailbox International Naming Convention . . . . . . . . . 121 191 Appendix B. Backward compatibility with BINARY extension . . . . 123 192 Appendix C. Changes from RFC 3501 / IMAP4rev1 . . . . . . . . . 123 193 Appendix D. Acknowledgement . . . . . . . . . . . . . . . . . . 125 194 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 195 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 130 197 1. How to Read This Document 199 1.1. Organization of This Document 201 This document is written from the point of view of the implementor of 202 an IMAP4rev2 client or server. Beyond the protocol overview in 203 section 2, it is not optimized for someone trying to understand the 204 operation of the protocol. The material in sections 3 through 5 205 provides the general context and definitions with which IMAP4rev2 206 operates. 208 Sections 6, 7, and 9 describe the IMAP commands, responses, and 209 syntax, respectively. The relationships among these are such that it 210 is almost impossible to understand any of them separately. In 211 particular, do not attempt to deduce command syntax from the command 212 section alone; instead refer to the Formal Syntax section. 214 1.2. Conventions Used in This Document 216 "Conventions" are basic principles or procedures. Document 217 conventions are noted in this section. 219 In examples, "C:" and "S:" indicate lines sent by the client and 220 server respectively. 222 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 223 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 224 document are to be interpreted as described in [KEYWORDS]. 226 The word "can" (not "may") is used to refer to a possible 227 circumstance or situation, as opposed to an optional facility of the 228 protocol. 230 "User" is used to refer to a human user, whereas "client" refers to 231 the software being run by the user. 233 "Connection" refers to the entire sequence of client/server 234 interaction from the initial establishment of the network connection 235 until its termination. 237 "Session" refers to the sequence of client/server interaction from 238 the time that a mailbox is selected (SELECT or EXAMINE command) until 239 the time that selection ends (SELECT or EXAMINE of another mailbox, 240 CLOSE command, or connection termination). 242 Characters are 7-bit US-ASCII unless otherwise specified. Other 243 character sets are indicated using a "CHARSET", as described in 244 [MIME-IMT] and defined in [CHARSET]. CHARSETs have important 245 additional semantics in addition to defining character set; refer to 246 these documents for more detail. 248 There are several protocol conventions in IMAP. These refer to 249 aspects of the specification which are not strictly part of the IMAP 250 protocol, but reflect generally-accepted practice. Implementations 251 need to be aware of these conventions, and avoid conflicts whether or 252 not they implement the convention. For example, "&" may not be used 253 as a hierarchy delimiter since it conflicts with the Mailbox 254 International Naming Convention, and other uses of "&" in mailbox 255 names are impacted as well. 257 1.3. Special Notes to Implementors 259 Implementors of the IMAP protocol are strongly encouraged to read the 260 IMAP implementation recommendations document [IMAP-IMPLEMENTATION] in 261 conjunction with this document, to help understand the intricacies of 262 this protocol and how best to build an interoperable product. 264 IMAP4rev2 is designed to be upwards compatible from the [IMAP2] and 265 unpublished IMAP2bis protocols. IMAP4rev2 is largely compatible with 266 the IMAP4rev1 protocol described in RFC 3501 and the IMAP4 protocol 267 described in RFC 1730; the exception being in certain facilities 268 added in RFC 1730 that proved problematic and were subsequently 269 removed. In the course of the evolution of IMAP4rev2, some aspects 270 in the earlier protocols have become obsolete. Obsolete commands, 271 responses, and data formats which an IMAP4rev2 implementation can 272 encounter when used with an earlier implementation are described in 273 [IMAP-OBSOLETE]. 275 Other compatibility issues with IMAP2bis, the most common variant of 276 the earlier protocol, are discussed in [IMAP-COMPAT]. A full 277 discussion of compatibility issues with rare (and presumed extinct) 278 variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is 279 primarily of historical interest. 281 IMAP was originally developed for the older [RFC-822] standard, and 282 as a consequence several fetch items in IMAP incorporate "RFC822" in 283 their name. With the exception of RFC822.SIZE, there are more modern 284 replacements; for example, the modern version of RFC822.HEADER is 285 BODY.PEEK[HEADER]. In all cases, "RFC822" should be interpreted as a 286 reference to the updated [RFC-5322] standard. 288 2. Protocol Overview 290 2.1. Link Level 292 The IMAP4rev2 protocol assumes a reliable data stream such as that 293 provided by TCP. When TCP is used, an IMAP4rev2 server listens on 294 port 143. 296 2.2. Commands and Responses 298 An IMAP4rev2 connection consists of the establishment of a client/ 299 server network connection, an initial greeting from the server, and 300 client/server interactions. These client/server interactions consist 301 of a client command, server data, and a server completion result 302 response. 304 All interactions transmitted by client and server are in the form of 305 lines, that is, strings that end with a CRLF. The protocol receiver 306 of an IMAP4rev2 client or server is either reading a line, or is 307 reading a sequence of octets with a known count followed by a line. 309 2.2.1. Client Protocol Sender and Server Protocol Receiver 311 The client command begins an operation. Each client command is 312 prefixed with an identifier (typically a short alphanumeric string, 313 e.g., A0001, A0002, etc.) called a "tag". A different tag is 314 generated by the client for each command. 316 Clients MUST follow the syntax outlined in this specification 317 strictly. It is a syntax error to send a command with missing or 318 extraneous spaces or arguments. 320 There are two cases in which a line from the client does not 321 represent a complete command. In one case, a command argument is 322 quoted with an octet count (see the description of literal in String 323 under Data Formats); in the other case, the command arguments require 324 server feedback (see the AUTHENTICATE command). In either case, the 325 server sends a command continuation request response if it is ready 326 for the octets (if appropriate) and the remainder of the command. 327 This response is prefixed with the token "+". 329 Note: If instead, the server detected an error in the command, it 330 sends a BAD completion response with a tag matching the command 331 (as described below) to reject the command and prevent the client 332 from sending any more of the command. 334 It is also possible for the server to send a completion response 335 for some other command (if multiple commands are in progress), or 336 untagged data. In either case, the command continuation request 337 is still pending; the client takes the appropriate action for the 338 response, and reads another response from the server. In all 339 cases, the client MUST send a complete command (including 340 receiving all command continuation request responses and command 341 continuations for the command) before initiating a new command. 343 The protocol receiver of an IMAP4rev2 server reads a command line 344 from the client, parses the command and its arguments, and transmits 345 server data and a server command completion result response. 347 2.2.2. Server Protocol Sender and Client Protocol Receiver 349 Data transmitted by the server to the client and status responses 350 that do not indicate command completion are prefixed with the token 351 "*", and are called untagged responses. 353 Server data MAY be sent as a result of a client command, or MAY be 354 sent unilaterally by the server. There is no syntactic difference 355 between server data that resulted from a specific command and server 356 data that were sent unilaterally. 358 The server completion result response indicates the success or 359 failure of the operation. It is tagged with the same tag as the 360 client command which began the operation. Thus, if more than one 361 command is in progress, the tag in a server completion response 362 identifies the command to which the response applies. There are 363 three possible server completion responses: OK (indicating success), 364 NO (indicating failure), or BAD (indicating a protocol error such as 365 unrecognized command or command syntax error). 367 Servers SHOULD enforce the syntax outlined in this specification 368 strictly. Any client command with a protocol syntax error, including 369 (but not limited to) missing or extraneous spaces or arguments, 370 SHOULD be rejected, and the client given a BAD server completion 371 response. 373 The protocol receiver of an IMAP4rev2 client reads a response line 374 from the server. It then takes action on the response based upon the 375 first token of the response, which can be a tag, a "*", or a "+". 377 A client MUST be prepared to accept any server response at all times. 378 This includes server data that was not requested. Server data SHOULD 379 be recorded, so that the client can reference its recorded copy 380 rather than sending a command to the server to request the data. In 381 the case of certain server data, the data MUST be recorded. 383 This topic is discussed in greater detail in the Server Responses 384 section. 386 2.3. Message Attributes 388 In addition to message text, each message has several attributes 389 associated with it. These attributes can be retrieved individually 390 or in conjunction with other attributes or message texts. 392 2.3.1. Message Numbers 394 Messages in IMAP4rev2 are accessed by one of two numbers; the unique 395 identifier or the message sequence number. 397 2.3.1.1. Unique Identifier (UID) Message Attribute 399 An unsigned 32-bit value assigned to each message, which when used 400 with the unique identifier validity value (see below) forms a 64-bit 401 value that MUST NOT refer to any other message in the mailbox or any 402 subsequent mailbox with the same name forever. Unique identifiers 403 are assigned in a strictly ascending fashion in the mailbox; as each 404 message is added to the mailbox it is assigned a higher UID than the 405 message(s) which were added previously. Unlike message sequence 406 numbers, unique identifiers are not necessarily contiguous. 408 The unique identifier of a message MUST NOT change during the 409 session, and SHOULD NOT change between sessions. Any change of 410 unique identifiers between sessions MUST be detectable using the 411 UIDVALIDITY mechanism discussed below. Persistent unique identifiers 412 are required for a client to resynchronize its state from a previous 413 session with the server (e.g., disconnected or offline access 414 clients); this is discussed further in [IMAP-DISC]. 416 Associated with every mailbox are two 32-bit unsigned values which 417 aid in unique identifier handling: the next unique identifier value 418 (UIDNEXT) and the unique identifier validity value (UIDVALIDITY). 420 The next unique identifier value is the predicted value that will be 421 assigned to a new message in the mailbox. Unless the unique 422 identifier validity also changes (see below), the next unique 423 identifier value MUST have the following two characteristics. First, 424 the next unique identifier value MUST NOT change unless new messages 425 are added to the mailbox; and second, the next unique identifier 426 value MUST change whenever new messages are added to the mailbox, 427 even if those new messages are subsequently expunged. 429 Note: The next unique identifier value is intended to provide a 430 means for a client to determine whether any messages have been 431 delivered to the mailbox since the previous time it checked this 432 value. It is not intended to provide any guarantee that any 433 message will have this unique identifier. A client can only 434 assume, at the time that it obtains the next unique identifier 435 value, that messages arriving after that time will have a UID 436 greater than or equal to that value. 438 The unique identifier validity value is sent in a UIDVALIDITY 439 response code in an OK untagged response at mailbox selection time. 440 If unique identifiers from an earlier session fail to persist in this 441 session, the unique identifier validity value MUST be greater than 442 the one used in the earlier session. 444 Note: Ideally, unique identifiers SHOULD persist at all times. 445 Although this specification recognizes that failure to persist can 446 be unavoidable in certain server environments, it STRONGLY 447 ENCOURAGES message store implementation techniques that avoid this 448 problem. For example: 450 1. Unique identifiers MUST be strictly ascending in the mailbox 451 at all times. If the physical message store is re-ordered by 452 a non-IMAP agent, this requires that the unique identifiers in 453 the mailbox be regenerated, since the former unique 454 identifiers are no longer strictly ascending as a result of 455 the re-ordering. 457 2. If the message store has no mechanism to store unique 458 identifiers, it must regenerate unique identifiers at each 459 session, and each session must have a unique UIDVALIDITY 460 value. 462 3. If the mailbox is deleted and a new mailbox with the same name 463 is created at a later date, the server must either keep track 464 of unique identifiers from the previous instance of the 465 mailbox, or it must assign a new UIDVALIDITY value to the new 466 instance of the mailbox. A good UIDVALIDITY value to use in 467 this case is a 32-bit representation of the creation date/time 468 of the mailbox. It is alright to use a constant such as 1, 469 but only if it guaranteed that unique identifiers will never 470 be reused, even in the case of a mailbox being deleted (or 471 renamed) and a new mailbox by the same name created at some 472 future time. 474 4. The combination of mailbox name, UIDVALIDITY, and UID must 475 refer to a single immutable message on that server forever. 476 In particular, the internal date, [RFC-5322] size, envelope, 477 body structure, and message texts (RFC822, RFC822.HEADER, 478 RFC822.TEXT, and all BODY[...] fetch data items) must never 479 change. This does not include message numbers, nor does it 480 include attributes that can be set by a STORE command (e.g., 481 FLAGS). 483 2.3.1.2. Message Sequence Number Message Attribute 485 A relative position from 1 to the number of messages in the mailbox. 486 This position MUST be ordered by ascending unique identifier. As 487 each new message is added, it is assigned a message sequence number 488 that is 1 higher than the number of messages in the mailbox before 489 that new message was added. 491 Message sequence numbers can be reassigned during the session. For 492 example, when a message is permanently removed (expunged) from the 493 mailbox, the message sequence number for all subsequent messages is 494 decremented. The number of messages in the mailbox is also 495 decremented. Similarly, a new message can be assigned a message 496 sequence number that was once held by some other message prior to an 497 expunge. 499 In addition to accessing messages by relative position in the 500 mailbox, message sequence numbers can be used in mathematical 501 calculations. For example, if an untagged "11 EXISTS" is received, 502 and previously an untagged "8 EXISTS" was received, three new 503 messages have arrived with message sequence numbers of 9, 10, and 11. 504 Another example, if message 287 in a 523 message mailbox has UID 505 12345, there are exactly 286 messages which have lesser UIDs and 236 506 messages which have greater UIDs. 508 2.3.2. Flags Message Attribute 510 A list of zero or more named tokens associated with the message. A 511 flag is set by its addition to this list, and is cleared by its 512 removal. There are two types of flags in IMAP4rev2. A flag of 513 either type can be permanent or session-only. 515 A system flag is a flag name that is pre-defined in this 516 specification and begin with "\". Certain system flags (\Deleted and 517 \Seen) have special semantics described elsewhere in this document. 518 The currently-defined system flags are: 520 \Seen Message has been read 522 \Answered Message has been answered 524 \Flagged Message is "flagged" for urgent/special attention 526 \Deleted Message is "deleted" for removal by later EXPUNGE 527 \Draft Message has not completed composition (marked as a draft). 529 \Recent This flag was in used in IMAP4rev1 and is now deprecated. 531 A keyword is defined by the server implementation. Keywords do not 532 begin with "\". Servers MAY permit the client to define new keywords 533 in the mailbox (see the description of the PERMANENTFLAGS response 534 code for more information). Some keywords that start with "$" are 535 also defined in this specification. 537 This document defines several keywords that were not originally 538 defined in RFC 3501, but which were found to be useful by client 539 implementations. These keywords SHOULD be supported (i.e. allowed in 540 APPEND, COPY, MOVE and SEARCH commands) by server implementations: 542 $Forwarded Message has been forwarded to another email address, 543 embedded within or attached to a new message. An email client 544 sets this keyword when it successfully forwards the message to 545 another email address. Typical usage of this keyword is to show a 546 different (or additional) icon for a message that has been 547 forwarded. Once set, the flag SHOULD NOT be cleared. 549 $MDNSent Message Disposition Notification was generated and sent for 550 this message. 552 A flag can be permanent or session-only on a per-flag basis. 553 Permanent flags are those which the client can add or remove from the 554 message flags permanently; that is, concurrent and subsequent 555 sessions will see any change in permanent flags. Changes to session 556 flags are valid only in that session. 558 2.3.3. Internal Date Message Attribute 560 The internal date and time of the message on the server. This is not 561 the date and time in the [RFC-5322] header, but rather a date and 562 time which reflects when the message was received. In the case of 563 messages delivered via [SMTP], this SHOULD be the date and time of 564 final delivery of the message as defined by [SMTP]. In the case of 565 messages delivered by the IMAP4rev2 COPY or MOVE command, this SHOULD 566 be the internal date and time of the source message. In the case of 567 messages delivered by the IMAP4rev2 APPEND command, this SHOULD be 568 the date and time as specified in the APPEND command description. 569 All other cases are implementation defined. 571 2.3.4. [RFC-5322] Size Message Attribute 573 The number of octets in the message, as expressed in [RFC-5322] 574 format. 576 2.3.5. Envelope Structure Message Attribute 578 A parsed representation of the [RFC-5322] header of the message. 579 Note that the IMAP Envelope structure is not the same as an [SMTP] 580 envelope. 582 2.3.6. Body Structure Message Attribute 584 A parsed representation of the [MIME-IMB] body structure information 585 of the message. 587 2.4. Message Texts 589 In addition to being able to fetch the full [RFC-5322] text of a 590 message, IMAP4rev2 permits the fetching of portions of the full 591 message text. Specifically, it is possible to fetch the [RFC-5322] 592 message header, [RFC-5322] message body, a [MIME-IMB] body part, or a 593 [MIME-IMB] header. 595 3. State and Flow Diagram 597 Once the connection between client and server is established, an 598 IMAP4rev2 connection is in one of four states. The initial state is 599 identified in the server greeting. Most commands are only valid in 600 certain states. It is a protocol error for the client to attempt a 601 command while the connection is in an inappropriate state, and the 602 server will respond with a BAD or NO (depending upon server 603 implementation) command completion result. 605 3.1. Not Authenticated State 607 In the not authenticated state, the client MUST supply authentication 608 credentials before most commands will be permitted. This state is 609 entered when a connection starts unless the connection has been pre- 610 authenticated. 612 3.2. Authenticated State 614 In the authenticated state, the client is authenticated and MUST 615 select a mailbox to access before commands that affect messages will 616 be permitted. This state is entered when a pre-authenticated 617 connection starts, when acceptable authentication credentials have 618 been provided, after an error in selecting a mailbox, or after a 619 successful CLOSE command. 621 3.3. Selected State 623 In a selected state, a mailbox has been selected to access. This 624 state is entered when a mailbox has been successfully selected. 626 3.4. Logout State 628 In the logout state, the connection is being terminated. This state 629 can be entered as a result of a client request (via the LOGOUT 630 command) or by unilateral action on the part of either the client or 631 server. 633 If the client requests the logout state, the server MUST send an 634 untagged BYE response and a tagged OK response to the LOGOUT command 635 before the server closes the connection; and the client MUST read the 636 tagged OK response to the LOGOUT command before the client closes the 637 connection. 639 A server MUST NOT unilaterally close the connection without sending 640 an untagged BYE response that contains the reason for having done so. 641 A client SHOULD NOT unilaterally close the connection, and instead 642 SHOULD issue a LOGOUT command. If the server detects that the client 643 has unilaterally closed the connection, the server MAY omit the 644 untagged BYE response and simply close its connection. 646 +----------------------+ 647 |connection established| 648 +----------------------+ 649 || 650 \/ 651 +--------------------------------------+ 652 | server greeting | 653 +--------------------------------------+ 654 || (1) || (2) || (3) 655 \/ || || 656 +-----------------+ || || 657 |Not Authenticated| || || 658 +-----------------+ || || 659 || (7) || (4) || || 660 || \/ \/ || 661 || +----------------+ || 662 || | Authenticated |<=++ || 663 || +----------------+ || || 664 || || (7) || (5) || (6) || 665 || || \/ || || 666 || || +--------+ || || 667 || || |Selected|==++ || 668 || || +--------+ || 669 || || || (7) || 670 \/ \/ \/ \/ 671 +--------------------------------------+ 672 | Logout | 673 +--------------------------------------+ 674 || 675 \/ 676 +-------------------------------+ 677 |both sides close the connection| 678 +-------------------------------+ 680 (1) connection without pre-authentication (OK greeting) 681 (2) pre-authenticated connection (PREAUTH greeting) 682 (3) rejected connection (BYE greeting) 683 (4) successful LOGIN or AUTHENTICATE command 684 (5) successful SELECT or EXAMINE command 685 (6) CLOSE command, unsolicited CLOSED response code or 686 failed SELECT or EXAMINE command 687 (7) LOGOUT command, server shutdown, or connection closed 689 4. Data Formats 691 IMAP4rev2 uses textual commands and responses. Data in IMAP4rev2 can 692 be in one of several forms: atom, number, string, parenthesized list, 693 or NIL. Note that a particular data item may take more than one 694 form; for example, a data item defined as using "astring" syntax may 695 be either an atom or a string. 697 4.1. Atom 699 An atom consists of one or more non-special characters. 701 4.1.1. Sequence set and UID set 703 A set of messages can be referenced by a sequence set containing 704 either message sequence numbers or unique identifiers. See Section 9 705 for details. Sequence sets can contain ranges (e.g. "5:50"), an 706 enumeration of specific message/UID numbers, a special symbol "*", or 707 a combination of the above. 709 A "UID set" is similar to the sequence set of unique identifiers; 710 however, the "*" value for a sequence number is not permitted. 712 4.2. Number 714 A number consists of one or more digit characters, and represents a 715 numeric value. 717 4.3. String 719 A string is in one of three forms: synchonizing literal, non- 720 synchronizing literal or quoted string. The synchronizing literal 721 form is the general form of string. The non-synchronizing literal 722 form is also the general form, but has length limitation. The quoted 723 string form is an alternative that avoids the overhead of processing 724 a literal at the cost of limitations of characters which may be used. 726 When the distinction between synchronizing and non-synchronizing 727 literals is not important, this document just uses the term 728 "literal". 730 A synchronizing literal is a sequence of zero or more octets 731 (including CR and LF), prefix-quoted with an octet count in the form 732 of an open brace ("{"), the number of octets, close brace ("}"), and 733 CRLF. In the case of synchronizing literals transmitted from server 734 to client, the CRLF is immediately followed by the octet data. In 735 the case of synchronizing literals transmitted from client to server, 736 the client MUST wait to receive a command continuation request 737 (described later in this document) before sending the octet data (and 738 the remainder of the command). 740 The non-synchronizing literal is an alternate form of synchronizing 741 literal, and it may appear in communication from client to server 742 instead of the synchonizing form of literal. The non-synchronizing 743 literal form MUST NOT be sent from server to client. The non- 744 synchronizing literal is distinguished from the synchronizing literal 745 by having a plus ("+") between the octet count and the closing brace 746 ("}"). The server does not generate a command continuation request 747 in response to a non-synchronizing literal, and clients are not 748 required to wait before sending the octets of a non- synchronizing 749 literal. Non-synchronizing literals MUST NOT be larger than 4096 750 octets. Any literal larger than 4096 bytes MUST be sent as a 751 synchronizing literal. (Non-synchronizing literals defined in this 752 document are the same as non-synchronizing literals defined by the 753 LITERAL- extension from [RFC7888]. See that document for details on 754 how to handle invalid non-synchronizing literals longer than 4096 755 octets and for interaction with other IMAP extensions.) 757 A quoted string is a sequence of zero or more Unicode characters, 758 excluding CR and LF, encoded in UTF-8, with double quote (<">) 759 characters at each end. 761 The empty string is represented as "" (a quoted string with zero 762 characters between double quotes), as {0} followed by CRLF (a 763 synchronizing literal with an octet count of 0) or as {0+} followed 764 by CRLF (a non-synchronizing literal with an octet count of 0). 766 Note: Even if the octet count is 0, a client transmitting a 767 synchronizing literal MUST wait to receive a command continuation 768 request. 770 4.3.1. 8-bit and Binary Strings 772 8-bit textual and binary mail is supported through the use of a 773 [MIME-IMB] content transfer encoding. IMAP4rev2 implementations MAY 774 transmit 8-bit or multi-octet characters in literals, but SHOULD do 775 so only when the [CHARSET] is identified. 777 IMAP4rev2 is compatible with [I18N-HDRS]. As a result, the 778 identified charset for header-field values with 8-bit content is 779 UTF-8 [UTF-8]. IMAP4rev2 implementations MUST accept and MAY 780 transmit [UTF-8] text in quoted-strings as long as the string does 781 not contain NUL, CR, or LF. This differs from IMAP4rev1 782 implementations. 784 Although a BINARY content transfer encoding is defined, unencoded 785 binary strings are not permitted, unless returned in a in 786 response to BINARY.PEEK[]<> or 787 BINARY[]<> FETCH data item. A "binary 788 string" is any string with NUL characters. A string with an 789 excessive amount of CTL characters MAY also be considered to be 790 binary. Unless returned in response to BINARY.PEEK[...]/BINARY[...] 791 FETCH, client and server implementations MUST encode binary data into 792 a textual form, such as BASE64, before transmitting the data. 794 4.4. Parenthesized List 796 Data structures are represented as a "parenthesized list"; a sequence 797 of data items, delimited by space, and bounded at each end by 798 parentheses. A parenthesized list can contain other parenthesized 799 lists, using multiple levels of parentheses to indicate nesting. 801 The empty list is represented as () -- a parenthesized list with no 802 members. 804 4.5. NIL 806 The special form "NIL" represents the non-existence of a particular 807 data item that is represented as a string or parenthesized list, as 808 distinct from the empty string "" or the empty parenthesized list (). 810 Note: NIL is never used for any data item which takes the form of 811 an atom. For example, a mailbox name of "NIL" is a mailbox named 812 NIL as opposed to a non-existent mailbox name. This is because 813 mailbox uses "astring" syntax which is an atom or a string. 814 Conversely, an addr-name of NIL is a non-existent personal name, 815 because addr-name uses "nstring" syntax which is NIL or a string, 816 but never an atom. 818 5. Operational Considerations 820 The following rules are listed here to ensure that all IMAP4rev2 821 implementations interoperate properly. 823 5.1. Mailbox Naming 825 In IMAP4rev2, Mailbox names are encoded in Net-Unicode [NET-UNICODE] 826 (this differs from IMAP4rev1). Client implementations MAY attempt to 827 create Net-Unicode mailbox names, and MUST interpret any 8-bit 828 mailbox names returned by LIST or LSUB as [NET-UNICODE]. Server 829 implementations MUST prohibit the creation of 8-bit mailbox names 830 that do not comply with Net-Unicode (however, servers MAY accept a 831 de-normalized UTF-8 mailbox name and convert it to Net-Unicode prior 832 to mailbox creation). 834 The case-insensitive mailbox name INBOX is a special name reserved to 835 mean "the primary mailbox for this user on this server". (Note that 836 this special name may not exist on some servers for some users.) The 837 interpretation of all other names is implementation-dependent. 839 In particular, this specification takes no position on case 840 sensitivity in non-INBOX mailbox names. Some server implementations 841 are fully case-sensitive in ASCII range; others preserve case of a 842 newly-created name but otherwise are case-insensitive; and yet others 843 coerce names to a particular case. Client implementations MUST 844 interact with any of these. 846 There are certain client considerations when creating a new mailbox 847 name: 849 1. Any character which is one of the atom-specials (see the Formal 850 Syntax) will require that the mailbox name be represented as a 851 quoted string or literal. 853 2. CTL and other non-graphic characters are difficult to represent 854 in a user interface and are best avoided. Servers MAY refuse to 855 create mailbox names containing Unicode CTL characters. 857 3. Although the list-wildcard characters ("%" and "*") are valid in 858 a mailbox name, it is difficult to use such mailbox names with 859 the LIST and LSUB commands due to the conflict with wildcard 860 interpretation. 862 4. Usually, a character (determined by the server implementation) is 863 reserved to delimit levels of hierarchy. 865 5. Two characters, "#" and "&", have meanings by convention, and 866 should be avoided except when used in that convention. 868 5.1.1. Mailbox Hierarchy Naming 870 If it is desired to export hierarchical mailbox names, mailbox names 871 MUST be left-to-right hierarchical using a single character to 872 separate levels of hierarchy. The same hierarchy separator character 873 is used for all levels of hierarchy within a single name. 875 5.1.2. Namespaces 877 Personal Namespace: A namespace that the server considers within the 878 personal scope of the authenticated user on a particular connection. 879 Typically, only the authenticated user has access to mailboxes in 880 their Personal Namespace. It is the part of the namespace that 881 belongs to the user that is allocated for mailboxes. If an INBOX 882 exists for a user, it MUST appear within the user's personal 883 namespace. In the typical case, there SHOULD be only one Personal 884 Namespace on a server. 886 Other Users' Namespace: A namespace that consists of mailboxes from 887 the Personal Namespaces of other users. To access mailboxes in the 888 Other Users' Namespace, the currently authenticated user MUST be 889 explicitly granted access rights. For example, it is common for a 890 manager to grant to their secretary access rights to their mailbox. 891 In the typical case, there SHOULD be only one Other Users' Namespace 892 on a server. 894 Shared Namespace: A namespace that consists of mailboxes that are 895 intended to be shared amongst users and do not exist within a user's 896 Personal Namespace. 898 The namespaces a server uses MAY differ on a per-user basis. 900 5.1.2.1. Historic Mailbox Namespace Naming Convention 902 By convention, the first hierarchical element of any mailbox name 903 which begins with "#" identifies the "namespace" of the remainder of 904 the name. This makes it possible to disambiguate between different 905 types of mailbox stores, each of which have their own namespaces. 907 For example, implementations which offer access to USENET 908 newsgroups MAY use the "#news" namespace to partition the USENET 909 newsgroup namespace from that of other mailboxes. Thus, the 910 comp.mail.misc newsgroup would have a mailbox name of 911 "#news.comp.mail.misc", and the name "comp.mail.misc" can refer to 912 a different object (e.g., a user's private mailbox). 914 Namespaces that include the "#" character are not IMAP URL [IMAP-URL] 915 friendly requiring the "#" character to be represented as %23 when 916 within URLs. As such, server implementers MAY instead consider using 917 namespace prefixes that do not contain the "#" character. 919 5.1.2.2. Common namespace models 921 Previous version of this protocol does not define a default server 922 namespace. Two common namespace models have evolved: 924 The "Personal Mailbox" model, in which the default namespace that is 925 presented consists of only the user's personal mailboxes. To access 926 shared mailboxes, the user must use an escape mechanism to reach 927 another namespace. 929 The "Complete Hierarchy" model, in which the default namespace that 930 is presented includes the user's personal mailboxes along with any 931 other mailboxes they have access to. 933 5.2. Mailbox Size and Message Status Updates 935 At any time, a server can send data that the client did not request. 936 Sometimes, such behavior is REQUIRED. For example, agents other than 937 the server MAY add messages to the mailbox (e.g., new message 938 delivery), change the flags of the messages in the mailbox (e.g., 939 simultaneous access to the same mailbox by multiple agents), or even 940 remove messages from the mailbox. A server MUST send mailbox size 941 updates automatically if a mailbox size change is observed during the 942 processing of a command. A server SHOULD send message flag updates 943 automatically, without requiring the client to request such updates 944 explicitly. 946 Special rules exist for server notification of a client about the 947 removal of messages to prevent synchronization errors; see the 948 description of the EXPUNGE response for more detail. In particular, 949 it is NOT permitted to send an EXISTS response that would reduce the 950 number of messages in the mailbox; only the EXPUNGE response can do 951 this. 953 Regardless of what implementation decisions a client makes on 954 remembering data from the server, a client implementation MUST record 955 mailbox size updates. It MUST NOT assume that any command after the 956 initial mailbox selection will return the size of the mailbox. 958 5.3. Response when no Command in Progress 960 Server implementations are permitted to send an untagged response 961 (except for EXPUNGE) while there is no command in progress. Server 962 implementations that send such responses MUST deal with flow control 963 considerations. Specifically, they MUST either (1) verify that the 964 size of the data does not exceed the underlying transport's available 965 window size, or (2) use non-blocking writes. 967 5.4. Autologout Timer 969 If a server has an inactivity autologout timer that applies to 970 sessions after authentication, the duration of that timer MUST be at 971 least 30 minutes. The receipt of ANY command from the client during 972 that interval SHOULD suffice to reset the autologout timer. 974 5.5. Multiple Commands in Progress (Command Pipelining) 976 The client MAY send another command without waiting for the 977 completion result response of a command, subject to ambiguity rules 978 (see below) and flow control constraints on the underlying data 979 stream. Similarly, a server MAY begin processing another command 980 before processing the current command to completion, subject to 981 ambiguity rules. However, any command continuation request responses 982 and command continuations MUST be negotiated before any subsequent 983 command is initiated. 985 The exception is if an ambiguity would result because of a command 986 that would affect the results of other commands. Clients MUST NOT 987 send multiple commands without waiting if an ambiguity would result. 988 If the server detects a possible ambiguity, it MUST execute commands 989 to completion in the order given by the client. 991 The most obvious example of ambiguity is when a command would affect 992 the results of another command, e.g., a FETCH of a message's flags 993 and a STORE of that same message's flags. 995 A non-obvious ambiguity occurs with commands that permit an untagged 996 EXPUNGE response (commands other than FETCH, STORE, and SEARCH), 997 since an untagged EXPUNGE response can invalidate sequence numbers in 998 a subsequent command. This is not a problem for FETCH, STORE, or 999 SEARCH commands because servers are prohibited from sending EXPUNGE 1000 responses while any of those commands are in progress. Therefore, if 1001 the client sends any command other than FETCH, STORE, or SEARCH, it 1002 MUST wait for the completion result response before sending a command 1003 with message sequence numbers. 1005 Note: EXPUNGE responses are permitted while UID FETCH, UID STORE, 1006 and UID SEARCH are in progress. If the client sends a UID 1007 command, it MUST wait for a completion result response before 1008 sending a command which uses message sequence numbers (this may 1009 include UID SEARCH). Any message sequence numbers in an argument 1010 to UID SEARCH are associated with messages prior to the effect of 1011 any untagged EXPUNGE returned by the UID SEARCH. 1013 For example, the following non-waiting command sequences are invalid: 1015 FETCH + NOOP + STORE 1017 STORE + COPY + FETCH 1019 COPY + COPY 1021 CHECK + FETCH 1023 The following are examples of valid non-waiting command sequences: 1025 FETCH + STORE + SEARCH + CHECK 1027 STORE + COPY + EXPUNGE 1029 UID SEARCH + UID SEARCH may be valid or invalid as a non-waiting 1030 command sequence, depending upon whether or not the second UID 1031 SEARCH contains message sequence numbers. 1033 6. Client Commands 1035 IMAP4rev2 commands are described in this section. Commands are 1036 organized by the state in which the command is permitted. Commands 1037 which are permitted in multiple states are listed in the minimum 1038 permitted state (for example, commands valid in authenticated and 1039 selected state are listed in the authenticated state commands). 1041 Command arguments, identified by "Arguments:" in the command 1042 descriptions below, are described by function, not by syntax. The 1043 precise syntax of command arguments is described in the Formal Syntax 1044 (Section 9). 1046 Some commands cause specific server responses to be returned; these 1047 are identified by "Responses:" in the command descriptions below. 1048 See the response descriptions in the Responses section for 1049 information on these responses, and the Formal Syntax section for the 1050 precise syntax of these responses. It is possible for server data to 1051 be transmitted as a result of any command. Thus, commands that do 1052 not specifically require server data specify "no specific responses 1053 for this command" instead of "none". 1055 The "Result:" in the command description refers to the possible 1056 tagged status responses to a command, and any special interpretation 1057 of these status responses. 1059 The state of a connection is only changed by successful commands 1060 which are documented as changing state. A rejected command (BAD 1061 response) never changes the state of the connection or of the 1062 selected mailbox. A failed command (NO response) generally does not 1063 change the state of the connection or of the selected mailbox; the 1064 exception being the SELECT and EXAMINE commands. 1066 6.1. Client Commands - Any State 1068 The following commands are valid in any state: CAPABILITY, NOOP, and 1069 LOGOUT. 1071 6.1.1. CAPABILITY Command 1073 Arguments: none 1075 Responses: REQUIRED untagged response: CAPABILITY 1077 Result: OK - capability completed 1078 BAD - command unknown or arguments invalid 1080 The CAPABILITY command requests a listing of capabilities that the 1081 server supports. The server MUST send a single untagged CAPABILITY 1082 response with "IMAP4rev2" as one of the listed capabilities before 1083 the (tagged) OK response. 1085 A capability name which begins with "AUTH=" indicates that the server 1086 supports that particular authentication mechanism. All such names 1087 are, by definition, part of this specification. For example, the 1088 authorization capability for an experimental "blurdybloop" 1089 authenticator would be "AUTH=XBLURDYBLOOP" and not 1090 "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP". 1092 Other capability names refer to extensions, revisions, or amendments 1093 to this specification. See the documentation of the CAPABILITY 1094 response for additional information. No capabilities, beyond the 1095 base IMAP4rev2 set defined in this specification, are enabled without 1096 explicit client action to invoke the capability. 1098 Client and server implementations MUST implement the STARTTLS, 1099 LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) capabilities. 1100 See the Security Considerations section for important information. 1102 See the section entitled "Client Commands - Experimental/Expansion" 1103 for information about the form of site or implementation-specific 1104 capabilities. 1106 Example: C: abcd CAPABILITY 1107 S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI 1108 LOGINDISABLED 1109 S: abcd OK CAPABILITY completed 1110 C: efgh STARTTLS 1111 S: efgh OK STARTLS completed 1112 1113 C: ijkl CAPABILITY 1114 S: * CAPABILITY IMAP4rev2 AUTH=GSSAPI AUTH=PLAIN 1115 S: ijkl OK CAPABILITY completed 1117 6.1.2. NOOP Command 1119 Arguments: none 1121 Responses: no specific responses for this command (but see below) 1123 Result: OK - noop completed 1124 BAD - command unknown or arguments invalid 1126 The NOOP command always succeeds. It does nothing. 1128 Since any command can return a status update as untagged data, the 1129 NOOP command can be used as a periodic poll for new messages or 1130 message status updates during a period of inactivity (this is the 1131 preferred method to do this). The NOOP command can also be used to 1132 reset any inactivity autologout timer on the server. 1134 Example: C: a002 NOOP 1135 S: a002 OK NOOP completed 1136 . . . 1137 C: a047 NOOP 1138 S: * 22 EXPUNGE 1139 S: * 23 EXISTS 1140 S: * 14 FETCH (UID 1305 FLAGS (\Seen \Deleted)) 1141 S: a047 OK NOOP completed 1143 6.1.3. LOGOUT Command 1145 Arguments: none 1147 Responses: REQUIRED untagged response: BYE 1149 Result: OK - logout completed 1150 BAD - command unknown or arguments invalid 1152 The LOGOUT command informs the server that the client is done with 1153 the connection. The server MUST send a BYE untagged response before 1154 the (tagged) OK response, and then close the network connection. 1156 Example: C: A023 LOGOUT 1157 S: * BYE IMAP4rev2 Server logging out 1158 S: A023 OK LOGOUT completed 1159 (Server and client then close the connection) 1161 6.2. Client Commands - Not Authenticated State 1163 In the not authenticated state, the AUTHENTICATE or LOGIN command 1164 establishes authentication and enters the authenticated state. The 1165 AUTHENTICATE command provides a general mechanism for a variety of 1166 authentication techniques, privacy protection, and integrity 1167 checking; whereas the LOGIN command uses a traditional user name and 1168 plaintext password pair and has no means of establishing privacy 1169 protection or integrity checking. 1171 The STARTTLS command is an alternate form of establishing session 1172 privacy protection and integrity checking, but does not by itself 1173 establish authentication or enter the authenticated state. 1175 Server implementations MAY allow access to certain mailboxes without 1176 establishing authentication. This can be done by means of the 1177 ANONYMOUS [SASL] authenticator described in [ANONYMOUS]. An older 1178 convention is a LOGIN command using the userid "anonymous"; in this 1179 case, a password is required although the server may choose to accept 1180 any password. The restrictions placed on anonymous users are 1181 implementation-dependent. 1183 Once authenticated (including as anonymous), it is not possible to 1184 re-enter not authenticated state. 1186 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1187 the following commands are valid in the not authenticated state: 1188 STARTTLS, AUTHENTICATE and LOGIN. See the Security Considerations 1189 section for important information about these commands. 1191 6.2.1. STARTTLS Command 1193 Arguments: none 1195 Responses: no specific response for this command 1197 Result: OK - starttls completed, begin TLS negotiation 1198 BAD - command unknown or arguments invalid 1200 A [TLS] negotiation begins immediately after the CRLF at the end of 1201 the tagged OK response from the server. Once a client issues a 1202 STARTTLS command, it MUST NOT issue further commands until a server 1203 response is seen and the [TLS] negotiation is complete. 1205 The server remains in the non-authenticated state, even if client 1206 credentials are supplied during the [TLS] negotiation. This does not 1207 preclude an authentication mechanism such as EXTERNAL (defined in 1208 [SASL]) from using client identity determined by the [TLS] 1209 negotiation. 1211 Once [TLS] has been started, the client MUST discard cached 1212 information about server capabilities and SHOULD re-issue the 1213 CAPABILITY command. This is necessary to protect against man-in- 1214 the-middle attacks which alter the capabilities list prior to 1215 STARTTLS. The server MAY advertise different capabilities, and in 1216 particular SHOULD NOT advertise the STARTTLS capability, after a 1217 successful STARTTLS command. 1219 Example: C: a001 CAPABILITY 1220 S: * CAPABILITY IMAP4rev2 STARTTLS LOGINDISABLED 1221 S: a001 OK CAPABILITY completed 1222 C: a002 STARTTLS 1223 S: a002 OK Begin TLS negotiation now 1224 1225 C: a003 CAPABILITY 1226 S: * CAPABILITY IMAP4rev2 AUTH=PLAIN 1227 S: a003 OK CAPABILITY completed 1228 C: a004 LOGIN joe password 1229 S: a004 OK LOGIN completed 1231 6.2.2. AUTHENTICATE Command 1233 Arguments: SASL authentication mechanism name 1234 OPTIONAL initial response 1236 Responses: continuation data can be requested 1238 Result: OK - authenticate completed, now in authenticated state 1239 NO - authenticate failure: unsupported authentication 1240 mechanism, credentials rejected 1241 BAD - command unknown or arguments invalid, 1242 authentication exchange cancelled 1244 The AUTHENTICATE command indicates a [SASL] authentication mechanism 1245 to the server. If the server supports the requested authentication 1246 mechanism, it performs an authentication protocol exchange to 1247 authenticate and identify the client. It MAY also negotiate an 1248 OPTIONAL security layer for subsequent protocol interactions. If the 1249 requested authentication mechanism is not supported, the server 1250 SHOULD reject the AUTHENTICATE command by sending a tagged NO 1251 response. 1253 The AUTHENTICATE command supports the optional "initial response" 1254 feature defined in Section 5.1 of [SASL]. The client doesn't need to 1255 use it. If a SASL mechanism supports "initial response", but it is 1256 not specified by the client, the server handles this as specified in 1257 Section 3 of [SASL]. 1259 The service name specified by this protocol's profile of [SASL] is 1260 "imap". 1262 The authentication protocol exchange consists of a series of server 1263 challenges and client responses that are specific to the 1264 authentication mechanism. A server challenge consists of a command 1265 continuation request response with the "+" token followed by a BASE64 1266 encoded (see Section 4 of [RFC4648]) string. The client response 1267 consists of a single line consisting of a BASE64 encoded string. If 1268 the client wishes to cancel an authentication exchange, it issues a 1269 line consisting of a single "*". If the server receives such a 1270 response, or if it receives an invalid BASE64 string (e.g. 1271 characters outside the BASE64 alphabet, or non-terminal "="), it MUST 1272 reject the AUTHENTICATE command by sending a tagged BAD response. 1274 As with any other client response, this initial response MUST be 1275 encoded as BASE64. It also MUST be transmitted outside of a quoted 1276 string or literal. To send a zero-length initial response, the 1277 client MUST send a single pad character ("="). This indicates that 1278 the response is present, but is a zero-length string. 1280 When decoding the BASE64 data in the initial response, decoding 1281 errors MUST be treated as in any normal SASL client response, i.e. 1282 with a tagged BAD response. In particular, the server should check 1283 for any characters not explicitly allowed by the BASE64 alphabet, as 1284 well as any sequence of BASE64 characters that contains the pad 1285 character ('=') anywhere other than the end of the string (e.g., 1286 "=AAA" and "AAA=BBB" are not allowed). 1288 If the client uses an initial response with a SASL mechanism that 1289 does not support an initial response, the server MUST reject the 1290 command with a tagged BAD response. 1292 If a security layer is negotiated through the [SASL] authentication 1293 exchange, it takes effect immediately following the CRLF that 1294 concludes the authentication exchange for the client, and the CRLF of 1295 the tagged OK response for the server. 1297 While client and server implementations MUST implement the 1298 AUTHENTICATE command itself, it is not required to implement any 1299 authentication mechanisms other than the PLAIN mechanism described in 1300 [PLAIN]. Also, an authentication mechanism is not required to 1301 support any security layers. 1303 Note: a server implementation MUST implement a configuration in 1304 which it does NOT permit any plaintext password mechanisms, unless 1305 either the STARTTLS command has been negotiated or some other 1306 mechanism that protects the session from password snooping has 1307 been provided. Server sites SHOULD NOT use any configuration 1308 which permits a plaintext password mechanism without such a 1309 protection mechanism against password snooping. Client and server 1310 implementations SHOULD implement additional [SASL] mechanisms that 1311 do not use plaintext passwords, such the GSSAPI mechanism 1312 described in [SASL] and/or the [DIGEST-MD5] mechanism. 1314 Servers and clients can support multiple authentication mechanisms. 1315 The server SHOULD list its supported authentication mechanisms in the 1316 response to the CAPABILITY command so that the client knows which 1317 authentication mechanisms to use. 1319 A server MAY include a CAPABILITY response code in the tagged OK 1320 response of a successful AUTHENTICATE command in order to send 1321 capabilities automatically. It is unnecessary for a client to send a 1322 separate CAPABILITY command if it recognizes these automatic 1323 capabilities. This should only be done if a security layer was not 1324 negotiated by the AUTHENTICATE command, because the tagged OK 1325 response as part of an AUTHENTICATE command is not protected by 1326 encryption/integrity checking. [SASL] requires the client to re- 1327 issue a CAPABILITY command in this case. The server MAY advertise 1328 different capabilities after a successful AUTHENTICATE command. 1330 If an AUTHENTICATE command fails with a NO response, the client MAY 1331 try another authentication mechanism by issuing another AUTHENTICATE 1332 command. It MAY also attempt to authenticate by using the LOGIN 1333 command (see Section 6.2.3 for more detail). In other words, the 1334 client MAY request authentication types in decreasing order of 1335 preference, with the LOGIN command as a last resort. 1337 The authorization identity passed from the client to the server 1338 during the authentication exchange is interpreted by the server as 1339 the user name whose privileges the client is requesting. 1341 Example: S: * OK IMAP4rev2 Server 1342 C: A001 AUTHENTICATE GSSAPI 1343 S: + 1344 C: YIIB+wYJKoZIhvcSAQICAQBuggHqMIIB5qADAgEFoQMCAQ6iBw 1345 MFACAAAACjggEmYYIBIjCCAR6gAwIBBaESGxB1Lndhc2hpbmd0 1346 b24uZWR1oi0wK6ADAgEDoSQwIhsEaW1hcBsac2hpdmFtcy5jYW 1347 Mud2FzaGluZ3Rvbi5lZHWjgdMwgdCgAwIBAaEDAgEDooHDBIHA 1348 cS1GSa5b+fXnPZNmXB9SjL8Ollj2SKyb+3S0iXMljen/jNkpJX 1349 AleKTz6BQPzj8duz8EtoOuNfKgweViyn/9B9bccy1uuAE2HI0y 1350 C/PHXNNU9ZrBziJ8Lm0tTNc98kUpjXnHZhsMcz5Mx2GR6dGknb 1351 I0iaGcRerMUsWOuBmKKKRmVMMdR9T3EZdpqsBd7jZCNMWotjhi 1352 vd5zovQlFqQ2Wjc2+y46vKP/iXxWIuQJuDiisyXF0Y8+5GTpAL 1353 pHDc1/pIGmMIGjoAMCAQGigZsEgZg2on5mSuxoDHEA1w9bcW9n 1354 FdFxDKpdrQhVGVRDIzcCMCTzvUboqb5KjY1NJKJsfjRQiBYBdE 1355 NKfzK+g5DlV8nrw81uOcP8NOQCLR5XkoMHC0Dr/80ziQzbNqhx 1356 O6652Npft0LQwJvenwDI13YxpwOdMXzkWZN/XrEqOWp6GCgXTB 1357 vCyLWLlWnbaUkZdEYbKHBPjd8t/1x5Yg== 1358 S: + YGgGCSqGSIb3EgECAgIAb1kwV6ADAgEFoQMCAQ+iSzBJoAMC 1359 AQGiQgRAtHTEuOP2BXb9sBYFR4SJlDZxmg39IxmRBOhXRKdDA0 1360 uHTCOT9Bq3OsUTXUlk0CsFLoa8j+gvGDlgHuqzWHPSQg== 1361 C: 1362 S: + YDMGCSqGSIb3EgECAgIBAAD/////6jcyG4GE3KkTzBeBiVHe 1363 ceP2CWY0SR0fAQAgAAQEBAQ= 1364 C: YDMGCSqGSIb3EgECAgIBAAD/////3LQBHXTpFfZgrejpLlLImP 1365 wkhbfa2QteAQAgAG1yYwE= 1366 S: A001 OK GSSAPI authentication successful 1368 Note: The line breaks within server challenges and client responses 1369 are for editorial clarity and are not in real authenticators. 1371 6.2.3. LOGIN Command 1373 Arguments: user name 1374 password 1376 Responses: no specific responses for this command 1378 Result: OK - login completed, now in authenticated state 1379 NO - login failure: user name or password rejected 1380 BAD - command unknown or arguments invalid 1382 The LOGIN command identifies the client to the server and carries the 1383 plaintext password authenticating this user. 1385 A server MAY include a CAPABILITY response code in the tagged OK 1386 response to a successful LOGIN command in order to send capabilities 1387 automatically. It is unnecessary for a client to send a separate 1388 CAPABILITY command if it recognizes these automatic capabilities. 1390 Example: C: a001 LOGIN SMITH SESAME 1391 S: a001 OK LOGIN completed 1393 Note: Use of the LOGIN command over an insecure network (such as the 1394 Internet) is a security risk, because anyone monitoring network 1395 traffic can obtain plaintext passwords. The LOGIN command SHOULD NOT 1396 be used except as a last resort, and it is recommended that client 1397 implementations have a means to disable any automatic use of the 1398 LOGIN command. 1400 Unless either the client is accessing IMAP service on IMAPS port 1401 [RFC8314], the STARTTLS command has been negotiated or some other 1402 mechanism that protects the session from password snooping has been 1403 provided, a server implementation MUST implement a configuration in 1404 which it advertises the LOGINDISABLED capability and does NOT permit 1405 the LOGIN command. Server sites SHOULD NOT use any configuration 1406 which permits the LOGIN command without such a protection mechanism 1407 against password snooping. A client implementation MUST NOT send a 1408 LOGIN command if the LOGINDISABLED capability is advertised. 1410 6.3. Client Commands - Authenticated State 1412 In the authenticated state, commands that manipulate mailboxes as 1413 atomic entities are permitted. Of these commands, the SELECT and 1414 EXAMINE commands will select a mailbox for access and enter the 1415 selected state. 1417 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1418 the following commands are valid in the authenticated state: ENABLE, 1419 SELECT, EXAMINE, NAMESPACE, CREATE, DELETE, RENAME, SUBSCRIBE, 1420 UNSUBSCRIBE, LIST, LSUB, STATUS, APPEND and IDLE. 1422 6.3.1. ENABLE Command 1424 Arguments: capability names 1426 Responses: no specific responses for this command 1428 Result: OK - Relevant capabilities enabled 1429 BAD - No arguments, or syntax error in an argument 1431 Several IMAP extensions allow the server to return unsolicited 1432 responses specific to these extensions in certain circumstances. 1433 However, servers cannot send those unsolicited responses (with the 1434 exception of response codes included in tagged or untagged OK/NO/BAD 1435 responses, which can always be sent) until they know that the clients 1436 support such extensions and thus won't choke on the extension 1437 response data. 1439 The ENABLE command provides an explicit indication from the client 1440 that it supports particular extensions. 1442 The ENABLE command takes a list of capability names, and requests the 1443 server to enable the named extensions. Once enabled using ENABLE, 1444 each extension remains active until the IMAP connection is closed. 1445 For each argument, the server does the following: 1447 o If the argument is not an extension known to the server, the 1448 server MUST ignore the argument. 1450 o If the argument is an extension known to the server, and it is not 1451 specifically permitted to be enabled using ENABLE, the server MUST 1452 ignore the argument. (Note that knowing about an extension 1453 doesn't necessarily imply supporting that extension.) 1455 o If the argument is an extension that is supported by the server 1456 and that needs to be enabled, the server MUST enable the extension 1457 for the duration of the connection. Note that once an extension 1458 is enabled, there is no way to disable it. 1460 If the ENABLE command is successful, the server MUST send an untagged 1461 ENABLED response Section 7.2.1. 1463 Clients SHOULD only include extensions that need to be enabled by the 1464 server. For example, a client can enable IMAP4rev2 specific 1465 behaviour when both IMAP4rev1 and IMAP4rev2 are advertised in the 1466 CAPABILITY response. Future RFCs may add to this list. 1468 The ENABLE command is only valid in the authenticated state, before 1469 any mailbox is selected. Clients MUST NOT issue ENABLE once they 1470 SELECT/EXAMINE a mailbox; however, server implementations don't have 1471 to check that no mailbox is selected or was previously selected 1472 during the duration of a connection. 1474 The ENABLE command can be issued multiple times in a session. It is 1475 additive; i.e., "ENABLE a b", followed by "ENABLE c" is the same as a 1476 single command "ENABLE a b c". When multiple ENABLE commands are 1477 issued, each corresponding ENABLED response SHOULD only contain 1478 extensions enabled by the corresponding ENABLE command. 1480 There are no limitations on pipelining ENABLE. For example, it is 1481 possible to send ENABLE and then immediately SELECT, or a LOGIN 1482 immediately followed by ENABLE. 1484 The server MUST NOT change the CAPABILITY list as a result of 1485 executing ENABLE; i.e., a CAPABILITY command issued right after an 1486 ENABLE command MUST list the same capabilities as a CAPABILITY 1487 command issued before the ENABLE command. This is demonstrated in 1488 the following example: 1490 C: t1 CAPABILITY 1491 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1492 S: t1 OK foo 1493 C: t2 ENABLE CONDSTORE X-GOOD-IDEA 1494 S: * ENABLED X-GOOD-IDEA 1495 S: t2 OK foo 1496 C: t3 CAPABILITY 1497 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1498 S: t3 OK foo again 1500 In the following example, the client enables CONDSTORE: 1502 C: a1 ENABLE CONDSTORE 1503 S: * ENABLED CONDSTORE 1504 S: a1 OK Conditional Store enabled 1506 6.3.1.1. Note to Designers of Extensions That May Use the ENABLE 1507 Command 1509 Designers of IMAP extensions are discouraged from creating extensions 1510 that require ENABLE unless there is no good alternative design. 1511 Specifically, extensions that cause potentially incompatible behavior 1512 changes to deployed server responses (and thus benefit from ENABLE) 1513 have a higher complexity cost than extensions that do not. 1515 6.3.2. SELECT Command 1517 Arguments: mailbox name 1519 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1520 REQUIRED OK untagged responses: PERMANENTFLAGS, 1521 UIDNEXT, UIDVALIDITY 1523 Result: OK - select completed, now in selected state 1524 NO - select failure, now in authenticated state: no 1525 such mailbox, can't access mailbox 1526 BAD - command unknown or arguments invalid 1528 The SELECT command selects a mailbox so that messages in the mailbox 1529 can be accessed. Before returning an OK to the client, the server 1530 MUST send the following untagged data to the client. Note that 1531 earlier versions of this protocol only required the FLAGS and EXISTS 1532 untagged data; consequently, client implementations SHOULD implement 1533 default behavior for missing data as discussed with the individual 1534 item. 1536 FLAGS Defined flags in the mailbox. See the description of the 1537 FLAGS response for more detail. 1539 EXISTS The number of messages in the mailbox. See the 1540 description of the EXISTS response for more detail. 1542 OK [PERMANENTFLAGS ()] A list of message flags that 1543 the client can change permanently. If this is missing, the client 1544 should assume that all flags can be changed permanently. 1546 OK [UIDNEXT ] The next unique identifier value. Refer to 1547 Section 2.3.1.1 for more information. If this is missing, the 1548 client can not make any assumptions about the next unique 1549 identifier value. 1551 OK [UIDVALIDITY ] The unique identifier validity value. Refer to 1552 Section 2.3.1.1 for more information. If this is missing, the 1553 server does not support unique identifiers. 1555 Only one mailbox can be selected at a time in a connection; 1556 simultaneous access to multiple mailboxes requires multiple 1557 connections. The SELECT command automatically deselects any 1558 currently selected mailbox before attempting the new selection. 1559 Consequently, if a mailbox is selected and a SELECT command that 1560 fails is attempted, no mailbox is selected. When deselecting a 1561 selected mailbox, the server MUST return an untagged OK response with 1562 the "[CLOSED]" response code when the currently selected mailbox is 1563 closed (see Paragraph 10). 1565 If the client is permitted to modify the mailbox, the server SHOULD 1566 prefix the text of the tagged OK response with the "[READ-WRITE]" 1567 response code. 1569 If the client is not permitted to modify the mailbox but is permitted 1570 read access, the mailbox is selected as read-only, and the server 1571 MUST prefix the text of the tagged OK response to SELECT with the 1572 "[READ-ONLY]" response code. Read-only access through SELECT differs 1573 from the EXAMINE command in that certain read-only mailboxes MAY 1574 permit the change of permanent state on a per-user (as opposed to 1575 global) basis. Netnews messages marked in a server-based .newsrc 1576 file are an example of such per-user permanent state that can be 1577 modified with read-only mailboxes. 1579 Example: C: A142 SELECT INBOX 1580 S: * 172 EXISTS 1581 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1582 S: * OK [UIDNEXT 4392] Predicted next UID 1583 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1584 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited 1585 S: A142 OK [READ-WRITE] SELECT completed 1587 6.3.3. EXAMINE Command 1589 Arguments: mailbox name 1591 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1592 REQUIRED OK untagged responses: PERMANENTFLAGS, 1593 UIDNEXT, UIDVALIDITY 1595 Result: OK - examine completed, now in selected state 1596 NO - examine failure, now in authenticated state: no 1597 such mailbox, can't access mailbox BAD - command unknown 1598 or arguments invalid 1600 The EXAMINE command is identical to SELECT and returns the same 1601 output; however, the selected mailbox is identified as read-only. No 1602 changes to the permanent state of the mailbox, including per-user 1603 state, are permitted. 1605 The text of the tagged OK response to the EXAMINE command MUST begin 1606 with the "[READ-ONLY]" response code. 1608 Example: C: A932 EXAMINE blurdybloop 1609 S: * 17 EXISTS 1610 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1611 S: * OK [UIDNEXT 4392] Predicted next UID 1612 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1613 S: * OK [PERMANENTFLAGS ()] No permanent flags permitted 1614 S: A932 OK [READ-ONLY] EXAMINE completed 1616 6.3.4. CREATE Command 1618 Arguments: mailbox name 1620 Responses: no specific responses for this command 1622 Result: OK - create completed 1623 NO - create failure: can't create mailbox with that name 1624 BAD - command unknown or arguments invalid 1626 The CREATE command creates a mailbox with the given name. An OK 1627 response is returned only if a new mailbox with that name has been 1628 created. It is an error to attempt to create INBOX or a mailbox with 1629 a name that refers to an extant mailbox. Any error in creation will 1630 return a tagged NO response. If a client attempts to create a UTF-8 1631 mailbox name that is not a valid Net-Unicode name, the server MUST 1632 reject the creation or convert the name to Net-Unicode prior to 1633 creating the mailbox. 1635 If the mailbox name is suffixed with the server's hierarchy separator 1636 character (as returned from the server by a LIST command), this is a 1637 declaration that the client intends to create mailbox names under 1638 this name in the hierarchy. Server implementations that do not 1639 require this declaration MUST ignore the declaration. In any case, 1640 the name created is without the trailing hierarchy delimiter. 1642 If the server's hierarchy separator character appears elsewhere in 1643 the name, the server SHOULD create any superior hierarchical names 1644 that are needed for the CREATE command to be successfully completed. 1645 In other words, an attempt to create "foo/bar/zap" on a server in 1646 which "/" is the hierarchy separator character SHOULD create foo/ and 1647 foo/bar/ if they do not already exist. 1649 If a new mailbox is created with the same name as a mailbox which was 1650 deleted, its unique identifiers MUST be greater than any unique 1651 identifiers used in the previous incarnation of the mailbox UNLESS 1652 the new incarnation has a different unique identifier validity value. 1653 See the description of the UID command for more detail. 1655 Example: C: A003 CREATE owatagusiam/ 1656 S: A003 OK CREATE completed 1657 C: A004 CREATE owatagusiam/blurdybloop 1658 S: A004 OK CREATE completed 1660 Note: The interpretation of this example depends on whether "/" 1661 was returned as the hierarchy separator from LIST. If "/" is the 1662 hierarchy separator, a new level of hierarchy named "owatagusiam" 1663 with a member called "blurdybloop" is created. Otherwise, two 1664 mailboxes at the same hierarchy level are created. 1666 6.3.5. DELETE Command 1668 Arguments: mailbox name 1670 Responses: no specific responses for this command 1672 Result: OK - delete completed 1673 NO - delete failure: can't delete mailbox with that name 1674 BAD - command unknown or arguments invalid 1676 The DELETE command permanently removes the mailbox with the given 1677 name. A tagged OK response is returned only if the mailbox has been 1678 deleted. It is an error to attempt to delete INBOX or a mailbox name 1679 that does not exist. 1681 The DELETE command MUST NOT remove inferior hierarchical names. For 1682 example, if a mailbox "foo" has an inferior "foo.bar" (assuming "." 1683 is the hierarchy delimiter character), removing "foo" MUST NOT remove 1684 "foo.bar". It is an error to attempt to delete a name that has 1685 inferior hierarchical names and also has the \Noselect mailbox name 1686 attribute (see the description of the LIST response for more 1687 details). 1689 It is permitted to delete a name that has inferior hierarchical names 1690 and does not have the \Noselect mailbox name attribute. If the 1691 server implementation does not permit deleting the name while 1692 inferior hierarchical names exists the \Noselect mailbox name 1693 attribute is set for that name. In any case, all messages in that 1694 mailbox are removed by the DELETE command. 1696 The value of the highest-used unique identifier of the deleted 1697 mailbox MUST be preserved so that a new mailbox created with the same 1698 name will not reuse the identifiers of the former incarnation, UNLESS 1699 the new incarnation has a different unique identifier validity value. 1700 See the description of the UID command for more detail. 1702 Examples: C: A682 LIST "" * 1703 S: * LIST () "/" blurdybloop 1704 S: * LIST (\Noselect) "/" foo 1705 S: * LIST () "/" foo/bar 1706 S: A682 OK LIST completed 1707 C: A683 DELETE blurdybloop 1708 S: A683 OK DELETE completed 1709 C: A684 DELETE foo 1710 S: A684 NO Name "foo" has inferior hierarchical names 1711 C: A685 DELETE foo/bar 1712 S: A685 OK DELETE Completed 1713 C: A686 LIST "" * 1714 S: * LIST (\Noselect) "/" foo 1715 S: A686 OK LIST completed 1716 C: A687 DELETE foo 1717 S: A687 OK DELETE Completed 1718 C: A82 LIST "" * 1719 S: * LIST () "." blurdybloop 1720 S: * LIST () "." foo 1721 S: * LIST () "." foo.bar 1722 S: A82 OK LIST completed 1723 C: A83 DELETE blurdybloop 1724 S: A83 OK DELETE completed 1725 C: A84 DELETE foo 1726 S: A84 OK DELETE Completed 1727 C: A85 LIST "" * 1728 S: * LIST () "." foo.bar 1729 S: A85 OK LIST completed 1730 C: A86 LIST "" % 1731 S: * LIST (\Noselect) "." foo 1732 S: A86 OK LIST completed 1734 6.3.6. RENAME Command 1736 Arguments: existing mailbox name 1737 new mailbox name 1739 Responses: no specific responses for this command 1741 Result: OK - rename completed 1742 NO - rename failure: can't rename mailbox with that name, 1743 can't rename to mailbox with that name 1744 BAD - command unknown or arguments invalid 1746 The RENAME command changes the name of a mailbox. A tagged OK 1747 response is returned only if the mailbox has been renamed. It is an 1748 error to attempt to rename from a mailbox name that does not exist or 1749 to a mailbox name that already exists. Any error in renaming will 1750 return a tagged NO response. 1752 If the name has inferior hierarchical names, then the inferior 1753 hierarchical names MUST also be renamed. For example, a rename of 1754 "foo" to "zap" will rename "foo/bar" (assuming "/" is the hierarchy 1755 delimiter character) to "zap/bar". 1757 If the server's hierarchy separator character appears in the name, 1758 the server SHOULD create any superior hierarchical names that are 1759 needed for the RENAME command to complete successfully. In other 1760 words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a 1761 server in which "/" is the hierarchy separator character SHOULD 1762 create baz/ and baz/rag/ if they do not already exist. 1764 The value of the highest-used unique identifier of the old mailbox 1765 name MUST be preserved so that a new mailbox created with the same 1766 name will not reuse the identifiers of the former incarnation, UNLESS 1767 the new incarnation has a different unique identifier validity value. 1768 See the description of the UID command for more detail. 1770 Renaming INBOX is permitted, and has special behavior. It moves all 1771 messages in INBOX to a new mailbox with the given name, leaving INBOX 1772 empty. If the server implementation supports inferior hierarchical 1773 names of INBOX, these are unaffected by a rename of INBOX. 1775 Examples: C: A682 LIST "" * 1776 S: * LIST () "/" blurdybloop 1777 S: * LIST (\Noselect) "/" foo 1778 S: * LIST () "/" foo/bar 1779 S: A682 OK LIST completed 1780 C: A683 RENAME blurdybloop sarasoop 1781 S: A683 OK RENAME completed 1782 C: A684 RENAME foo zowie 1783 S: A684 OK RENAME Completed 1784 C: A685 LIST "" * 1785 S: * LIST () "/" sarasoop 1786 S: * LIST (\Noselect) "/" zowie 1787 S: * LIST () "/" zowie/bar 1788 S: A685 OK LIST completed 1790 C: Z432 LIST "" * 1791 S: * LIST () "." INBOX 1792 S: * LIST () "." INBOX.bar 1793 S: Z432 OK LIST completed 1794 C: Z433 RENAME INBOX old-mail 1795 S: Z433 OK RENAME completed 1796 C: Z434 LIST "" * 1797 S: * LIST () "." INBOX 1798 S: * LIST () "." INBOX.bar 1799 S: * LIST () "." old-mail 1800 S: Z434 OK LIST completed 1802 6.3.7. SUBSCRIBE Command 1804 Arguments: mailbox 1806 Responses: no specific responses for this command 1808 Result: OK - subscribe completed 1809 NO - subscribe failure: can't subscribe to that name 1810 BAD - command unknown or arguments invalid 1812 The SUBSCRIBE command adds the specified mailbox name to the server's 1813 set of "active" or "subscribed" mailboxes as returned by the LSUB 1814 command. This command returns a tagged OK response only if the 1815 subscription is successful. 1817 A server MAY validate the mailbox argument to SUBSCRIBE to verify 1818 that it exists. However, it MUST NOT unilaterally remove an existing 1819 mailbox name from the subscription list even if a mailbox by that 1820 name no longer exists. 1822 Note: This requirement is because a server site can choose to 1823 routinely remove a mailbox with a well-known name (e.g., "system- 1824 alerts") after its contents expire, with the intention of 1825 recreating it when new contents are appropriate. 1827 Example: C: A002 SUBSCRIBE #news.comp.mail.mime 1828 S: A002 OK SUBSCRIBE completed 1830 6.3.8. UNSUBSCRIBE Command 1832 Arguments: mailbox name 1834 Responses: no specific responses for this command 1836 Result: OK - unsubscribe completed 1837 NO - unsubscribe failure: can't unsubscribe that name 1838 BAD - command unknown or arguments invalid 1840 The UNSUBSCRIBE command removes the specified mailbox name from the 1841 server's set of "active" or "subscribed" mailboxes as returned by the 1842 LSUB command. This command returns a tagged OK response only if the 1843 unsubscription is successful. 1845 Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime 1846 S: A002 OK UNSUBSCRIBE completed 1848 6.3.9. LIST Command 1850 Arguments: reference name 1851 mailbox name with possible wildcards 1853 Responses: untagged responses: LIST 1855 Result: OK - list completed 1856 NO - list failure: can't list that reference or name 1857 BAD - command unknown or arguments invalid 1859 The LIST command returns a subset of names from the complete set of 1860 all names available to the client. Zero or more untagged LIST 1861 replies are returned, containing the name attributes, hierarchy 1862 delimiter, and name; see the description of the LIST reply for more 1863 detail. 1865 The LIST command SHOULD return its data quickly, without undue delay. 1866 For example, it SHOULD NOT go to excess trouble to calculate the 1867 \Marked or \Unmarked status or perform other processing; if each name 1868 requires 1 second of processing, then a list of 1200 names would take 1869 20 minutes! 1870 An empty ("" string) reference name argument indicates that the 1871 mailbox name is interpreted as by SELECT. The returned mailbox names 1872 MUST match the supplied mailbox name pattern. A non-empty reference 1873 name argument is the name of a mailbox or a level of mailbox 1874 hierarchy, and indicates the context in which the mailbox name is 1875 interpreted. 1877 An empty ("" string) mailbox name argument is a special request to 1878 return the hierarchy delimiter and the root name of the name given in 1879 the reference. The value returned as the root MAY be the empty 1880 string if the reference is non-rooted or is an empty string. In all 1881 cases, a hierarchy delimiter (or NIL if there is no hierarchy) is 1882 returned. This permits a client to get the hierarchy delimiter (or 1883 find out that the mailbox names are flat) even when no mailboxes by 1884 that name currently exist. 1886 The reference and mailbox name arguments are interpreted into a 1887 canonical form that represents an unambiguous left-to-right 1888 hierarchy. The returned mailbox names will be in the interpreted 1889 form. 1891 Note: The interpretation of the reference argument is 1892 implementation-defined. It depends upon whether the server 1893 implementation has a concept of the "current working directory" 1894 and leading "break out characters", which override the current 1895 working directory. 1897 For example, on a server which exports a UNIX or NT filesystem, 1898 the reference argument contains the current working directory, and 1899 the mailbox name argument would contain the name as interpreted in 1900 the current working directory. 1902 If a server implementation has no concept of break out characters, 1903 the canonical form is normally the reference name appended with 1904 the mailbox name. Note that if the server implements the 1905 namespace convention (Section 5.1.2.1), "#" is a break out 1906 character and must be treated as such. 1908 If the reference argument is not a level of mailbox hierarchy 1909 (that is, it is a \NoInferiors name), and/or the reference 1910 argument does not end with the hierarchy delimiter, it is 1911 implementation-dependent how this is interpreted. For example, a 1912 reference of "foo/bar" and mailbox name of "rag/baz" could be 1913 interpreted as "foo/bar/rag/baz", "foo/barrag/baz", or "foo/rag/ 1914 baz". A client SHOULD NOT use such a reference argument except at 1915 the explicit request of the user. A hierarchical browser MUST NOT 1916 make any assumptions about server interpretation of the reference 1917 unless the reference is a level of mailbox hierarchy AND ends with 1918 the hierarchy delimiter. 1920 Any part of the reference argument that is included in the 1921 interpreted form SHOULD prefix the interpreted form. It SHOULD also 1922 be in the same form as the reference name argument. This rule 1923 permits the client to determine if the returned mailbox name is in 1924 the context of the reference argument, or if something about the 1925 mailbox argument overrode the reference argument. Without this rule, 1926 the client would have to have knowledge of the server's naming 1927 semantics including what characters are "breakouts" that override a 1928 naming context. 1930 For example, here are some examples of how references 1931 and mailbox names might be interpreted on a UNIX-based 1932 server: 1934 Reference Mailbox Name Interpretation 1935 ------------ ------------ -------------- 1936 ~smith/Mail/ foo.* ~smith/Mail/foo.* 1937 archive/ % archive/% 1938 #news. comp.mail.* #news.comp.mail.* 1939 ~smith/Mail/ /usr/doc/foo /usr/doc/foo 1940 archive/ ~fred/Mail/* ~fred/Mail/* 1942 The first three examples demonstrate interpretations in 1943 the context of the reference argument. Note that 1944 "~smith/Mail" SHOULD NOT be transformed into something 1945 like "/u2/users/smith/Mail", or it would be impossible 1946 for the client to determine that the interpretation was 1947 in the context of the reference. 1949 The character "*" is a wildcard, and matches zero or more characters 1950 at this position. The character "%" is similar to "*", but it does 1951 not match a hierarchy delimiter. If the "%" wildcard is the last 1952 character of a mailbox name argument, matching levels of hierarchy 1953 are also returned. If these levels of hierarchy are not also 1954 selectable mailboxes, they are returned with the \Noselect mailbox 1955 name attribute (see the description of the LIST response for more 1956 details). 1958 Server implementations are permitted to "hide" otherwise accessible 1959 mailboxes from the wildcard characters, by preventing certain 1960 characters or names from matching a wildcard in certain situations. 1961 For example, a UNIX-based server might restrict the interpretation of 1962 "*" so that an initial "/" character does not match. 1964 The special name INBOX is included in the output from LIST, if INBOX 1965 is supported by this server for this user and if the uppercase string 1966 "INBOX" matches the interpreted reference and mailbox name arguments 1967 with wildcards as described above. The criteria for omitting INBOX 1968 is whether SELECT INBOX will return failure; it is not relevant 1969 whether the user's real INBOX resides on this or some other server. 1971 Example: C: A101 LIST "" "" 1972 S: * LIST (\Noselect) "/" "" 1973 S: A101 OK LIST Completed 1974 C: A102 LIST #news.comp.mail.misc "" 1975 S: * LIST (\Noselect) "." #news. 1976 S: A102 OK LIST Completed 1977 C: A103 LIST /usr/staff/jones "" 1978 S: * LIST (\Noselect) "/" / 1979 S: A103 OK LIST Completed 1980 C: A202 LIST ~/Mail/ % 1981 S: * LIST (\Noselect) "/" ~/Mail/foo 1982 S: * LIST () "/" ~/Mail/meetings 1983 S: A202 OK LIST completed 1985 6.3.10. LSUB Command 1987 Arguments: reference name 1988 mailbox name with possible wildcards 1990 Responses: untagged responses: LSUB 1992 Result: OK - lsub completed 1993 NO - lsub failure: can't list that reference or name 1994 BAD - command unknown or arguments invalid 1996 The LSUB command returns a subset of names from the set of names that 1997 the user has declared as being "active" or "subscribed". Zero or 1998 more untagged LSUB replies are returned. The arguments to LSUB are 1999 in the same form as those for LIST. 2001 The returned untagged LSUB response MAY contain different mailbox 2002 flags from a LIST untagged response. If this should happen, the 2003 flags in the untagged LIST are considered more authoritative. 2005 A special situation occurs when using LSUB with the % wildcard. 2006 Consider what happens if "foo/bar" (with a hierarchy delimiter of 2007 "/") is subscribed but "foo" is not. A "%" wildcard to LSUB must 2008 return foo, not foo/bar, in the LSUB response, and it MUST be flagged 2009 with the \Noselect attribute. 2011 The server MUST NOT unilaterally remove an existing mailbox name from 2012 the subscription list even if a mailbox by that name no longer 2013 exists. 2015 Example: C: A002 LSUB "#news." "comp.mail.*" 2016 S: * LSUB () "." #news.comp.mail.mime 2017 S: * LSUB () "." #news.comp.mail.misc 2018 S: A002 OK LSUB completed 2019 C: A003 LSUB "#news." "comp.%" 2020 S: * LSUB (\NoSelect) "." #news.comp.mail 2021 S: A003 OK LSUB completed 2023 6.3.11. NAMESPACE Command 2025 Arguments: none 2027 Responses: REQUIRED untagged responses: NAMESPACE 2029 Result: OK - command completed 2030 NO - Can't complete the command 2031 BAD - arguments invalid 2033 The NAMESPACE command causes a single ungagged NAMESPACE response to 2034 be returned. The untagged NAMESPACE response contains the prefix and 2035 hierarchy delimiter to the server's Personal Namespace(s), Other 2036 Users' Namespace(s), and Shared Namespace(s) that the server wishes 2037 to expose. The response will contain a NIL for any namespace class 2038 that is not available. Namespace_Response_Extensions MAY be included 2039 in the response. Namespace_Response_Extensions which are not on the 2040 IETF standards track, MUST be prefixed with an "X-". 2042 Example 1: 2044 In this example a server supports a single personal namespace. No 2045 leading prefix is used on personal mailboxes and "/" is the hierarchy 2046 delimiter. 2048 C: A001 NAMESPACE 2049 S: * NAMESPACE (("" "/")) NIL NIL 2050 S: A001 OK NAMESPACE command completed 2052 Example 2: 2054 A user logged on anonymously to a server. No personal mailboxes are 2055 associated with the anonymous user and the user does not have access 2056 to the Other Users' Namespace. No prefix is required to access 2057 shared mailboxes and the hierarchy delimiter is "." 2058 C: A001 NAMESPACE 2059 S: * NAMESPACE NIL NIL (("" ".")) 2060 S: A001 OK NAMESPACE command completed 2062 Example 3: 2064 A server that contains a Personal Namespace and a single Shared 2065 Namespace. 2067 C: A001 NAMESPACE 2068 S: * NAMESPACE (("" "/")) NIL (("Public Folders/" "/")) 2069 S: A001 OK NAMESPACE command completed 2071 Example 4: 2073 A server that contains a Personal Namespace, Other Users' Namespace 2074 and multiple Shared Namespaces. Note that the hierarchy delimiter 2075 used within each namespace can be different. 2077 C: A001 NAMESPACE 2078 S: * NAMESPACE (("" "/")) (("~" "/")) (("#shared/" "/") 2079 ("#public/" "/")("#ftp/" "/")("#news." ".")) 2080 S: A001 OK NAMESPACE command completed 2082 The prefix string allows a client to do things such as automatically 2083 creating personal mailboxes or LISTing all available mailboxes within 2084 a namespace. 2086 Example 5: 2088 A server that supports only the Personal Namespace, with a leading 2089 prefix of INBOX to personal mailboxes and a hierarchy delimiter of 2090 "." 2092 C: A001 NAMESPACE 2093 S: * NAMESPACE (("INBOX." ".")) NIL NIL 2094 S: A001 OK NAMESPACE command completed 2096 < Automatically create a mailbox to store sent items.> 2098 C: A002 CREATE "INBOX.Sent Mail" 2099 S: A002 OK CREATE command completed 2101 Although typically a server will support only a single Personal 2102 Namespace, and a single Other User's Namespace, circumstances exist 2103 where there MAY be multiples of these, and a client MUST be prepared 2104 for them. If a client is configured such that it is required to 2105 create a certain mailbox, there can be circumstances where it is 2106 unclear which Personal Namespaces it should create the mailbox in. 2107 In these situations a client SHOULD let the user select which 2108 namespaces to create the mailbox in. 2110 Example 6: 2112 In this example, a server supports 2 Personal Namespaces. In 2113 addition to the regular Personal Namespace, the user has an 2114 additional personal namespace to allow access to mailboxes in an MH 2115 format mailstore. 2117 The client is configured to save a copy of all mail sent by the user 2118 into a mailbox called 'Sent Mail'. Furthermore, after a message is 2119 deleted from a mailbox, the client is configured to move that message 2120 to a mailbox called 'Deleted Items'. 2122 Note that this example demonstrates how some extension flags can be 2123 passed to further describe the #mh namespace. 2125 C: A001 NAMESPACE 2126 S: * NAMESPACE (("" "/")("#mh/" "/" "X-PARAM" ("FLAG1" "FLAG2"))) 2127 NIL NIL 2128 S: A001 OK NAMESPACE command completed 2130 < It is desired to keep only one copy of sent mail. It is unclear 2131 which Personal Namespace the client should use to create the 'Sent 2132 Mail' mailbox. The user is prompted to select a namespace and 2133 only one 'Sent Mail' mailbox is created. > 2135 C: A002 CREATE "Sent Mail" 2136 S: A002 OK CREATE command completed 2138 < The client is designed so that it keeps two 'Deleted Items' 2139 mailboxes, one for each namespace. > 2141 C: A003 CREATE "Delete Items" 2142 S: A003 OK CREATE command completed 2144 C: A004 CREATE "#mh/Deleted Items" 2145 S: A004 OK CREATE command completed 2147 The next level of hierarchy following the Other Users' Namespace 2148 prefix SHOULD consist of , where is a user name 2149 as per the LOGIN or AUTHENTICATE command. 2151 A client can construct a LIST command by appending a "%" to the Other 2152 Users' Namespace prefix to discover the Personal Namespaces of other 2153 users that are available to the currently authenticated user. 2155 In response to such a LIST command, a server SHOULD NOT return user 2156 names that have not granted access to their personal mailboxes to the 2157 user in question. 2159 A server MAY return a LIST response containing only the names of 2160 users that have explicitly granted access to the user in question. 2162 Alternatively, a server MAY return NO to such a LIST command, 2163 requiring that a user name be included with the Other Users' 2164 Namespace prefix before listing any other user's mailboxes. 2166 Example 7: 2168 A server that supports providing a list of other user's mailboxes 2169 that are accessible to the currently logged on user. 2171 C: A001 NAMESPACE 2172 S: * NAMESPACE (("" "/")) (("Other Users/" "/")) NIL 2173 S: A001 OK NAMESPACE command completed 2175 C: A002 LIST "" "Other Users/%" 2176 S: * LIST () "/" "Other Users/Mike" 2177 S: * LIST () "/" "Other Users/Karen" 2178 S: * LIST () "/" "Other Users/Matthew" 2179 S: * LIST () "/" "Other Users/Tesa" 2180 S: A002 OK LIST command completed 2182 Example 8: 2184 A server that does not support providing a list of other user's 2185 mailboxes that are accessible to the currently logged on user. The 2186 mailboxes are listable if the client includes the name of the other 2187 user with the Other Users' Namespace prefix. 2189 C: A001 NAMESPACE 2190 S: * NAMESPACE (("" "/")) (("#Users/" "/")) NIL 2191 S: A001 OK NAMESPACE command completed 2193 < In this example, the currently logged on user has access to the 2194 Personal Namespace of user Mike, but the server chose to suppress 2195 this information in the LIST response. However, by appending the 2196 user name Mike (received through user input) to the Other Users' 2197 Namespace prefix, the client is able to get a listing of the 2198 personal mailboxes of user Mike. > 2200 C: A002 LIST "" "#Users/%" 2201 S: A002 NO The requested item could not be found. 2203 C: A003 LIST "" "#Users/Mike/%" 2204 S: * LIST () "/" "#Users/Mike/INBOX" 2205 S: * LIST () "/" "#Users/Mike/Foo" 2206 S: A003 OK LIST command completed. 2208 A prefix string might not contain a hierarchy delimiter, because in 2209 some cases it is not needed as part of the prefix. 2211 Example 9: 2213 A server that allows access to the Other Users' Namespace by 2214 prefixing the others' mailboxes with a '~' followed by , 2215 where is a user name as per the LOGIN or AUTHENTICATE 2216 command. 2218 C: A001 NAMESPACE 2219 S: * NAMESPACE (("" "/")) (("~" "/")) NIL 2220 S: A001 OK NAMESPACE command completed 2222 < List the mailboxes for user mark > 2224 C: A002 LIST "" "~mark/%" 2225 S: * LIST () "/" "~mark/INBOX" 2226 S: * LIST () "/" "~mark/foo" 2227 S: A002 OK LIST command completed 2229 6.3.12. STATUS Command 2231 Arguments: mailbox name 2232 status data item names 2234 Responses: REQUIRED untagged responses: STATUS 2236 Result: OK - status completed 2237 NO - status failure: no status for that name 2238 BAD - command unknown or arguments invalid 2240 The STATUS command requests the status of the indicated mailbox. It 2241 does not change the currently selected mailbox, nor does it affect 2242 the state of any messages in the queried mailbox. 2244 The STATUS command provides an alternative to opening a second 2245 IMAP4rev2 connection and doing an EXAMINE command on a mailbox to 2246 query that mailbox's status without deselecting the current mailbox 2247 in the first IMAP4rev2 connection. 2249 Unlike the LIST command, the STATUS command is not guaranteed to be 2250 fast in its response. Under certain circumstances, it can be quite 2251 slow. In some implementations, the server is obliged to open the 2252 mailbox read-only internally to obtain certain status information. 2253 Also unlike the LIST command, the STATUS command does not accept 2254 wildcards. 2256 Note: The STATUS command is intended to access the status of 2257 mailboxes other than the currently selected mailbox. Because the 2258 STATUS command can cause the mailbox to be opened internally, and 2259 because this information is available by other means on the 2260 selected mailbox, the STATUS command SHOULD NOT be used on the 2261 currently selected mailbox. 2263 The STATUS command MUST NOT be used as a "check for new messages 2264 in the selected mailbox" operation (refer to sections Section 7, 2265 Section 7.3.1 for more information about the proper method for new 2266 message checking). 2268 Because the STATUS command is not guaranteed to be fast in its 2269 results, clients SHOULD NOT expect to be able to issue many 2270 consecutive STATUS commands and obtain reasonable performance. 2272 The currently defined status data items that can be requested are: 2274 MESSAGES The number of messages in the mailbox. 2276 UIDNEXT The next unique identifier value of the mailbox. Refer to 2277 Section 2.3.1.1 for more information. 2279 UIDVALIDITY The unique identifier validity value of the mailbox. 2280 Refer to Section 2.3.1.1 for more information. 2282 UNSEEN The number of messages which do not have the \Seen flag set. 2284 SIZE The total size of the mailbox in octets. This is not strictly 2285 required to be an exact value, but it MUST be equal to or greater 2286 than the sum of the values of the RFC822.SIZE FETCH message data 2287 items (see Section 6.4.6) of all messages in the mailbox. 2289 Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES) 2290 S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 2291 S: A042 OK STATUS completed 2293 6.3.13. APPEND Command 2295 Arguments: mailbox name 2296 OPTIONAL flag parenthesized list 2297 OPTIONAL date/time string 2298 message literal 2300 Responses: no specific responses for this command 2302 Result: OK - append completed 2303 NO - append error: can't append to that mailbox, error 2304 in flags or date/time or message text 2305 BAD - command unknown or arguments invalid 2307 The APPEND command appends the literal argument as a new message to 2308 the end of the specified destination mailbox. This argument SHOULD 2309 be in the format of an [RFC-5322] or [I18N-HDRS] message. 8-bit 2310 characters are permitted in the message. A server implementation 2311 that is unable to preserve 8-bit data properly MUST be able to 2312 reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB] 2313 content transfer encoding. 2315 Note: There may be exceptions, e.g., draft messages, in which 2316 required [RFC-5322] header lines are omitted in the message 2317 literal argument to APPEND. The full implications of doing so 2318 must be understood and carefully weighed. 2320 If a flag parenthesized list is specified, the flags SHOULD be set in 2321 the resulting message; otherwise, the flag list of the resulting 2322 message is set to empty by default. 2324 If a date-time is specified, the internal date SHOULD be set in the 2325 resulting message; otherwise, the internal date of the resulting 2326 message is set to the current date and time by default. 2328 If the append is unsuccessful for any reason, the mailbox MUST be 2329 restored to its state before the APPEND attempt; no partial appending 2330 is permitted. 2332 If the destination mailbox does not exist, a server MUST return an 2333 error, and MUST NOT automatically create the mailbox. Unless it is 2334 certain that the destination mailbox can not be created, the server 2335 MUST send the response code "[TRYCREATE]" as the prefix of the text 2336 of the tagged NO response. This gives a hint to the client that it 2337 can attempt a CREATE command and retry the APPEND if the CREATE is 2338 successful. 2340 On successful completion of an APPEND, the server SHOULD return an 2341 APPENDUID response code. 2343 In the case of a mailbox that has permissions set so that the client 2344 can APPEND to the mailbox, but not SELECT or EXAMINE it, the server 2345 SHOULD NOT send an APPENDUID response code as it would disclose 2346 information about the mailbox. 2348 In the case of a mailbox that has UIDNOTSTICKY status (see 2349 UIDNOTSTICKY response code definition), the server MAY omit the 2350 APPENDUID response code as it is not meaningful. 2352 If the server does not return the APPENDUID response codes, the 2353 client can discover this information by selecting the destination 2354 mailbox. The location of messages placed in the destination mailbox 2355 by APPEND can be determined by using FETCH and/or SEARCH commands 2356 (e.g., for Message-ID or some unique marker placed in the message in 2357 an APPEND). 2359 If the mailbox is currently selected, the normal new message actions 2360 SHOULD occur. Specifically, the server SHOULD notify the client 2361 immediately via an untagged EXISTS response. If the server does not 2362 do so, the client MAY issue a NOOP command (or failing that, a CHECK 2363 command) after one or more APPEND commands. 2365 Example: C: A003 APPEND saved-messages (\Seen) {310} 2366 S: + Ready for literal data 2367 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2368 C: From: Fred Foobar 2369 C: Subject: afternoon meeting 2370 C: To: mooch@owatagu.siam.edu 2371 C: Message-Id: 2372 C: MIME-Version: 1.0 2373 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2374 C: 2375 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2376 C: 2377 S: A003 OK APPEND completed 2379 Example: C: A003 APPEND saved-messages (\Seen) {297} 2380 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2381 C: From: Fred Foobar 2382 C: Subject: afternoon meeting 2383 C: To: mooch@example.com 2384 C: Message-Id: 2385 C: MIME-Version: 1.0 2386 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2387 C: 2388 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2389 C: 2390 S: A003 OK [APPENDUID 38505 3955] APPEND completed 2391 C: A004 COPY 2:4 meeting 2392 S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done 2393 C: A005 UID COPY 305:310 meeting 2394 S: A005 OK No matching messages, so nothing copied 2395 C: A006 COPY 2 funny 2396 S: A006 OK Done 2397 C: A007 SELECT funny 2398 S: * 1 EXISTS 2399 S: * OK [UIDVALIDITY 3857529045] Validity session-only 2400 S: * OK [UIDNEXT 2] Predicted next UID 2401 S: * NO [UIDNOTSTICKY] Non-persistent UIDs 2402 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 2403 S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited 2404 S: A007 OK [READ-WRITE] SELECT completed 2406 In this example, A003 and A004 demonstrate successful appending and 2407 copying to a mailbox that returns the UIDs assigned to the messages. 2408 A005 is an example in which no messages were copied; this is because 2409 in A003, we see that message 2 had UID 304, and message 3 had UID 2410 319; therefore, UIDs 305 through 310 do not exist (refer to 2411 Section 2.3.1.1 for further explanation). A006 is an example of a 2412 message being copied that did not return a COPYUID; and, as expected, 2413 A007 shows that the mail store containing that mailbox does not 2414 support persistent UIDs. 2416 Note: The APPEND command is not used for message delivery, because 2417 it does not provide a mechanism to transfer [SMTP] envelope 2418 information. 2420 6.3.14. IDLE Command 2422 Arguments: none 2424 Responses: continuation data will be requested; the client sends the 2425 continuation data "DONE" to end the command 2427 Result: OK - IDLE completed after client sent "DONE" 2428 NO - failure: the server will not allow the IDLE command 2429 at this time 2430 BAD - command unknown or arguments invalid 2432 Without the IDLE command a client requires to poll the server for 2433 changes to the selected mailbox (new mail, deletions, flag changes). 2434 It's often more desirable to have the server transmit updates to the 2435 client in real time. This allows a user to see new mail immediately. 2436 The IDLE command allows a client to tell the server that it's ready 2437 to accept such real-time updates. 2439 The IDLE command is sent from the client to the server when the 2440 client is ready to accept unsolicited mailbox update messages. The 2441 server requests a response to the IDLE command using the continuation 2442 ("+") response. The IDLE command remains active until the client 2443 responds to the continuation, and as long as an IDLE command is 2444 active, the server is now free to send untagged EXISTS, EXPUNGE, 2445 FETCH, and other responses at any time. If the server choose to send 2446 unsolicited FETCH responses, they MUST include UID FETCH item. 2448 The IDLE command is terminated by the receipt of a "DONE" 2449 continuation from the client; such response satisfies the server's 2450 continuation request. At that point, the server MAY send any 2451 remaining queued untagged responses and then MUST immediately send 2452 the tagged response to the IDLE command and prepare to process other 2453 commands. As in the base specification, the processing of any new 2454 command may cause the sending of unsolicited untagged responses, 2455 subject to the ambiguity limitations. The client MUST NOT send a 2456 command while the server is waiting for the DONE, since the server 2457 will not be able to distinguish a command from a continuation. 2459 The server MAY consider a client inactive if it has an IDLE command 2460 running, and if such a server has an inactivity timeout it MAY log 2461 the client off implicitly at the end of its timeout period. Because 2462 of that, clients using IDLE are advised to terminate the IDLE and re- 2463 issue it at least every 29 minutes to avoid being logged off. This 2464 still allows a client to receive immediate mailbox updates even 2465 though it need only "poll" at half hour intervals. 2467 Example: C: A001 SELECT INBOX 2468 S: * FLAGS (\Deleted \Seen \Flagged) 2469 S: * OK [PERMANENTFLAGS (\Deleted \Seen \Flagged)] Limited 2470 S: * 3 EXISTS 2471 S: * OK [UIDVALIDITY 1] 2472 S: A001 OK [READ-WRITE] SELECT completed 2473 C: A002 IDLE 2474 S: + idling 2475 ...time passes; new mail arrives... 2476 S: * 4 EXISTS 2477 C: DONE 2478 S: A002 OK IDLE terminated 2479 ...another client expunges message 2 now... 2480 C: A003 FETCH 4 ALL 2481 S: * 4 FETCH (...) 2482 S: A003 OK FETCH completed 2483 C: A004 IDLE 2484 S: * 2 EXPUNGE 2485 S: * 3 EXISTS 2486 S: + idling 2487 ...time passes; another client expunges message 3... 2488 S: * 3 EXPUNGE 2489 S: * 2 EXISTS 2490 ...time passes; new mail arrives... 2491 S: * 3 EXISTS 2492 C: DONE 2493 S: A004 OK IDLE terminated 2494 C: A005 FETCH 3 ALL 2495 S: * 3 FETCH (...) 2496 S: A005 OK FETCH completed 2497 C: A006 IDLE 2499 6.4. Client Commands - Selected State 2501 In the selected state, commands that manipulate messages in a mailbox 2502 are permitted. 2504 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 2505 and the authenticated state commands (SELECT, EXAMINE, NAMESPACE, 2506 CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB , STATUS, 2507 and APPEND), the following commands are valid in the selected state: 2508 CHECK, CLOSE, UNSELECT, EXPUNGE, SEARCH, FETCH, STORE, COPY, MOVE, 2509 and UID. 2511 6.4.1. CHECK Command 2513 Arguments: none 2515 Responses: no specific responses for this command 2517 Result: OK - check completed 2518 BAD - command unknown or arguments invalid 2520 The CHECK command requests a checkpoint of the currently selected 2521 mailbox. A checkpoint refers to any implementation-dependent 2522 housekeeping associated with the mailbox (e.g., resolving the 2523 server's in-memory state of the mailbox with the state on its disk) 2524 that is not normally executed as part of each command. A checkpoint 2525 MAY take a non-instantaneous amount of real time to complete. If a 2526 server implementation has no such housekeeping considerations, CHECK 2527 is equivalent to NOOP. 2529 There is no guarantee that an EXISTS untagged response will happen as 2530 a result of CHECK. NOOP, not CHECK, SHOULD be used for new message 2531 polling. 2533 Example: C: FXXZ CHECK 2534 S: FXXZ OK CHECK Completed 2536 6.4.2. CLOSE Command 2538 Arguments: none 2540 Responses: no specific responses for this command 2542 Result: OK - close completed, now in authenticated state 2543 BAD - command unknown or arguments invalid 2545 The CLOSE command permanently removes all messages that have the 2546 \Deleted flag set from the currently selected mailbox, and returns to 2547 the authenticated state from the selected state. No untagged EXPUNGE 2548 responses are sent. 2550 No messages are removed, and no error is given, if the mailbox is 2551 selected by an EXAMINE command or is otherwise selected read-only. 2553 Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command 2554 MAY be issued without previously issuing a CLOSE command. The 2555 SELECT, EXAMINE, and LOGOUT commands implicitly close the currently 2556 selected mailbox without doing an expunge. However, when many 2557 messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT sequence is 2558 considerably faster than an EXPUNGE-LOGOUT or EXPUNGE-SELECT because 2559 no untagged EXPUNGE responses (which the client would probably 2560 ignore) are sent. 2562 Example: C: A341 CLOSE 2563 S: A341 OK CLOSE completed 2565 6.4.3. UNSELECT Command 2567 Arguments: none 2569 Responses: no specific responses for this command 2571 Result: OK - unselect completed, now in authenticated state 2572 BAD - no mailbox selected, or argument supplied but none 2573 permitted 2575 The UNSELECT command frees server's resources associated with the 2576 selected mailbox and returns the server to the authenticated state. 2577 This command performs the same actions as CLOSE, except that no 2578 messages are permanently removed from the currently selected mailbox. 2580 Example: C: A342 UNSELECT 2581 S: A342 OK Unselect completed 2583 6.4.4. EXPUNGE Command 2585 Arguments: none 2587 Responses: untagged responses: EXPUNGE 2589 Result: OK - expunge completed 2590 NO - expunge failure: can't expunge (e.g., permission 2591 denied) 2592 BAD - command unknown or arguments invalid 2594 The EXPUNGE command permanently removes all messages that have the 2595 \Deleted flag set from the currently selected mailbox. Before 2596 returning an OK to the client, an untagged EXPUNGE response is sent 2597 for each message that is removed. 2599 Example: C: A202 EXPUNGE 2600 S: * 3 EXPUNGE 2601 S: * 3 EXPUNGE 2602 S: * 5 EXPUNGE 2603 S: * 8 EXPUNGE 2604 S: A202 OK EXPUNGE completed 2606 Note: In this example, messages 3, 4, 7, and 11 had the \Deleted flag 2607 set. See the description of the EXPUNGE response for further 2608 explanation. 2610 6.4.5. SEARCH Command 2612 Arguments: OPTIONAL result specifier 2613 OPTIONAL [CHARSET] specification 2614 searching criteria (one or more) 2616 Responses: REQUIRED untagged response: ESEARCH 2618 Result: OK - search completed 2619 NO - search error: can't search that [CHARSET] or 2620 criteria 2621 BAD - command unknown or arguments invalid 2623 The SEARCH command searches the mailbox for messages that match the 2624 given searching criteria. 2626 The SEARCH command may contain result options. Result options 2627 control what kind of information is returned about messages matching 2628 the search criteria in an untagged ESEARCH response. If no result 2629 option is specified or empty list of options is specified "()", ALL 2630 is assumed (see below). The order of individual options is 2631 arbitrary. Individual options may contain parameters enclosed in 2632 parentheses (*). If an option has parameters, they consist of atoms 2633 and/or strings and/or lists in a specific order. Any options not 2634 defined by extensions that the server supports must be rejected with 2635 a BAD response. 2637 (*) - if an option has a mandatory parameter, which can always be 2638 represented as a number or a sequence-set, the option parameter does 2639 not need the enclosing (). See ABNF for more details. 2641 This document specifies the following result options: 2643 MIN 2645 Return the lowest message number/UID that satisfies the SEARCH 2646 criteria. 2648 If the SEARCH results in no matches, the server MUST NOT 2649 include the MIN result option in the ESEARCH response; however, 2650 it still MUST send the ESEARCH response. 2652 MAX 2653 Return the highest message number/UID that satisfies the SEARCH 2654 criteria. 2656 If the SEARCH results in no matches, the server MUST NOT 2657 include the MAX result option in the ESEARCH response; however, 2658 it still MUST send the ESEARCH response. 2660 ALL 2662 Return all message numbers/UIDs that satisfy the SEARCH 2663 criteria using the sequence-set syntax. Note, the client MUST 2664 NOT assume that messages/UIDs will be listed in any particular 2665 order. 2667 If the SEARCH results in no matches, the server MUST NOT 2668 include the ALL result option in the ESEARCH response; however, 2669 it still MUST send the ESEARCH response. 2671 COUNT Return number of the messages that satisfy the SEARCH 2672 criteria. This result option MUST always be included in the 2673 ESEARCH response. 2675 Note: future extensions to this document can allow servers to return 2676 multiple ESEARCH responses for a single extended SEARCH command. 2677 However all options specified above MUST result in a single ESEARCH 2678 response. These extensions will have to describe how results from 2679 multiple ESEARCH responses are to be amalgamated. 2681 Searching criteria consist of one or more search keys. 2683 When multiple keys are specified, the result is the intersection (AND 2684 function) of all the messages that match those keys. For example, 2685 the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers to all 2686 deleted messages from Smith that were placed in the mailbox since 2687 February 1, 1994. A search key can also be a parenthesized list of 2688 one or more search keys (e.g., for use with the OR and NOT keys). 2690 Server implementations MAY exclude [MIME-IMB] body parts with 2691 terminal content media types other than TEXT and MESSAGE from 2692 consideration in SEARCH matching. 2694 The OPTIONAL [CHARSET] specification consists of the word "CHARSET" 2695 followed by a registered [CHARSET]. It indicates the [CHARSET] of 2696 the strings that appear in the search criteria. [MIME-IMB] content 2697 transfer encodings, and [MIME-HDRS] strings in [RFC-5322]/[MIME-IMB] 2698 headers, MUST be decoded before comparing text. US-ASCII and UTF-8 2699 charsets MUST be supported; other [CHARSET]s MAY be supported. If 2700 "CHARSET" is not provided, an IMAP4rev2 server MUST assume UTF-8. 2702 If the server does not support the specified [CHARSET], it MUST 2703 return a tagged NO response (not a BAD). This response SHOULD 2704 contain the BADCHARSET response code, which MAY list the [CHARSET]s 2705 supported by the server. 2707 In all search keys that use strings, a message matches the key if the 2708 string is a substring of the associated text. The matching SHOULD be 2709 case-insensitive for characters within ASCII range. Consider using 2710 [IMAP-I18N] for language-sensitive case-insensitive searching. Note 2711 that the empty string is a substring; this is useful when doing a 2712 HEADER search in order to test for a header field presence in the 2713 message. 2715 The defined search keys are as follows. Refer to the Formal Syntax 2716 section for the precise syntactic definitions of the arguments. 2718 Messages with message sequence numbers corresponding 2719 to the specified message sequence number set. 2721 ALL All messages in the mailbox; the default initial key for ANDing. 2723 ANSWERED Messages with the \Answered flag set. 2725 BCC Messages that contain the specified string in the 2726 envelope structure's BCC field. 2728 BEFORE Messages whose internal date (disregarding time and 2729 timezone) is earlier than the specified date. 2731 BODY Messages that contain the specified string in the body 2732 of the message. 2734 CC Messages that contain the specified string in the 2735 envelope structure's CC field. 2737 DELETED Messages with the \Deleted flag set. 2739 DRAFT Messages with the \Draft flag set. 2741 FLAGGED Messages with the \Flagged flag set. 2743 FROM Messages that contain the specified string in the 2744 envelope structure's FROM field. 2746 HEADER Messages that have a header with the 2747 specified field-name (as defined in [RFC-5322]) and that contains 2748 the specified string in the text of the header (what comes after 2749 the colon). If the string to search is zero-length, this matches 2750 all messages that have a header line with the specified field-name 2751 regardless of the contents. 2753 KEYWORD Messages with the specified keyword flag set. 2755 LARGER Messages with an [RFC-5322] size larger than the 2756 specified number of octets. 2758 NEW [[Fix this]] Messages that have the \Recent flag set but not the 2759 \Seen flag. This is functionally equivalent to "(RECENT UNSEEN)". 2761 NOT Messages that do not match the specified search 2762 key. 2764 ON Messages whose internal date (disregarding time and 2765 timezone) is within the specified date. 2767 OR Messages that match either search 2768 key. 2770 SEEN Messages that have the \Seen flag set. 2772 SENTBEFORE Messages whose [RFC-5322] Date: header 2773 (disregarding time and timezone) is earlier than the specified 2774 date. 2776 SENTON Messages whose [RFC-5322] Date: header (disregarding 2777 time and timezone) is within the specified date. 2779 SENTSINCE Messages whose [RFC-5322] Date: header 2780 (disregarding time and timezone) is within or later than the 2781 specified date. 2783 SINCE Messages whose internal date (disregarding time and 2784 timezone) is within or later than the specified date. 2786 SMALLER Messages with an [RFC-5322] size smaller than the 2787 specified number of octets. 2789 SUBJECT Messages that contain the specified string in the 2790 envelope structure's SUBJECT field. 2792 TEXT Messages that contain the specified string in the 2793 header or body of the message. 2795 TO Messages that contain the specified string in the 2796 envelope structure's TO field. 2798 UID Messages with unique identifiers corresponding to 2799 the specified unique identifier set. Sequence set ranges are 2800 permitted. 2802 UNANSWERED Messages that do not have the \Answered flag set. 2804 UNDELETED Messages that do not have the \Deleted flag set. 2806 UNDRAFT Messages that do not have the \Draft flag set. 2808 UNFLAGGED Messages that do not have the \Flagged flag set. 2810 UNKEYWORD Messages that do not have the specified keyword 2811 flag set. 2813 UNSEEN Messages that do not have the \Seen flag set. 2815 Example: C: A282 SEARCH RETURN (MIN COUNT) FLAGGED 2816 SINCE 1-Feb-1994 NOT FROM "Smith" 2817 S: * ESEARCH (TAG "A282") MIN 2 COUNT 3 2818 S: A282 OK SEARCH completed 2820 Example: C: A283 SEARCH RETURN () FLAGGED 2821 SINCE 1-Feb-1994 NOT FROM "Smith" 2822 S: * ESEARCH (TAG "A283") ALL 2,10:11 2823 S: A283 OK SEARCH completed 2825 Example: C: A284 SEARCH TEXT "string not in mailbox" 2826 S: * ESEARCH (TAG "A284") 2827 S: A284 OK SEARCH completed 2828 C: A285 SEARCH CHARSET UTF-8 TEXT {6} 2829 S: + Ready for literal text 2830 C: XXXXXX 2831 S: * ESEARCH (TAG "A285") ALL 43 2832 S: A285 OK SEARCH completed 2834 Note: Since this document is restricted to 7-bit ASCII text, it is 2835 not possible to show actual UTF-8 data. The "XXXXXX" is a 2836 placeholder for what would be 6 octets of 8-bit data in an actual 2837 transaction. 2839 The following example demonstrates finding the first unseen message 2840 in the mailbox: 2842 Example: C: A284 SEARCH RETURN (MIN) UNSEEN 2843 S: * ESEARCH (TAG "A284") MIN 4 2844 S: A284 OK SEARCH completed 2846 The following example demonstrates that if the ESEARCH UID indicator 2847 is present, all data in the ESEARCH response is referring to UIDs; 2848 for example, the MIN result specifier will be followed by a UID. 2850 Example: C: A285 UID SEARCH RETURN (MIN MAX) 1:5000 2851 S: * ESEARCH (TAG "A285") UID MIN 7 MAX 3800 2852 S: A285 OK SEARCH completed 2854 The following example demonstrates returning the number of deleted 2855 messages: 2857 Example: C: A286 SEARCH RETURN (COUNT) DELETED 2858 S: * ESEARCH (TAG "A286") COUNT 15 2859 S: A286 OK SEARCH completed 2861 6.4.6. FETCH Command 2863 Arguments: sequence set 2864 message data item names or macro 2866 Responses: untagged responses: FETCH 2868 Result: OK - fetch completed 2869 NO - fetch error: can't fetch that data 2870 BAD - command unknown or arguments invalid 2872 The FETCH command retrieves data associated with a message in the 2873 mailbox. The data items to be fetched can be either a single atom or 2874 a parenthesized list. 2876 Most data items, identified in the formal syntax under the msg-att- 2877 static rule, are static and MUST NOT change for any particular 2878 message. Other data items, identified in the formal syntax under the 2879 msg-att-dynamic rule, MAY change, either as a result of a STORE 2880 command or due to external events. 2882 For example, if a client receives an ENVELOPE for a message when 2883 it already knows the envelope, it can safely ignore the newly 2884 transmitted envelope. 2886 There are three macros which specify commonly-used sets of data 2887 items, and can be used instead of data items. A macro must be used 2888 by itself, and not in conjunction with other macros or data items. 2890 ALL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) 2892 FAST Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE) 2893 FULL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE 2894 BODY) 2896 The currently defined data items that can be fetched are: 2898 BINARY[]<> 2900 Requests that the specified section be transmitted after 2901 performing Content-Transfer-Encoding-related decoding. 2903 The argument, if present, requests that a subset of 2904 the data be returned. The semantics of a partial FETCH BINARY 2905 command are the same as for a partial FETCH BODY command, with 2906 the exception that the arguments refer to the DECODED 2907 section data. 2909 BINARY.PEEK[]<> An alternate form of 2910 BINARY[] that does not implicitly set the \Seen 2911 flag. 2913 BINARY.SIZE[] 2915 Requests the decoded size of the section (i.e., the size to 2916 expect in response to the corresponding FETCH BINARY request). 2918 Note: client authors are cautioned that this might be an 2919 expensive operation for some server implementations. 2920 Needlessly issuing this request could result in degraded 2921 performance due to servers having to calculate the value every 2922 time the request is issued. 2924 BODY Non-extensible form of BODYSTRUCTURE. 2926 BODY[
]<> 2928 The text of a particular body section. The section 2929 specification is a set of zero or more part specifiers 2930 delimited by periods. A part specifier is either a part number 2931 or one of the following: HEADER, HEADER.FIELDS, 2932 HEADER.FIELDS.NOT, MIME, and TEXT. An empty section 2933 specification refers to the entire message, including the 2934 header. 2936 Every message has at least one part number. Non-[MIME-IMB] 2937 messages, and non-multipart [MIME-IMB] messages with no 2938 encapsulated message, only have a part 1. 2940 Multipart messages are assigned consecutive part numbers, as 2941 they occur in the message. If a particular part is of type 2942 message or multipart, its parts MUST be indicated by a period 2943 followed by the part number within that nested multipart part. 2945 A part of type MESSAGE/RFC822 or MESSAGE/GLOBAL also has nested 2946 part numbers, referring to parts of the MESSAGE part's body. 2948 The HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, and TEXT part 2949 specifiers can be the sole part specifier or can be prefixed by 2950 one or more numeric part specifiers, provided that the numeric 2951 part specifier refers to a part of type MESSAGE/RFC822 or 2952 MESSAGE/GLOBAL. The MIME part specifier MUST be prefixed by 2953 one or more numeric part specifiers. 2955 The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part 2956 specifiers refer to the [RFC-5322] header of the message or of 2957 an encapsulated [MIME-IMT] MESSAGE/RFC822 or MESSAGE/GLOBAL 2958 message. HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a 2959 list of field-name (as defined in [RFC-5322]) names, and return 2960 a subset of the header. The subset returned by HEADER.FIELDS 2961 contains only those header fields with a field-name that 2962 matches one of the names in the list; similarly, the subset 2963 returned by HEADER.FIELDS.NOT contains only the header fields 2964 with a non-matching field-name. The field-matching is ASCII 2965 range case-insensitive but otherwise exact. Subsetting does 2966 not exclude the [RFC-5322] delimiting blank line between the 2967 header and the body; the blank line is included in all header 2968 fetches, except in the case of a message which has no body and 2969 no blank line. 2971 The MIME part specifier refers to the [MIME-IMB] header for 2972 this part. 2974 The TEXT part specifier refers to the text body of the message, 2975 omitting the [RFC-5322] header. 2977 Here is an example of a complex message with some of its 2978 part specifiers: 2980 HEADER ([RFC-5322] header of the message) 2981 TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2982 1 TEXT/PLAIN 2983 2 APPLICATION/OCTET-STREAM 2984 3 MESSAGE/RFC822 2985 3.HEADER ([RFC-5322] header of the message) 2986 3.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2987 3.1 TEXT/PLAIN 2988 3.2 APPLICATION/OCTET-STREAM 2989 4 MULTIPART/MIXED 2990 4.1 IMAGE/GIF 2991 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF) 2992 4.2 MESSAGE/RFC822 2993 4.2.HEADER ([RFC-5322] header of the message) 2994 4.2.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 2995 4.2.1 TEXT/PLAIN 2996 4.2.2 MULTIPART/ALTERNATIVE 2997 4.2.2.1 TEXT/PLAIN 2998 4.2.2.2 TEXT/RICHTEXT 3000 It is possible to fetch a substring of the designated text. 3001 This is done by appending an open angle bracket ("<"), the 3002 octet position of the first desired octet, a period, the 3003 maximum number of octets desired, and a close angle bracket 3004 (">") to the part specifier. If the starting octet is beyond 3005 the end of the text, an empty string is returned. 3007 Any partial fetch that attempts to read beyond the end of the 3008 text is truncated as appropriate. A partial fetch that starts 3009 at octet 0 is returned as a partial fetch, even if this 3010 truncation happened. 3012 Note: This means that BODY[]<0.2048> of a 1500-octet message 3013 will return BODY[]<0> with a literal of size 1500, not 3014 BODY[]. 3016 Note: A substring fetch of a HEADER.FIELDS or 3017 HEADER.FIELDS.NOT part specifier is calculated after 3018 subsetting the header. 3020 The \Seen flag is implicitly set; if this causes the flags to 3021 change, they SHOULD be included as part of the FETCH responses. 3023 BODY.PEEK[
]<> An alternate form of BODY[
] 3024 that does not implicitly set the \Seen flag. 3026 BODYSTRUCTURE The [MIME-IMB] body structure of the message. This is 3027 computed by the server by parsing the [MIME-IMB] header fields in 3028 the [RFC-5322] header and [MIME-IMB] headers. 3030 ENVELOPE The envelope structure of the message. This is computed by 3031 the server by parsing the [RFC-5322] header into the component 3032 parts, defaulting various fields as necessary. 3034 FLAGS The flags that are set for this message. 3036 INTERNALDATE The internal date of the message. 3038 RFC822 Functionally equivalent to BODY[], differing in the syntax of 3039 the resulting untagged FETCH data (RFC822 is returned). 3041 RFC822.HEADER Functionally equivalent to BODY.PEEK[HEADER], 3042 differing in the syntax of the resulting untagged FETCH data 3043 (RFC822.HEADER is returned). 3045 RFC822.SIZE The [RFC-5322] size of the message. 3047 RFC822.TEXT Functionally equivalent to BODY[TEXT], differing in the 3048 syntax of the resulting untagged FETCH data (RFC822.TEXT is 3049 returned). 3051 UID The unique identifier for the message. 3053 Example: C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)]) 3054 S: * 2 FETCH .... 3055 S: * 3 FETCH .... 3056 S: * 4 FETCH .... 3057 S: A654 OK FETCH completed 3059 6.4.7. STORE Command 3061 Arguments: sequence set 3062 message data item name 3063 value for message data item 3065 Responses: untagged responses: FETCH 3067 Result: OK - store completed 3068 NO - store error: can't store that data 3069 BAD - command unknown or arguments invalid 3071 The STORE command alters data associated with a message in the 3072 mailbox. Normally, STORE will return the updated value of the data 3073 with an untagged FETCH response. A suffix of ".SILENT" in the data 3074 item name prevents the untagged FETCH, and the server SHOULD assume 3075 that the client has determined the updated value itself or does not 3076 care about the updated value. 3078 Note: Regardless of whether or not the ".SILENT" suffix was used, 3079 the server SHOULD send an untagged FETCH response if a change to a 3080 message's flags from an external source is observed. The intent 3081 is that the status of the flags is determinate without a race 3082 condition. 3084 The currently defined data items that can be stored are: 3086 FLAGS Replace the flags for the message with the 3087 argument. The new value of the flags is returned as if a FETCH of 3088 those flags was done. 3090 FLAGS.SILENT Equivalent to FLAGS, but without returning 3091 a new value. 3093 +FLAGS Add the argument to the flags for the message. 3094 The new value of the flags is returned as if a FETCH of those 3095 flags was done. 3097 +FLAGS.SILENT Equivalent to +FLAGS, but without 3098 returning a new value. 3100 -FLAGS Remove the argument from the flags for the 3101 message. The new value of the flags is returned as if a FETCH of 3102 those flags was done. 3104 -FLAGS.SILENT Equivalent to -FLAGS, but without 3105 returning a new value. 3107 Example: C: A003 STORE 2:4 +FLAGS (\Deleted) 3108 S: * 2 FETCH (FLAGS (\Deleted \Seen)) 3109 S: * 3 FETCH (FLAGS (\Deleted)) 3110 S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen)) 3111 S: A003 OK STORE completed 3113 6.4.8. COPY Command 3115 Arguments: sequence set 3116 mailbox name 3118 Responses: no specific responses for this command 3120 Result: OK - copy completed 3121 NO - copy error: can't copy those messages or to that 3122 name 3123 BAD - command unknown or arguments invalid 3125 The COPY command copies the specified message(s) to the end of the 3126 specified destination mailbox. The flags and internal date of the 3127 message(s) SHOULD be preserved in the copy. 3129 If the destination mailbox does not exist, a server SHOULD return an 3130 error. It SHOULD NOT automatically create the mailbox. Unless it is 3131 certain that the destination mailbox can not be created, the server 3132 MUST send the response code "[TRYCREATE]" as the prefix of the text 3133 of the tagged NO response. This gives a hint to the client that it 3134 can attempt a CREATE command and retry the COPY if the CREATE is 3135 successful. 3137 If the COPY command is unsuccessful for any reason, server 3138 implementations MUST restore the destination mailbox to its state 3139 before the COPY attempt. 3141 On successful completion of a COPY, the server SHOULD return a 3142 COPYUID response code. 3144 In the case of a mailbox that has permissions set so that the client 3145 can COPY to the mailbox, but not SELECT or EXAMINE it, the server 3146 SHOULD NOT send an COPYUID response code as it would disclose 3147 information about the mailbox. 3149 In the case of a mailbox that has UIDNOTSTICKY status (see the 3150 UIDNOTSTICKY response code), the server MAY omit the COPYUID response 3151 code as it is not meaningful. 3153 If the server does not return the COPYUID response code, the client 3154 can discover this information by selecting the destination mailbox. 3155 The location of messages placed in the destination mailbox by COPY 3156 can be determined by using FETCH and/or SEARCH commands (e.g., for 3157 Message-ID). 3159 Example: C: A003 COPY 2:4 MEETING 3160 S: A003 OK COPY completed 3162 6.4.9. MOVE Command 3164 Arguments: sequence set 3165 mailbox name 3167 Responses: no specific responses for this command 3169 Result: OK - move completed 3170 NO - move error: can't move those messages or to that 3171 name 3172 BAD - command unknown or arguments invalid 3174 The MOVE command moves the specified message(s) to the end of the 3175 specified destination mailbox. The flags and internal date of the 3176 message(s) SHOULD be preserved. 3178 This means that a new message is created in the target mailbox with a 3179 new UID, the original message is removed from the source mailbox, and 3180 it appears to the client as a single action. This has the same 3181 effect for each message as this sequence: 3183 1. [UID] COPY 3185 2. [UID] STORE +FLAGS.SILENT \DELETED 3187 3. UID EXPUNGE 3189 Although the effect of the MOVE is the same as the preceding steps, 3190 the semantics are not identical: The intermediate states produced by 3191 those steps do not occur, and the response codes are different. In 3192 particular, though the COPY and EXPUNGE response codes will be 3193 returned, response codes for a STORE MUST NOT be generated and the 3194 \Deleted flag MUST NOT be set for any message. 3196 Because a MOVE applies to a set of messages, it might fail partway 3197 through the set. Regardless of whether the command is successful in 3198 moving the entire set, each individual message SHOULD either be moved 3199 or unaffected. The server MUST leave each message in a state where 3200 it is in at least one of the source or target mailboxes (no message 3201 can be lost or orphaned). The server SHOULD NOT leave any message in 3202 both mailboxes (it would be bad for a partial failure to result in a 3203 bunch of duplicate messages). This is true even if the server 3204 returns a tagged NO response to the command. 3206 Because of the similarity of MOVE to COPY, extensions that affect 3207 COPY affect MOVE in the same way. Response codes such as TRYCREATE 3208 (see Section 7.1), as well as those defined by extensions, are sent 3209 as appropriate. 3211 Servers SHOULD send COPYUID in response to a UID MOVE (see 3212 Section 6.4.10) command. For additional information see Section 7.1. 3214 Servers are also advised to send the COPYUID response code in an 3215 untagged OK before sending EXPUNGE or moved responses. (Sending 3216 COPYUID in the tagged OK, as described in the UIDPLUS specification, 3217 means that clients first receive an EXPUNGE for a message and 3218 afterwards COPYUID for the same message. It can be unnecessarily 3219 difficult to process that sequence usefully.) 3221 An example: 3222 C: a UID MOVE 42:69 foo 3223 S: * OK [COPYUID 432432 42:69 1202:1229] 3224 S: * 22 EXPUNGE 3225 S: (more expunges) 3226 S: a OK Done 3228 Note that the server may send unrelated EXPUNGE responses as well, if 3229 any happen to have been expunged at the same time; this is normal 3230 IMAP operation. 3232 Note that moving a message to the currently selected mailbox (that 3233 is, where the source and target mailboxes are the same) is allowed 3234 when copying the message to the currently selected mailbox is 3235 allowed. 3237 The server may send EXPUNGE responses before the tagged response, so 3238 the client cannot safely send more commands with message sequence 3239 number arguments while the server is processing MOVE. 3241 MOVE and UID MOVE can be pipelined with other commands, but care has 3242 to be taken. Both commands modify sequence numbers and also allow 3243 unrelated EXPUNGE responses. The renumbering of other messages in 3244 the source mailbox following any EXPUNGE response can be surprising 3245 and makes it unsafe to pipeline any command that relies on message 3246 sequence numbers after a MOVE or UID MOVE. Similarly, MOVE cannot be 3247 pipelined with a command that might cause message renumbering. See 3248 Section 5.5, for more information about ambiguities as well as 3249 handling requirements for both clients and servers. 3251 6.4.10. UID Command 3253 Arguments: command name 3254 command arguments 3256 Responses: untagged responses: FETCH, ESEARCH 3258 Result: OK - UID command completed 3259 NO - UID command error 3260 BAD - command unknown or arguments invalid 3262 The UID command has three forms. In the first form, it takes as its 3263 arguments a COPY, MOVE, FETCH, or STORE command with arguments 3264 appropriate for the associated command. However, the numbers in the 3265 sequence set argument are unique identifiers instead of message 3266 sequence numbers. Sequence set ranges are permitted, but there is no 3267 guarantee that unique identifiers will be contiguous. 3269 A non-existent unique identifier is ignored without any error message 3270 generated. Thus, it is possible for a UID FETCH command to return an 3271 OK without any data or a UID COPY, UID MOVE or UID STORE to return an 3272 OK without performing any operations. 3274 In the second form, the UID command takes an EXPUNGE command with an 3275 extra parameter the specified a sequence set of UIDs to operate on. 3276 The UID EXPUNGE command permanently removes all messages that both 3277 have the \Deleted flag set and have a UID that is included in the 3278 specified sequence set from the currently selected mailbox. If a 3279 message either does not have the \Deleted flag set or has a UID that 3280 is not included in the specified sequence set, it is not affected. 3282 UID EXPUNGE is particularly useful for disconnected use clients. 3283 By using UID EXPUNGE instead of EXPUNGE when resynchronizing with 3284 the server, the client can ensure that it does not inadvertantly 3285 remove any messages that have been marked as \Deleted by other 3286 clients between the time that the client was last connected and 3287 the time the client resynchronizes. 3289 Example: C: A003 UID EXPUNGE 3000:3002 3290 S: * 3 EXPUNGE 3291 S: * 3 EXPUNGE 3292 S: * 3 EXPUNGE 3293 S: A003 OK UID EXPUNGE completed 3295 In the third form, the UID command takes a SEARCH command with SEARCH 3296 command arguments. The interpretation of the arguments is the same 3297 as with SEARCH; however, the numbers returned in a ESEARCH response 3298 for a UID SEARCH command are unique identifiers instead of message 3299 sequence numbers. Also, the corresponding ESEARCH response MUST 3300 include the UID indicator. For example, the command UID SEARCH 1:100 3301 UID 443:557 returns the unique identifiers corresponding to the 3302 intersection of two sequence sets, the message sequence number range 3303 1:100 and the UID range 443:557. 3305 Note: in the above example, the UID range 443:557 appears. The 3306 same comment about a non-existent unique identifier being ignored 3307 without any error message also applies here. Hence, even if 3308 neither UID 443 or 557 exist, this range is valid and would 3309 include an existing UID 495. 3311 Also note that a UID range of 559:* always includes the UID of the 3312 last message in the mailbox, even if 559 is higher than any 3313 assigned UID value. This is because the contents of a range are 3314 independent of the order of the range endpoints. Thus, any UID 3315 range with * as one of the endpoints indicates at least one 3316 message (the message with the highest numbered UID), unless the 3317 mailbox is empty. 3319 The number after the "*" in an untagged FETCH or EXPUNGE response is 3320 always a message sequence number, not a unique identifier, even for a 3321 UID command response. However, server implementations MUST 3322 implicitly include the UID message data item as part of any FETCH 3323 response caused by a UID command, regardless of whether a UID was 3324 specified as a message data item to the FETCH. 3326 Note: The rule about including the UID message data item as part of a 3327 FETCH response primarily applies to the UID FETCH and UID STORE 3328 commands, including a UID FETCH command that does not include UID as 3329 a message data item. Although it is unlikely that the other UID 3330 commands will cause an untagged FETCH, this rule applies to these 3331 commands as well. 3333 Example: C: A999 UID FETCH 4827313:4828442 FLAGS 3334 S: * 23 FETCH (FLAGS (\Seen) UID 4827313) 3335 S: * 24 FETCH (FLAGS (\Seen) UID 4827943) 3336 S: * 25 FETCH (FLAGS (\Seen) UID 4828442) 3337 S: A999 OK UID FETCH completed 3339 6.5. Client Commands - Experimental/Expansion 3341 6.5.1. X Command 3343 Arguments: implementation defined 3345 Responses: implementation defined 3347 Result: OK - command completed 3348 NO - failure 3349 BAD - command unknown or arguments invalid 3351 Any command prefixed with an X is an experimental command. Commands 3352 which are not part of this specification, a standard or standards- 3353 track revision of this specification, or an IESG-approved 3354 experimental protocol, MUST use the X prefix. 3356 Any added untagged responses issued by an experimental command MUST 3357 also be prefixed with an X. Server implementations MUST NOT send any 3358 such untagged responses, unless the client requested it by issuing 3359 the associated experimental command. 3361 Example: C: a441 CAPABILITY 3362 S: * CAPABILITY IMAP4rev2 XPIG-LATIN 3363 S: a441 OK CAPABILITY completed 3364 C: A442 XPIG-LATIN 3365 S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay 3366 S: A442 OK XPIG-LATIN ompleted-cay 3368 7. Server Responses 3370 Server responses are in three forms: status responses, server data, 3371 and command continuation request. The information contained in a 3372 server response, identified by "Contents:" in the response 3373 descriptions below, is described by function, not by syntax. The 3374 precise syntax of server responses is described in the Formal Syntax 3375 section. 3377 The client MUST be prepared to accept any response at all times. 3379 Status responses can be tagged or untagged. Tagged status responses 3380 indicate the completion result (OK, NO, or BAD status) of a client 3381 command, and have a tag matching the command. 3383 Some status responses, and all server data, are untagged. An 3384 untagged response is indicated by the token "*" instead of a tag. 3385 Untagged status responses indicate server greeting, or server status 3386 that does not indicate the completion of a command (for example, an 3387 impending system shutdown alert). For historical reasons, untagged 3388 server data responses are also called "unsolicited data", although 3389 strictly speaking, only unilateral server data is truly 3390 "unsolicited". 3392 Certain server data MUST be recorded by the client when it is 3393 received; this is noted in the description of that data. Such data 3394 conveys critical information which affects the interpretation of all 3395 subsequent commands and responses (e.g., updates reflecting the 3396 creation or destruction of messages). 3398 Other server data SHOULD be recorded for later reference; if the 3399 client does not need to record the data, or if recording the data has 3400 no obvious purpose (e.g., a SEARCH response when no SEARCH command is 3401 in progress), the data SHOULD be ignored. 3403 An example of unilateral untagged server data occurs when the IMAP 3404 connection is in the selected state. In the selected state, the 3405 server checks the mailbox for new messages as part of command 3406 execution. Normally, this is part of the execution of every command; 3407 hence, a NOOP command suffices to check for new messages. If new 3408 messages are found, the server sends untagged EXISTS response 3409 reflecting the new size of the mailbox. Server implementations that 3410 offer multiple simultaneous access to the same mailbox SHOULD also 3411 send appropriate unilateral untagged FETCH and EXPUNGE responses if 3412 another agent changes the state of any message flags or expunges any 3413 messages. 3415 Command continuation request responses use the token "+" instead of a 3416 tag. These responses are sent by the server to indicate acceptance 3417 of an incomplete client command and readiness for the remainder of 3418 the command. 3420 7.1. Server Responses - Status Responses 3422 Status responses are OK, NO, BAD, PREAUTH and BYE. OK, NO, and BAD 3423 can be tagged or untagged. PREAUTH and BYE are always untagged. 3425 Status responses MAY include an OPTIONAL "response code". A response 3426 code consists of data inside square brackets in the form of an atom, 3427 possibly followed by a space and arguments. The response code 3428 contains additional information or status codes for client software 3429 beyond the OK/NO/BAD condition, and are defined when there is a 3430 specific action that a client can take based upon the additional 3431 information. 3433 The currently defined response codes are: 3435 ALERT The human-readable text contains a special alert that MUST be 3436 presented to the user in a fashion that calls the user's attention 3437 to the message. 3439 ALREADYEXISTS 3441 The operation attempts to create something that already exists, 3442 such as when the CREATE or RENAME directories attempt to create 3443 a mailbox and there is already one of that name. 3445 C: o RENAME this that 3446 S: o NO [ALREADYEXISTS] Mailbox "that" already exists 3448 APPENDUID 3450 Followed by the UIDVALIDITY of the destination mailbox and the 3451 UID assigned to the appended message in the destination 3452 mailbox, indicates that the message has been appended to the 3453 destination mailbox with that UID. 3455 If the server also supports the [MULTIAPPEND] extension, and if 3456 multiple messages were appended in the APPEND command, then the 3457 second value is a UID set containing the UIDs assigned to the 3458 appended messages, in the order they were transmitted in the 3459 APPEND command. This UID set may not contain extraneous UIDs 3460 or the symbol "*". 3462 Note: the UID set form of the APPENDUID response code MUST 3463 NOT be used if only a single message was appended. In 3464 particular, a server MUST NOT send a range such as 123:123. 3465 This is because a client that does not support [MULTIAPPEND] 3466 expects only a single UID and not a UID set. 3468 UIDs are assigned in strictly ascending order in the mailbox 3469 (refer to Section 2.3.1.1); note that a range of 12:10 is 3470 exactly equivalent to 10:12 and refers to the sequence 3471 10,11,12. 3473 This response code is returned in a tagged OK response to the 3474 APPEND command. 3476 AUTHENTICATIONFAILED 3478 Authentication failed for some reason on which the server is 3479 unwilling to elaborate. Typically, this includes "unknown 3480 user" and "bad password". 3482 This is the same as not sending any response code, except that 3483 when a client sees AUTHENTICATIONFAILED, it knows that the 3484 problem wasn't, e.g., UNAVAILABLE, so there's no point in 3485 trying the same login/password again later. 3487 C: b LOGIN "fred" "foo" 3488 S: b NO [AUTHENTICATIONFAILED] Authentication failed 3490 AUTHORIZATIONFAILED Authentication succeeded in using the 3491 authentication identity, but the server cannot or will not allow 3492 the authentication identity to act as the requested authorization 3493 identity. This is only applicable when the authentication and 3494 authorization identities are different. C: c1 AUTHENTICATE PLAIN 3495 [...] 3496 S: c1 NO [AUTHORIZATIONFAILED] No such authorization-ID 3497 C: c2 AUTHENTICATE PLAIN 3498 [...] 3499 S: c2 NO [AUTHORIZATIONFAILED] Authenticator is not an admin 3501 BADCHARSET Optionally followed by a parenthesized list of charsets. 3502 A SEARCH failed because the given charset is not supported by this 3503 implementation. If the optional list of charsets is given, this 3504 lists the charsets that are supported by this implementation. 3506 CANNOT 3508 The operation violates some invariant of the server and can 3509 never succeed. 3511 C: l create "///////" 3512 S: l NO [CANNOT] Adjacent slashes are not supported 3514 CAPABILITY Followed by a list of capabilities. This can appear in 3515 the initial OK or PREAUTH response to transmit an initial 3516 capabilities list. This makes it unnecessary for a client to send 3517 a separate CAPABILITY command if it recognizes this response. 3519 CLIENTBUG 3521 The server has detected a client bug. This can accompany all 3522 of OK, NO, and BAD, depending on what the client bug is. 3524 C: k1 select "/archive/projects/experiment-iv" 3525 [...] 3526 S: k1 OK [READ-ONLY] Done 3527 C: k2 status "/archive/projects/experiment-iv" (messages) 3528 [...] 3529 S: k2 OK [CLIENTBUG] Done 3531 CLOSED 3533 The CLOSED response code has no parameters. A server return 3534 the CLOSED response code when the currently selected mailbox is 3535 closed implicitly using the SELECT/EXAMINE command on another 3536 mailbox. The CLOSED response code serves as a boundary between 3537 responses for the previously opened mailbox (which was closed) 3538 and the newly selected mailbox; all responses before the CLOSED 3539 response code relate to the mailbox that was closed, and all 3540 subsequent responses relate to the newly opened mailbox. 3542 There is no need to return the CLOSED response code on 3543 completion of the CLOSE or the UNSELECT command (or similar), 3544 whose purpose is to close the currently selected mailbox 3545 without opening a new one. 3547 The server can also return an unsolicited CLOSED response code 3548 when it wants to force the client to return to authenticated 3549 state. For example, the server can do that when the mailbox 3550 requires repairs or is deleted in another session. 3552 CONTACTADMIN 3554 The user should contact the system administrator or support 3555 desk. 3557 C: e login "fred" "foo" 3558 S: e OK [CONTACTADMIN] 3560 COPYUID 3562 Followed by the UIDVALIDITY of the destination mailbox, a UID 3563 set containing the UIDs of the message(s) in the source mailbox 3564 that were copied to the destination mailbox and containing the 3565 UIDs assigned to the copied message(s) in the destination 3566 mailbox, indicates that the message(s) have been copied to the 3567 destination mailbox with the stated UID(s). 3569 The source UID set is in the order the message(s) were copied; 3570 the destination UID set corresponds to the source UID set and 3571 is in the same order. Neither of the UID sets may contain 3572 extraneous UIDs or the symbol "*". 3574 UIDs are assigned in strictly ascending order in the mailbox 3575 (refer to Section 2.3.1.1); note that a range of 12:10 is 3576 exactly equivalent to 10:12 and refers to the sequence 3577 10,11,12. 3579 This response code is returned in a tagged OK response to the 3580 COPY command. 3582 CORRUPTION 3584 The server discovered that some relevant data (e.g., the 3585 mailbox) are corrupt. This response code does not include any 3586 information about what's corrupt, but the server can write that 3587 to its logfiles. 3589 C: i select "/archive/projects/experiment-iv" 3590 S: i NO [CORRUPTION] Cannot open mailbox 3592 EXPIRED 3594 Either authentication succeeded or the server no longer had the 3595 necessary data; either way, access is no longer permitted using 3596 that passphrase. The client or user should get a new 3597 passphrase. 3599 C: d login "fred" "foo" 3600 S: d NO [EXPIRED] That password isn't valid any more 3602 EXPUNGEISSUED 3604 Someone else has issued an EXPUNGE for the same mailbox. The 3605 client may want to issue NOOP soon. [IMAP-MULTIACCESS] 3606 discusses this subject in depth. 3608 C: h search from fred@example.com 3609 S: * SEARCH 1 2 3 5 8 13 21 42 3610 S: h OK [EXPUNGEISSUED] Search completed 3612 INUSE 3614 An operation has not been carried out because it involves 3615 sawing off a branch someone else is sitting on. Someone else 3616 may be holding an exclusive lock needed for this operation, or 3617 the operation may involve deleting a resource someone else is 3618 using, typically a mailbox. 3620 The operation may succeed if the client tries again later. 3622 C: g delete "/archive/projects/experiment-iv" 3623 S: g NO [INUSE] Mailbox in use 3625 LIMIT 3627 The operation ran up against an implementation limit of some 3628 kind, such as the number of flags on a single message or the 3629 number of flags used in a mailbox. 3631 C: m STORE 42 FLAGS f1 f2 f3 f4 f5 ... f250 3632 S: m NO [LIMIT] At most 32 flags in one mailbox supported 3634 NONEXISTENT 3636 The operation attempts to delete something that does not exist. 3637 Similar to ALREADYEXISTS. 3639 C: p RENAME this that 3640 S: p NO [NONEXISTENT] No such mailbox 3642 NOPERM 3644 The access control system (e.g., Access Control List (ACL), see 3645 [RFC4314] does not permit this user to carry out an operation, 3646 such as selecting or creating a mailbox. 3648 C: f select "/archive/projects/experiment-iv" 3649 S: f NO [NOPERM] Access denied 3651 OVERQUOTA 3653 The user would be over quota after the operation. (The user 3654 may or may not be over quota already.) 3656 Note that if the server sends OVERQUOTA but doesn't support the 3657 IMAP QUOTA extension defined by [RFC2087], then there is a 3658 quota, but the client cannot find out what the quota is. 3660 C: n1 uid copy 1:* oldmail 3661 S: n1 NO [OVERQUOTA] Sorry 3663 C: n2 uid copy 1:* oldmail 3664 S: n2 OK [OVERQUOTA] You are now over your soft quota 3666 PARSE The human-readable text represents an error in parsing the 3667 [RFC-5322] header or [MIME-IMB] headers of a message in the 3668 mailbox. 3670 PERMANENTFLAGS Followed by a parenthesized list of flags, indicates 3671 which of the known flags the client can change permanently. Any 3672 flags that are in the FLAGS untagged response, but not the 3673 PERMANENTFLAGS list, can not be set permanently. If the client 3674 attempts to STORE a flag that is not in the PERMANENTFLAGS list, 3675 the server will either ignore the change or store the state change 3676 for the remainder of the current session only. The PERMANENTFLAGS 3677 list can also include the special flag \*, which indicates that it 3678 is possible to create new keywords by attempting to store those 3679 flags in the mailbox. 3681 PRIVACYREQUIRED 3683 The operation is not permitted due to a lack of privacy. If 3684 Transport Layer Security (TLS) is not in use, the client could 3685 try STARTTLS (see Section 6.2.1) and then repeat the operation. 3687 C: d login "fred" "foo" 3688 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3690 C: d select inbox 3691 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3693 READ-ONLY The mailbox is selected read-only, or its access while 3694 selected has changed from read-write to read-only. 3696 READ-WRITE The mailbox is selected read-write, or its access while 3697 selected has changed from read-only to read-write. 3699 SERVERBUG 3701 The server encountered a bug in itself or violated one of its 3702 own invariants. 3704 C: j select "/archive/projects/experiment-iv" 3705 S: j NO [SERVERBUG] This should not happen 3707 TRYCREATE An APPEND or COPY attempt is failing because the target 3708 mailbox does not exist (as opposed to some other reason). This is 3709 a hint to the client that the operation can succeed if the mailbox 3710 is first created by the CREATE command. 3712 UIDNEXT Followed by a decimal number, indicates the next unique 3713 identifier value. Refer to Section 2.3.1.1 for more information. 3715 UIDNOTSTICKY 3717 The selected mailbox is supported by a mail store that does not 3718 support persistent UIDs; that is, UIDVALIDITY will be different 3719 each time the mailbox is selected. Consequently, APPEND or 3720 COPY to this mailbox will not return an APPENDUID or COPYUID 3721 response code. 3723 This response code is returned in an untagged NO response to 3724 the SELECT command. 3726 Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores. 3727 This facility exists to support legacy mail stores in which 3728 it is technically infeasible to support persistent UIDs. 3729 This should be avoided when designing new mail stores. 3731 UIDVALIDITY Followed by a decimal number, indicates the unique 3732 identifier validity value. Refer to Section 2.3.1.1 for more 3733 information. 3735 UNAVAILABLE 3737 Temporary failure because a subsystem is down. For example, an 3738 IMAP server that uses a Lightweight Directory Access Protocol 3739 (LDAP) or Radius server for authentication might use this 3740 response code when the LDAP/Radius server is down. 3742 C: a LOGIN "fred" "foo" 3743 S: a NO [UNAVAILABLE] User's backend down for maintenance 3745 UNKNOWN-CTE 3747 The server does not know how to decode the section's Content- 3748 Transfer-Encoding. 3750 Additional response codes defined by particular client or server 3751 implementations SHOULD be prefixed with an "X" until they are added 3752 to a revision of this protocol. Client implementations SHOULD ignore 3753 response codes that they do not recognize. 3755 7.1.1. OK Response 3757 Contents: OPTIONAL response code 3758 human-readable text 3760 The OK response indicates an information message from the server. 3761 When tagged, it indicates successful completion of the associated 3762 command. The human-readable text MAY be presented to the user as an 3763 information message. The untagged form indicates an information-only 3764 message; the nature of the information MAY be indicated by a response 3765 code. 3767 The untagged form is also used as one of three possible greetings at 3768 connection startup. It indicates that the connection is not yet 3769 authenticated and that a LOGIN or an AUTHENTICATE command is needed. 3771 Example: S: * OK IMAP4rev2 server ready 3772 C: A001 LOGIN fred blurdybloop 3773 S: * OK [ALERT] System shutdown in 10 minutes 3774 S: A001 OK LOGIN Completed 3776 7.1.2. NO Response 3778 Contents: OPTIONAL response code 3779 human-readable text 3781 The NO response indicates an operational error message from the 3782 server. When tagged, it indicates unsuccessful completion of the 3783 associated command. The untagged form indicates a warning; the 3784 command can still complete successfully. The human-readable text 3785 describes the condition. 3787 Example: C: A222 COPY 1:2 owatagusiam 3788 S: * NO Disk is 98% full, please delete unnecessary data 3789 S: A222 OK COPY completed 3790 C: A223 COPY 3:200 blurdybloop 3791 S: * NO Disk is 98% full, please delete unnecessary data 3792 S: * NO Disk is 99% full, please delete unnecessary data 3793 S: A223 NO COPY failed: disk is full 3795 7.1.3. BAD Response 3797 Contents: OPTIONAL response code 3798 human-readable text 3800 The BAD response indicates an error message from the server. When 3801 tagged, it reports a protocol-level error in the client's command; 3802 the tag indicates the command that caused the error. The untagged 3803 form indicates a protocol-level error for which the associated 3804 command can not be determined; it can also indicate an internal 3805 server failure. The human-readable text describes the condition. 3807 Example: C: ...very long command line... 3808 S: * BAD Command line too long 3809 C: ...empty line... 3810 S: * BAD Empty command line 3811 C: A443 EXPUNGE 3812 S: * BAD Disk crash, attempting salvage to a new disk! 3813 S: * OK Salvage successful, no data lost 3814 S: A443 OK Expunge completed 3816 7.1.4. PREAUTH Response 3818 Contents: OPTIONAL response code 3819 human-readable text 3821 The PREAUTH response is always untagged, and is one of three possible 3822 greetings at connection startup. It indicates that the connection 3823 has already been authenticated by external means; thus no LOGIN/ 3824 AUTHENTICATE command is needed. 3826 Example: S: * PREAUTH IMAP4rev2 server logged in as Smith 3828 7.1.5. BYE Response 3830 Contents: OPTIONAL response code 3831 human-readable text 3833 The BYE response is always untagged, and indicates that the server is 3834 about to close the connection. The human-readable text MAY be 3835 displayed to the user in a status report by the client. The BYE 3836 response is sent under one of four conditions: 3838 1. as part of a normal logout sequence. The server will close the 3839 connection after sending the tagged OK response to the LOGOUT 3840 command. 3842 2. as a panic shutdown announcement. The server closes the 3843 connection immediately. 3845 3. as an announcement of an inactivity autologout. The server 3846 closes the connection immediately. 3848 4. as one of three possible greetings at connection startup, 3849 indicating that the server is not willing to accept a connection 3850 from this client. The server closes the connection immediately. 3852 The difference between a BYE that occurs as part of a normal LOGOUT 3853 sequence (the first case) and a BYE that occurs because of a failure 3854 (the other three cases) is that the connection closes immediately in 3855 the failure case. In all cases the client SHOULD continue to read 3856 response data from the server until the connection is closed; this 3857 will ensure that any pending untagged or completion responses are 3858 read and processed. 3860 Example: S: * BYE Autologout; idle for too long 3862 7.2. Server Responses - Server and Mailbox Status 3864 These responses are always untagged. This is how server and mailbox 3865 status data are transmitted from the server to the client. Many of 3866 these responses typically result from a command with the same name. 3868 7.2.1. The ENABLED Response 3870 Contents: capability listing 3872 The ENABLED response occurs as a result of an ENABLE command. The 3873 capability listing contains a space-separated listing of capability 3874 names that the server supports and that were successfully enabled. 3875 The ENABLED response may contain no capabilities, which means that no 3876 extensions listed by the client were successfully enabled. 3878 7.2.2. CAPABILITY Response 3880 Contents: capability listing 3881 The CAPABILITY response occurs as a result of a CAPABILITY command. 3882 The capability listing contains a space-separated listing of 3883 capability names that the server supports. The capability listing 3884 MUST include the atom "IMAP4rev2". 3886 In addition, client and server implementations MUST implement the 3887 STARTTLS, LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) 3888 capabilities. See the Security Considerations section for important 3889 information. 3891 A capability name which begins with "AUTH=" indicates that the server 3892 supports that particular authentication mechanism. 3894 The LOGINDISABLED capability indicates that the LOGIN command is 3895 disabled, and that the server will respond with a tagged NO response 3896 to any attempt to use the LOGIN command even if the user name and 3897 password are valid. An IMAP client MUST NOT issue the LOGIN command 3898 if the server advertises the LOGINDISABLED capability. 3900 Other capability names indicate that the server supports an 3901 extension, revision, or amendment to the IMAP4rev2 protocol. Server 3902 responses MUST conform to this document until the client issues a 3903 command that uses the associated capability. 3905 Capability names MUST either begin with "X" or be standard or 3906 standards-track IMAP4rev2 extensions, revisions, or amendments 3907 registered with IANA. A server MUST NOT offer unregistered or non- 3908 standard capability names, unless such names are prefixed with an 3909 "X". 3911 Client implementations SHOULD NOT require any capability name other 3912 than "IMAP4rev2", and MUST ignore any unknown capability names. 3914 A server MAY send capabilities automatically, by using the CAPABILITY 3915 response code in the initial PREAUTH or OK responses, and by sending 3916 an updated CAPABILITY response code in the tagged OK response as part 3917 of a successful authentication. It is unnecessary for a client to 3918 send a separate CAPABILITY command if it recognizes these automatic 3919 capabilities. 3921 Example: S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI XPIG-LATIN 3923 7.2.3. LIST Response 3925 Contents: name attributes 3926 hierarchy delimiter 3927 name 3929 The LIST response occurs as a result of a LIST command. It returns a 3930 single name that matches the LIST specification. There can be 3931 multiple LIST responses for a single LIST command. 3933 The following base name attributes are defined: 3935 \Noinferiors It is not possible for any child levels of hierarchy to 3936 exist under this name; no child levels exist now and none can be 3937 created in the future. 3939 \Noselect It is not possible to use this name as a selectable 3940 mailbox. 3942 \HasChildren The presence of this attribute indicates that the 3943 mailbox has child mailboxes. A server SHOULD NOT set this 3944 attribute if there are child mailboxes and the user does not have 3945 permission to access any of them. In this case, \HasNoChildren 3946 SHOULD be used. In many cases, however, a server may not be able 3947 to efficiently compute whether a user has access to any child 3948 mailbox. Note that even though the \HasChildren attribute for a 3949 mailbox must be correct at the time of processing of the mailbox, 3950 a client must be prepared to deal with a situation when a mailbox 3951 is marked with the \HasChildren attribute, but no child mailbox 3952 appears in the response to the LIST command. This might happen, 3953 for example, due to children mailboxes being deleted or made 3954 inaccessible to the user (using access control) by another client 3955 before the server is able to list them. 3957 \HasNoChildren The presence of this attribute indicates that the 3958 mailbox has NO child mailboxes that are accessible to the 3959 currently authenticated user. 3961 \Marked The mailbox has been marked "interesting" by the server; the 3962 mailbox probably contains messages that have been added since the 3963 last time the mailbox was selected. 3965 \Unmarked The mailbox does not contain any additional messages since 3966 the last time the mailbox was selected. 3968 It is an error for the server to return both a \HasChildren and a 3969 \HasNoChildren attribute in the same LIST response. 3971 Note: the \HasNoChildren attribute should not be confused with the 3972 \NoInferiors attribute, which indicates that no child mailboxes 3973 exist now and none can be created in the future. 3975 If it is not feasible for the server to determine whether or not the 3976 mailbox is "interesting", the server SHOULD NOT send either \Marked 3977 or \Unmarked. The server MUST NOT send more than one of \Marked, 3978 \Unmarked, and \Noselect for a single mailbox, and MAY send none of 3979 these. 3981 In addition to the base name attributes defined above, an IMAP server 3982 MAY also include any or all of the following attributes that denote 3983 "role" (or "special-use") of a mailbox. These attributes are 3984 included along with base attributes defined above. A given mailbox 3985 may have none, one, or more than one of these attributes. In some 3986 cases, a special use is advice to a client about what to put in that 3987 mailbox. In other cases, it's advice to a client about what to 3988 expect to find there. 3990 \All This mailbox presents all messages in the user's message store. 3991 Implementations MAY omit some messages, such as, perhaps, those in 3992 \Trash and \Junk. When this special use is supported, it is 3993 almost certain to represent a virtual mailbox. 3995 \Archive This mailbox is used to archive messages. The meaning of 3996 an "archival" mailbox is server-dependent; typically, it will be 3997 used to get messages out of the inbox, or otherwise keep them out 3998 of the user's way, while still making them accessible. 4000 \Drafts This mailbox is used to hold draft messages -- typically, 4001 messages that are being composed but have not yet been sent. In 4002 some server implementations, this might be a virtual mailbox, 4003 containing messages from other mailboxes that are marked with the 4004 "\Draft" message flag. Alternatively, this might just be advice 4005 that a client put drafts here. 4007 \Flagged This mailbox presents all messages marked in some way as 4008 "important". When this special use is supported, it is likely to 4009 represent a virtual mailbox collecting messages (from other 4010 mailboxes) that are marked with the "\Flagged" message flag. 4012 \Junk This mailbox is where messages deemed to be junk mail are 4013 held. Some server implementations might put messages here 4014 automatically. Alternatively, this might just be advice to a 4015 client-side spam filter. 4017 \Sent This mailbox is used to hold copies of messages that have been 4018 sent. Some server implementations might put messages here 4019 automatically. Alternatively, this might just be advice that a 4020 client save sent messages here. 4022 \Trash This mailbox is used to hold messages that have been deleted 4023 or marked for deletion. In some server implementations, this 4024 might be a virtual mailbox, containing messages from other 4025 mailboxes that are marked with the "\Deleted" message flag. 4026 Alternatively, this might just be advice that a client that 4027 chooses not to use the IMAP "\Deleted" model should use this as 4028 its trash location. In server implementations that strictly 4029 expect the IMAP "\Deleted" model, this special use is likely not 4030 to be supported. 4032 All of special-use attributes are OPTIONAL, and any given server or 4033 message store may support any combination of the attributes, or none 4034 at all. In most cases, there will likely be at most one mailbox with 4035 a given attribute for a given user, but in some server or message 4036 store implementations it might be possible for multiple mailboxes to 4037 have the same special-use attribute. 4039 Special-use attributes are likely to be user-specific. User Adam 4040 might share his \Sent mailbox with user Barb, but that mailbox is 4041 unlikely to also serve as Barb's \Sent mailbox. 4043 The hierarchy delimiter is a character used to delimit levels of 4044 hierarchy in a mailbox name. A client can use it to create child 4045 mailboxes, and to search higher or lower levels of naming hierarchy. 4046 All children of a top-level hierarchy node MUST use the same 4047 separator character. A NIL hierarchy delimiter means that no 4048 hierarchy exists; the name is a "flat" name. 4050 The name represents an unambiguous left-to-right hierarchy, and MUST 4051 be valid for use as a reference in LIST and LSUB commands. Unless 4052 \Noselect is indicated, the name MUST also be valid as an argument 4053 for commands, such as SELECT, that accept mailbox names. 4055 Example: S: * LIST (\Noselect) "/" ~/Mail/foo 4057 7.2.4. LSUB Response 4059 Contents: name attributes 4060 hierarchy delimiter 4061 name 4063 The LSUB response occurs as a result of an LSUB command. It returns 4064 a single name that matches the LSUB specification. There can be 4065 multiple LSUB responses for a single LSUB command. The data is 4066 identical in format to the LIST response. 4068 Example: S: * LSUB () "." #news.comp.mail.misc 4070 7.2.5. NAMESPACE Response 4072 Contents: the prefix and hierarchy delimiter to the server's 4073 Personal Namespace(s), Other Users' Namespace(s), and 4074 Shared Namespace(s) 4076 The NAMESPACE response occurs as a result of a NAMESPACE command. It 4077 contains the prefix and hierarchy delimiter to the server's Personal 4078 Namespace(s), Other Users' Namespace(s), and Shared Namespace(s) that 4079 the server wishes to expose. The response will contain a NIL for any 4080 namespace class that is not available. Namespace_Response_Extensions 4081 MAY be included in the response. Namespace_Response_Extensions which 4082 are not on the IETF standards track, MUST be prefixed with an "X-". 4084 Example: S: * NAMESPACE (("" "/")) (("~" "/")) NIL 4086 7.2.6. STATUS Response 4088 Contents: name 4089 status parenthesized list 4091 The STATUS response occurs as a result of an STATUS command. It 4092 returns the mailbox name that matches the STATUS specification and 4093 the requested mailbox status information. 4095 Example: S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 4097 7.2.7. ESEARCH Response 4099 Contents: one or more search-return-data pairs 4101 The ESEARCH response occurs as a result of a SEARCH or UID SEARCH 4102 command. 4104 The ESEARCH response starts with an optional search correlator. If 4105 it is missing, then the response was not caused by a particular IMAP 4106 command, whereas if it is present, it contains the tag of the command 4107 that caused the response to be returned. 4109 The search correlator is followed by an optional UID indicator. If 4110 this indicator is present, all data in the ESEARCH response refers to 4111 UIDs, otherwise all returned data refers to message numbers. 4113 The rest of the ESEARCH response contains one or more search data 4114 pairs. Each pair starts with unique return item name, followed by a 4115 space and the corresponding data. Search data pairs may be returned 4116 in any order. Unless specified otherwise by an extension, any return 4117 item name SHOULD appear only once in an ESEARCH response. 4119 [[TBD: describe the most common search data pairs returned.]] 4121 Example: S: * ESEARCH UID COUNT 5 ALL 4:19,21,28 4123 Example: S: * ESEARCH (TAG "a567") UID COUNT 5 ALL 4:19,21,28 4125 Example: S: * ESEARCH COUNT 5 ALL 1:17,21 4127 7.2.8. FLAGS Response 4129 Contents: flag parenthesized list 4131 The FLAGS response occurs as a result of a SELECT or EXAMINE command. 4132 The flag parenthesized list identifies the flags (at a minimum, the 4133 system-defined flags) that are applicable for this mailbox. Flags 4134 other than the system flags can also exist, depending on server 4135 implementation. 4137 The update from the FLAGS response MUST be recorded by the client. 4139 Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4141 7.3. Server Responses - Mailbox Size 4143 These responses are always untagged. This is how changes in the size 4144 of the mailbox are transmitted from the server to the client. 4145 Immediately following the "*" token is a number that represents a 4146 message count. 4148 7.3.1. EXISTS Response 4150 Contents: none 4152 The EXISTS response reports the number of messages in the mailbox. 4153 This response occurs as a result of a SELECT or EXAMINE command, and 4154 if the size of the mailbox changes (e.g., new messages). 4156 The update from the EXISTS response MUST be recorded by the client. 4158 Example: S: * 23 EXISTS 4160 7.4. Server Responses - Message Status 4162 These responses are always untagged. This is how message data are 4163 transmitted from the server to the client, often as a result of a 4164 command with the same name. Immediately following the "*" token is a 4165 number that represents a message sequence number. 4167 7.4.1. EXPUNGE Response 4169 Contents: none 4171 The EXPUNGE response reports that the specified message sequence 4172 number has been permanently removed from the mailbox. The message 4173 sequence number for each successive message in the mailbox is 4174 immediately decremented by 1, and this decrement is reflected in 4175 message sequence numbers in subsequent responses (including other 4176 untagged EXPUNGE responses). 4178 The EXPUNGE response also decrements the number of messages in the 4179 mailbox; it is not necessary to send an EXISTS response with the new 4180 value. 4182 As a result of the immediate decrement rule, message sequence numbers 4183 that appear in a set of successive EXPUNGE responses depend upon 4184 whether the messages are removed starting from lower numbers to 4185 higher numbers, or from higher numbers to lower numbers. For 4186 example, if the last 5 messages in a 9-message mailbox are expunged, 4187 a "lower to higher" server will send five untagged EXPUNGE responses 4188 for message sequence number 5, whereas a "higher to lower server" 4189 will send successive untagged EXPUNGE responses for message sequence 4190 numbers 9, 8, 7, 6, and 5. 4192 An EXPUNGE response MUST NOT be sent when no command is in progress, 4193 nor while responding to a FETCH, STORE, or SEARCH command. This rule 4194 is necessary to prevent a loss of synchronization of message sequence 4195 numbers between client and server. A command is not "in progress" 4196 until the complete command has been received; in particular, a 4197 command is not "in progress" during the negotiation of command 4198 continuation. 4200 Note: UID FETCH, UID STORE, and UID SEARCH are different commands 4201 from FETCH, STORE, and SEARCH. An EXPUNGE response MAY be sent 4202 during a UID command. 4204 The update from the EXPUNGE response MUST be recorded by the client. 4206 Example: S: * 44 EXPUNGE 4208 7.4.2. FETCH Response 4210 Contents: message data 4212 The FETCH response returns data about a message to the client. The 4213 data are pairs of data item names and their values in parentheses. 4215 This response occurs as the result of a FETCH or STORE command, as 4216 well as by unilateral server decision (e.g., flag updates). 4218 The current data items are: 4220 BINARY[]<> 4222 An or expressing the content of the 4223 specified section after removing any Content-Transfer-Encoding- 4224 related encoding. If is present it refers to the 4225 offset within the DECODED section data. 4227 If the domain of the decoded data is "8bit" and the data does 4228 not contain the NUL octet, the server SHOULD return the data in 4229 a instead of a ; this allows the client to 4230 determine if the "8bit" data contains the NUL octet without 4231 having to explicitly scan the data stream for for NULs. 4233 Messaging clients and servers have been notoriously lax in 4234 their adherence to the Internet CRLF convention for terminating 4235 lines of textual data (text/* media types) in Internet 4236 protocols. When sending data in BINARY[...] FETCH data item, 4237 servers MUST ensure that textual line-oriented sections are 4238 always transmitted using the IMAP4 CRLF line termination 4239 syntax, regardless of the underlying storage representation of 4240 the data on the server. 4242 If the server does not know how to decode the section's 4243 Content-Transfer-Encoding, it MUST fail the request and issue a 4244 "NO" response that contains the "UNKNOWN-CTE" response code. 4246 BINARY.SIZE[] 4248 The size of the section after removing any Content-Transfer- 4249 Encoding-related encoding. The value returned MUST match the 4250 size of the or that will be returned by 4251 the corresponding FETCH BINARY request. 4253 If the server does not know how to decode the section's 4254 Content-Transfer-Encoding, it MUST fail the request and issue a 4255 "NO" response that contains the "UNKNOWN-CTE" response code. 4257 BODY A form of BODYSTRUCTURE without extension data. 4259 BODY[
]<> 4260 A string expressing the body contents of the specified section. 4261 The string SHOULD be interpreted by the client according to the 4262 content transfer encoding, body type, and subtype. 4264 If the origin octet is specified, this string is a substring of 4265 the entire body contents, starting at that origin octet. This 4266 means that BODY[]<0> MAY be truncated, but BODY[] is NEVER 4267 truncated. 4269 Note: The origin octet facility MUST NOT be used by a server 4270 in a FETCH response unless the client specifically requested 4271 it by means of a FETCH of a BODY[
]<> data 4272 item. 4274 8-bit textual data is permitted if a [CHARSET] identifier is 4275 part of the body parameter parenthesized list for this section. 4276 Note that headers (part specifiers HEADER or MIME, or the 4277 header portion of a MESSAGE/RFC822 or MESSAGE/GLOBAL part), MAY 4278 be in UTF-8. Note also that the [RFC-5322] delimiting blank 4279 line between the header and the body is not affected by header 4280 line subsetting; the blank line is always included as part of 4281 header data, except in the case of a message which has no body 4282 and no blank line. 4284 Non-textual data such as binary data MUST be transfer encoded 4285 into a textual form, such as BASE64, prior to being sent to the 4286 client. To derive the original binary data, the client MUST 4287 decode the transfer encoded string. 4289 BODYSTRUCTURE 4291 A parenthesized list that describes the [MIME-IMB] body 4292 structure of a message. This is computed by the server by 4293 parsing the [MIME-IMB] header fields, defaulting various fields 4294 as necessary. 4296 For example, a simple text message of 48 lines and 2279 octets 4297 can have a body structure of: ("TEXT" "PLAIN" ("CHARSET" "US- 4298 ASCII") NIL NIL "7BIT" 2279 48) 4300 Multiple parts are indicated by parenthesis nesting. Instead 4301 of a body type as the first element of the parenthesized list, 4302 there is a sequence of one or more nested body structures. The 4303 second element of the parenthesized list is the multipart 4304 subtype (mixed, digest, parallel, alternative, etc.). 4306 For example, a two part message consisting of a text and a 4307 BASE64-encoded text attachment can have a body structure of: 4309 (("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1152 4310 23)("TEXT" "PLAIN" ("CHARSET" "US-ASCII" "NAME" "cc.diff") 4311 "<960723163407.20117h@cac.washington.edu>" "Compiler diff" 4312 "BASE64" 4554 73) "MIXED") 4314 Extension data follows the multipart subtype. Extension data 4315 is never returned with the BODY fetch, but can be returned with 4316 a BODYSTRUCTURE fetch. Extension data, if present, MUST be in 4317 the defined order. The extension data of a multipart body part 4318 are in the following order: 4320 body parameter parenthesized list A parenthesized list of 4321 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4322 "bar" is the value of "foo", and "rag" is the value of 4323 "baz"] as defined in [MIME-IMB]. Servers SHOULD decode 4324 parameter value continuations as described in [RFC2231]. 4326 body disposition A parenthesized list, consisting of a 4327 disposition type string, followed by a parenthesized list of 4328 disposition attribute/value pairs as defined in 4329 [DISPOSITION]. Servers SHOULD decode parameter value 4330 continuations as described in [RFC2231]. 4332 body language A string or parenthesized list giving the body 4333 language value as defined in [LANGUAGE-TAGS]. 4335 body location A string giving the body content URI as defined 4336 in [LOCATION]. 4338 Any following extension data are not yet defined in this 4339 version of the protocol. Such extension data can consist of 4340 zero or more NILs, strings, numbers, or potentially nested 4341 parenthesized lists of such data. Client implementations that 4342 do a BODYSTRUCTURE fetch MUST be prepared to accept such 4343 extension data. Server implementations MUST NOT send such 4344 extension data until it has been defined by a revision of this 4345 protocol. 4347 The basic fields of a non-multipart body part are in the 4348 following order: 4350 body type A string giving the content media type name as 4351 defined in [MIME-IMB]. 4353 body subtype A string giving the content subtype name as 4354 defined in [MIME-IMB]. 4356 body parameter parenthesized list A parenthesized list of 4357 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4358 "bar" is the value of "foo" and "rag" is the value of "baz"] 4359 as defined in [MIME-IMB]. 4361 body id A string giving the Content-ID header field value as 4362 defined in Section 7 of [MIME-IMB]. 4364 body description A string giving the Content-Description 4365 header field value as defined in Section 8 of [MIME-IMB]. 4367 body encoding A string giving the content transfer encoding as 4368 defined in Section 6 of [MIME-IMB]. 4370 body size A number giving the size of the body in octets. 4371 Note that this size is the size in its transfer encoding and 4372 not the resulting size after any decoding. 4374 A body type of type MESSAGE and subtype RFC822 contains, 4375 immediately after the basic fields, the envelope structure, 4376 body structure, and size in text lines of the encapsulated 4377 message. 4379 A body type of type TEXT contains, immediately after the basic 4380 fields, the size of the body in text lines. Note that this 4381 size is the size in its content transfer encoding and not the 4382 resulting size after any decoding. 4384 Extension data follows the basic fields and the type-specific 4385 fields listed above. Extension data is never returned with the 4386 BODY fetch, but can be returned with a BODYSTRUCTURE fetch. 4387 Extension data, if present, MUST be in the defined order. 4389 The extension data of a non-multipart body part are in the 4390 following order: 4392 body MD5 A string giving the body MD5 value as defined in 4393 [MD5]. 4395 body disposition A parenthesized list with the same content 4396 and function as the body disposition for a multipart body 4397 part. 4399 body language A string or parenthesized list giving the body 4400 language value as defined in [LANGUAGE-TAGS]. 4402 body location A string giving the body content URI as defined 4403 in [LOCATION]. 4405 Any following extension data are not yet defined in this 4406 version of the protocol, and would be as described above under 4407 multipart extension data. 4409 ENVELOPE 4411 A parenthesized list that describes the envelope structure of a 4412 message. This is computed by the server by parsing the 4413 [RFC-5322] header into the component parts, defaulting various 4414 fields as necessary. 4416 The fields of the envelope structure are in the following 4417 order: date, subject, from, sender, reply-to, to, cc, bcc, in- 4418 reply-to, and message-id. The date, subject, in-reply-to, and 4419 message-id fields are strings. The from, sender, reply-to, to, 4420 cc, and bcc fields are parenthesized lists of address 4421 structures. 4423 An address structure is a parenthesized list that describes an 4424 electronic mail address. The fields of an address structure 4425 are in the following order: personal name, [SMTP] at-domain- 4426 list (source route), mailbox name, and host name. 4428 [RFC-5322] group syntax is indicated by a special form of 4429 address structure in which the host name field is NIL. If the 4430 mailbox name field is also NIL, this is an end of group marker 4431 (semi-colon in RFC 822 syntax). If the mailbox name field is 4432 non-NIL, this is a start of group marker, and the mailbox name 4433 field holds the group name phrase. 4435 If the Date, Subject, In-Reply-To, and Message-ID header lines 4436 are absent in the [RFC-5322] header, the corresponding member 4437 of the envelope is NIL; if these header lines are present but 4438 empty the corresponding member of the envelope is the empty 4439 string. 4441 Note: some servers may return a NIL envelope member in the 4442 "present but empty" case. Clients SHOULD treat NIL and 4443 empty string as identical. 4445 Note: [RFC-5322] requires that all messages have a valid 4446 Date header. Therefore, the date member in the envelope can 4447 not be NIL or the empty string. 4449 Note: [RFC-5322] requires that the In-Reply-To and Message- 4450 ID headers, if present, have non-empty content. Therefore, 4451 the in-reply-to and message-id members in the envelope can 4452 not be the empty string. 4454 If the From, To, Cc, and Bcc header lines are absent in the 4455 [RFC-5322] header, or are present but empty, the corresponding 4456 member of the envelope is NIL. 4458 If the Sender or Reply-To lines are absent in the [RFC-5322] 4459 header, or are present but empty, the server sets the 4460 corresponding member of the envelope to be the same value as 4461 the from member (the client is not expected to know to do 4462 this). 4464 Note: [RFC-5322] requires that all messages have a valid 4465 From header. Therefore, the from, sender, and reply-to 4466 members in the envelope can not be NIL. 4468 FLAGS A parenthesized list of flags that are set for this message. 4470 INTERNALDATE A string representing the internal date of the message. 4472 RFC822 Equivalent to BODY[]. 4474 RFC822.HEADER Equivalent to BODY[HEADER]. Note that this did not 4475 result in \Seen being set, because RFC822.HEADER response data 4476 occurs as a result of a FETCH of RFC822.HEADER. BODY[HEADER] 4477 response data occurs as a result of a FETCH of BODY[HEADER] (which 4478 sets \Seen) or BODY.PEEK[HEADER] (which does not set \Seen). 4480 RFC822.SIZE A number expressing the [RFC-5322] size of the message. 4482 RFC822.TEXT Equivalent to BODY[TEXT]. 4484 UID A number expressing the unique identifier of the message. 4486 Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827) 4488 7.5. Server Responses - Command Continuation Request 4490 The command continuation request response is indicated by a "+" token 4491 instead of a tag. This form of response indicates that the server is 4492 ready to accept the continuation of a command from the client. The 4493 remainder of this response is a line of text. 4495 This response is used in the AUTHENTICATE command to transmit server 4496 data to the client, and request additional client data. This 4497 response is also used if an argument to any command is a 4498 synchronizing literal. 4500 The client is not permitted to send the octets of the synchronizing 4501 literal unless the server indicates that it is expected. This 4502 permits the server to process commands and reject errors on a line- 4503 by-line basis. The remainder of the command, including the CRLF that 4504 terminates a command, follows the octets of the literal. If there 4505 are any additional command arguments, the literal octets are followed 4506 by a space and those arguments. 4508 Example: C: A001 LOGIN {11} 4509 S: + Ready for additional command text 4510 C: FRED FOOBAR {7} 4511 S: + Ready for additional command text 4512 C: fat man 4513 S: A001 OK LOGIN completed 4514 C: A044 BLURDYBLOOP {102856} 4515 S: A044 BAD No such command as "BLURDYBLOOP" 4517 8. Sample IMAP4rev2 connection 4519 The following is a transcript of an IMAP4rev2 connection. A long 4520 line in this sample is broken for editorial clarity. 4522 S: * OK IMAP4rev2 Service Ready 4523 C: a001 login mrc secret 4524 S: a001 OK LOGIN completed 4525 C: a002 select inbox 4526 S: * 18 EXISTS 4527 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4528 S: * OK [UIDVALIDITY 3857529045] UIDs valid 4529 S: a002 OK [READ-WRITE] SELECT completed 4530 C: a003 fetch 12 full 4531 S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" 4532 RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" 4533 "IMAP4rev2 WG mtg summary and minutes" 4534 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4535 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4536 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4537 ((NIL NIL "imap" "cac.washington.edu")) 4538 ((NIL NIL "minutes" "CNRI.Reston.VA.US") 4539 ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL 4540 "") 4541 BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 4542 92)) 4543 S: a003 OK FETCH completed 4544 C: a004 fetch 12 body[header] 4545 S: * 12 FETCH (BODY[HEADER] {342} 4546 S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT) 4547 S: From: Terry Gray 4548 S: Subject: IMAP4rev2 WG mtg summary and minutes 4549 S: To: imap@cac.washington.edu 4550 S: cc: minutes@CNRI.Reston.VA.US, John Klensin 4551 S: Message-Id: 4552 S: MIME-Version: 1.0 4553 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 4554 S: 4555 S: ) 4556 S: a004 OK FETCH completed 4557 C: a005 store 12 +flags \deleted 4558 S: * 12 FETCH (FLAGS (\Seen \Deleted)) 4559 S: a005 OK +FLAGS completed 4560 C: a006 logout 4561 S: * BYE IMAP4rev2 server terminating connection 4562 S: a006 OK LOGOUT completed 4564 9. Formal Syntax 4566 The following syntax specification uses the Augmented Backus-Naur 4567 Form (ABNF) notation as specified in [ABNF]. 4569 In the case of alternative or optional rules in which a later rule 4570 overlaps an earlier rule, the rule which is listed earlier MUST take 4571 priority. For example, "\Seen" when parsed as a flag is the \Seen 4572 flag name and not a flag-extension, even though "\Seen" can be parsed 4573 as a flag-extension. Some, but not all, instances of this rule are 4574 noted below. 4576 Note: [ABNF] rules MUST be followed strictly; in particular: 4578 (1) Except as noted otherwise, all alphabetic characters are case- 4579 insensitive. The use of upper or lower case characters to define 4580 token strings is for editorial clarity only. Implementations MUST 4581 accept these strings in a case-insensitive fashion. 4583 (2) In all cases, SP refers to exactly one space. It is NOT 4584 permitted to substitute TAB, insert additional spaces, or 4585 otherwise treat SP as being equivalent to LWSP. 4587 (3) The ASCII NUL character, %x00, MUST NOT be used at any time. 4589 address = "(" addr-name SP addr-adl SP addr-mailbox SP 4590 addr-host ")" 4592 addr-adl = nstring 4593 ; Holds route from [RFC-5322] route-addr if 4594 ; non-NIL 4596 addr-host = nstring 4597 ; NIL indicates [RFC-5322] group syntax. 4598 ; Otherwise, holds [RFC-5322] domain name 4600 addr-mailbox = nstring 4601 ; NIL indicates end of [RFC-5322] group; if 4602 ; non-NIL and addr-host is NIL, holds 4603 ; [RFC-5322] group name. 4604 ; Otherwise, holds [RFC-5322] local-part 4605 ; after removing [RFC-5322] quoting 4607 addr-name = nstring 4608 ; If non-NIL, holds phrase from [RFC-5322] 4609 ; mailbox after removing [RFC-5322] quoting 4611 append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP 4612 literal 4614 append-uid = uniqueid 4616 astring = 1*ASTRING-CHAR / string 4617 ASTRING-CHAR = ATOM-CHAR / resp-specials 4619 atom = 1*ATOM-CHAR 4621 ATOM-CHAR = 4623 atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / 4624 quoted-specials / resp-specials 4626 authenticate = "AUTHENTICATE" SP auth-type [SP initial-resp] 4627 *(CRLF base64) 4629 auth-type = atom 4630 ; Defined by [SASL] 4632 base64 = *(4base64-char) [base64-terminal] 4634 base64-char = ALPHA / DIGIT / "+" / "/" 4635 ; Case-sensitive 4637 base64-terminal = (2base64-char "==") / (3base64-char "=") 4639 body = "(" (body-type-1part / body-type-mpart) ")" 4641 body-extension = nstring / number / 4642 "(" body-extension *(SP body-extension) ")" 4643 ; Future expansion. Client implementations 4644 ; MUST accept body-extension fields. Server 4645 ; implementations MUST NOT generate 4646 ; body-extension fields except as defined by 4647 ; future standard or standards-track 4648 ; revisions of this specification. 4650 body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang 4651 [SP body-fld-loc *(SP body-extension)]]] 4652 ; MUST NOT be returned on non-extensible 4653 ; "BODY" fetch 4655 body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang 4656 [SP body-fld-loc *(SP body-extension)]]] 4657 ; MUST NOT be returned on non-extensible 4658 ; "BODY" fetch 4660 body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP 4661 body-fld-enc SP body-fld-octets 4663 body-fld-desc = nstring 4664 body-fld-dsp = "(" string SP body-fld-param ")" / nil 4666 body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ 4667 "QUOTED-PRINTABLE") DQUOTE) / string 4669 body-fld-id = nstring 4671 body-fld-lang = nstring / "(" string *(SP string) ")" 4673 body-fld-loc = nstring 4675 body-fld-lines = number 4677 body-fld-md5 = nstring 4679 body-fld-octets = number 4681 body-fld-param = "(" string SP string *(SP string SP string) ")" / nil 4683 body-type-1part = (body-type-basic / body-type-msg / body-type-text) 4684 [SP body-ext-1part] 4686 body-type-basic = media-basic SP body-fields 4687 ; MESSAGE subtype MUST NOT be "RFC822" or "GLOBAL" 4689 body-type-mpart = 1*body SP media-subtype 4690 [SP body-ext-mpart] 4691 ; MULTIPART body part 4693 body-type-msg = media-message SP body-fields SP envelope 4694 SP body SP body-fld-lines 4696 body-type-text = media-text SP body-fields SP body-fld-lines 4698 capability = ("AUTH=" auth-type) / atom 4699 ; New capabilities MUST begin with "X" or be 4700 ; registered with IANA as standard or 4701 ; standards-track 4703 capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev2" 4704 *(SP capability) 4705 ; Servers MUST implement the STARTTLS, AUTH=PLAIN, 4706 ; and LOGINDISABLED capabilities 4707 ; Servers which offer RFC 1730 compatibility MUST 4708 ; list "IMAP4" as the first capability. 4710 CHAR8 = %x01-ff 4711 ; any OCTET except NUL, %x00 4713 charset = atom / quoted 4715 command = tag SP (command-any / command-auth / command-nonauth / 4716 command-select) CRLF 4717 ; Modal based on state 4719 command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / enable / x-command 4720 ; Valid in all states 4722 command-auth = append / create / delete / examine / list / lsub / 4723 Namespace-Command / 4724 rename / select / status / subscribe / unsubscribe / 4725 idle 4726 ; Valid only in Authenticated or Selected state 4728 command-nonauth = login / authenticate / "STARTTLS" 4729 ; Valid only when in Not Authenticated state 4731 command-select = "CHECK" / "CLOSE" / "UNSELECT" / "EXPUNGE" / copy / 4732 move / fetch / store / search / uid 4733 ; Valid only when in Selected state 4735 continue-req = "+" SP (resp-text / base64) CRLF 4737 copy = "COPY" SP sequence-set SP mailbox 4739 create = "CREATE" SP mailbox 4740 ; Use of INBOX gives a NO error 4742 date = date-text / DQUOTE date-text DQUOTE 4744 date-day = 1*2DIGIT 4745 ; Day of month 4747 date-day-fixed = (SP DIGIT) / 2DIGIT 4748 ; Fixed-format version of date-day 4750 date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / 4751 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" 4753 date-text = date-day "-" date-month "-" date-year 4755 date-year = 4DIGIT 4757 date-time = DQUOTE date-day-fixed "-" date-month "-" date-year 4758 SP time SP zone DQUOTE 4760 delete = "DELETE" SP mailbox 4761 ; Use of INBOX gives a NO error 4763 digit-nz = %x31-39 4764 ; 1-9 4766 enable = "ENABLE" 1*(SP capability) 4768 enable-data = "ENABLED" *(SP capability) 4770 envelope = "(" env-date SP env-subject SP env-from SP 4771 env-sender SP env-reply-to SP env-to SP env-cc SP 4772 env-bcc SP env-in-reply-to SP env-message-id ")" 4774 env-bcc = "(" 1*address ")" / nil 4776 env-cc = "(" 1*address ")" / nil 4778 env-date = nstring 4780 env-from = "(" 1*address ")" / nil 4782 env-in-reply-to = nstring 4784 env-message-id = nstring 4786 env-reply-to = "(" 1*address ")" / nil 4788 env-sender = "(" 1*address ")" / nil 4790 env-subject = nstring 4792 env-to = "(" 1*address ")" / nil 4794 esearch-response = "ESEARCH" [search-correlator] [SP "UID"] 4795 *(SP search-return-data) 4796 ; ESEARCH response replaces SEARCH response 4797 ; from IMAP4rev1. 4799 examine = "EXAMINE" SP mailbox 4801 fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" / 4802 fetch-att / "(" fetch-att *(SP fetch-att) ")") 4804 fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" / 4805 "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] / 4806 "BODY" ["STRUCTURE"] / "UID" / 4807 "BODY" section [partial] / 4808 "BODY.PEEK" section [partial] / 4809 "BINARY" [".PEEK"] section-binary [partial] / 4810 "BINARY.SIZE" section-binary 4812 flag = "\Answered" / "\Flagged" / "\Deleted" / 4813 "\Seen" / "\Draft" / flag-keyword / flag-extension 4814 ; Does not include "\Recent" 4816 flag-extension = "\" atom 4817 ; Future expansion. Client implementations 4818 ; MUST accept flag-extension flags. Server 4819 ; implementations MUST NOT generate 4820 ; flag-extension flags except as defined by 4821 ; future standard or standards-track 4822 ; revisions of this specification. 4823 ; "\Recent" was defined in RFC 3501 4824 ; and is now deprecated. 4826 flag-fetch = flag 4828 flag-keyword = "$MDNSent" / "$Forwarded" / atom 4830 flag-list = "(" [flag *(SP flag)] ")" 4832 flag-perm = flag / "\*" 4834 greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF 4836 header-fld-name = astring 4838 header-list = "(" header-fld-name *(SP header-fld-name) ")" 4840 idle = "IDLE" CRLF "DONE" 4842 initial-resp = (base64 / "=") 4843 ; "initial response" defined in 4844 ; Section 5.1 of [RFC4422] 4846 list = "LIST" SP mailbox SP list-mailbox 4848 list-mailbox = 1*list-char / string 4850 list-char = ATOM-CHAR / list-wildcards / resp-specials 4852 list-wildcards = "%" / "*" 4854 literal = "{" number ["+"] "}" CRLF *CHAR8 4855 ; represents the number of CHAR8s. 4856 ; A non-synchronizing literal is distinguished from 4857 ; a synchronizing literal by presence of the "+" 4858 ; before the closing "}". 4859 ; Non synchronizing literals are not allowed when 4860 ; sent from server to the client. 4862 literal8 = "~{" number "}" CRLF *OCTET 4863 ; represents the number of OCTETs 4864 ; in the response string. 4866 login = "LOGIN" SP userid SP password 4868 lsub = "LSUB" SP mailbox SP list-mailbox 4870 mailbox = "INBOX" / astring 4871 ; INBOX is case-insensitive. All case variants of 4872 ; INBOX (e.g., "iNbOx") MUST be interpreted as INBOX 4873 ; not as an astring. An astring which consists of 4874 ; the case-insensitive sequence "I" "N" "B" "O" "X" 4875 ; is considered to be INBOX and not an astring. 4876 ; Refer to section 5.1 for further 4877 ; semantic details of mailbox names. 4879 mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list / 4880 "LSUB" SP mailbox-list / esearch-response / 4881 "STATUS" SP mailbox SP "(" [status-att-list] ")" / 4882 number SP "EXISTS" / Namespace-Response 4884 mailbox-list = "(" [mbx-list-flags] ")" SP 4885 (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox 4887 mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag 4888 *(SP mbx-list-oflag) / 4889 mbx-list-oflag *(SP mbx-list-oflag) 4891 mbx-list-oflag = "\Noinferiors" / flag-extension 4892 ; Other flags; multiple possible per LIST response 4894 mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked" 4895 ; Selectability flags; only one per LIST response 4897 media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / 4898 "MESSAGE" / "VIDEO" / "FONT") DQUOTE) / string) SP 4899 media-subtype 4900 ; Defined in [MIME-IMT]. 4901 ; FONT defined in RFC YYYY. 4903 media-message = DQUOTE "MESSAGE" DQUOTE SP 4904 DQUOTE ("RFC822" / "GLOBAL") DQUOTE 4905 ; Defined in [MIME-IMT] 4907 media-subtype = string 4908 ; Defined in [MIME-IMT] 4910 media-text = DQUOTE "TEXT" DQUOTE SP media-subtype 4911 ; Defined in [MIME-IMT] 4913 message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) 4915 move = "MOVE" SP sequence-set SP mailbox 4917 msg-att = "(" (msg-att-dynamic / msg-att-static) 4918 *(SP (msg-att-dynamic / msg-att-static)) ")" 4920 msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")" 4921 ; MAY change for a message 4923 msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time / 4924 "RFC822" [".HEADER" / ".TEXT"] SP nstring / 4925 "RFC822.SIZE" SP number / 4926 "BODY" ["STRUCTURE"] SP body / 4927 "BODY" section ["<" number ">"] SP nstring / 4928 "BINARY" section-binary SP (nstring / literal8) / 4929 "BINARY.SIZE" section-binary SP number / 4930 "UID" SP uniqueid 4931 ; MUST NOT change for a message 4933 Namespace = nil / "(" 1*Namespace-Descr ")" 4935 Namespace-Command = "NAMESPACE" 4937 Namespace-Descr = "(" string SP 4938 (DQUOTE QUOTED-CHAR DQUOTE / nil) 4939 *(Namespace-Response-Extension) ")" 4941 Namespace-Response-Extension = SP string SP 4942 "(" string *(SP string) ")" 4944 Namespace-Response = "NAMESPACE" SP Namespace 4945 SP Namespace SP Namespace 4946 ; The first Namespace is the Personal Namespace(s) 4947 ; The second Namespace is the Other Users' Namespace(s) 4948 ; The third Namespace is the Shared Namespace(s) 4950 nil = "NIL" 4952 nstring = string / nil 4953 number = 1*DIGIT 4954 ; Unsigned 32-bit integer 4955 ; (0 <= n < 4,294,967,296) 4957 number64 = 1*DIGIT 4958 ; Unsigned 63-bit integer 4959 ; (0 <= n <= 9,223,372,036,854,775,807) 4961 nz-number = digit-nz *DIGIT 4962 ; Non-zero unsigned 32-bit integer 4963 ; (0 < n < 4,294,967,296) 4965 password = astring 4967 partial-range = number ["." nz-number] 4968 ; Copied from RFC 5092 (IMAP URL) 4970 partial = "<" number "." nz-number ">" 4971 ; Partial FETCH request. 0-based offset of 4972 ; the first octet, followed by the number of octets 4973 ; in the fragment. 4975 quoted = DQUOTE *QUOTED-CHAR DQUOTE 4977 QUOTED-CHAR = / 4978 "\" quoted-specials / UTF8-2 / UTF8-3 / UTF8-4 4980 quoted-specials = DQUOTE / "\" 4982 rename = "RENAME" SP mailbox SP mailbox 4983 ; Use of INBOX as a destination gives a NO error 4985 response = *(continue-req / response-data) response-done 4987 response-data = "*" SP (resp-cond-state / resp-cond-bye / 4988 mailbox-data / message-data / capability-data / 4989 enable-data) CRLF 4991 response-done = response-tagged / response-fatal 4993 response-fatal = "*" SP resp-cond-bye CRLF 4994 ; Server closes connection immediately 4996 response-tagged = tag SP resp-cond-state CRLF 4998 resp-code-apnd = "APPENDUID" SP nz-number SP append-uid 5000 resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set 5001 resp-cond-auth = ("OK" / "PREAUTH") SP resp-text 5002 ; Authentication condition 5004 resp-cond-bye = "BYE" SP resp-text 5006 resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text 5007 ; Status condition 5009 resp-specials = "]" 5011 ;; ////Can we make "text" optional? Will this have any bad side effects? 5012 resp-text = ["[" resp-text-code "]" SP] text 5014 resp-text-code = "ALERT" / 5015 "BADCHARSET" [SP "(" charset *(SP charset) ")" ] / 5016 capability-data / "PARSE" / 5017 "PERMANENTFLAGS" SP "(" 5018 [flag-perm *(SP flag-perm)] ")" / 5019 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / 5020 "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number / 5021 resp-code-apnd / resp-code-copy / "UIDNOTSTICKY" / 5022 "UNAVAILABLE" / "AUTHENTICATIONFAILED" / 5023 "AUTHORIZATIONFAILED" / "EXPIRED" / 5024 "PRIVACYREQUIRED" / "CONTACTADMIN" / "NOPERM" / 5025 "INUSE" / "EXPUNGEISSUED" / "CORRUPTION" / 5026 "SERVERBUG" / "CLIENTBUG" / "CANNOT" / 5027 "LIMIT" / "OVERQUOTA" / "ALREADYEXISTS" / 5028 "NONEXISTENT" / 5029 "CLOSED" / 5030 "UNKNOWN-CTE" / 5031 atom [SP 1*] 5033 search = "SEARCH" [search-return-opts] 5034 SP search-program 5036 search-correlator = SP "(" "TAG" SP tag-string ")" 5038 search-key = "ALL" / "ANSWERED" / "BCC" SP astring / 5039 "BEFORE" SP date / "BODY" SP astring / 5040 "CC" SP astring / "DELETED" / "FLAGGED" / 5041 "FROM" SP astring / "KEYWORD" SP flag-keyword / 5042 "NEW" / "OLD" / "ON" SP date / "SEEN" / 5043 "SINCE" SP date / "SUBJECT" SP astring / 5044 "TEXT" SP astring / "TO" SP astring / 5045 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" / 5046 "UNKEYWORD" SP flag-keyword / "UNSEEN" / 5047 ; Above this line were in [IMAP2] 5048 "DRAFT" / "HEADER" SP header-fld-name SP astring / 5049 "LARGER" SP number / "NOT" SP search-key / 5050 "OR" SP search-key SP search-key / 5051 "SENTBEFORE" SP date / "SENTON" SP date / 5052 "SENTSINCE" SP date / "SMALLER" SP number / 5053 "UID" SP sequence-set / "UNDRAFT" / sequence-set / 5054 "(" search-key *(SP search-key) ")" 5056 search-modifier-name = tagged-ext-label 5058 search-mod-params = tagged-ext-val 5059 ; This non-terminal shows recommended syntax 5060 ; for future extensions. 5062 search-program = ["CHARSET" SP charset SP] 5063 search-key *(SP search-key) 5064 ; CHARSET argument to SEARCH MUST be 5065 ; registered with IANA. 5067 search-ret-data-ext = search-modifier-name SP search-return-value 5068 ; Note that not every SEARCH return option 5069 ; is required to have the corresponding 5070 ; ESEARCH return data. 5072 search-return-data = "MIN" SP nz-number / 5073 "MAX" SP nz-number / 5074 "ALL" SP sequence-set / 5075 "COUNT" SP number / 5076 search-ret-data-ext 5077 ; All return data items conform to 5078 ; search-ret-data-ext syntax 5080 search-return-opts = SP "RETURN" SP "(" [search-return-opt 5081 *(SP search-return-opt)] ")" 5083 search-return-opt = "MIN" / "MAX" / "ALL" / "COUNT" / 5084 search-ret-opt-ext 5085 ; conforms to generic search-ret-opt-ext 5086 ; syntax 5088 search-ret-opt-ext = search-modifier-name [SP search-mod-params] 5090 search-return-value = tagged-ext-val 5091 ; Data for the returned search option. 5092 ; A single "nz-number"/"number"/"number64" value 5093 ; can be returned as an atom (i.e., without 5094 ; quoting). A sequence-set can be returned 5095 ; as an atom as well. 5097 section = "[" [section-spec] "]" 5099 section-binary = "[" [section-part] "]" 5101 section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list / 5102 "TEXT" 5103 ; top-level or MESSAGE/RFC822 or MESSAGE/GLOBAL part 5105 section-part = nz-number *("." nz-number) 5106 ; body part reference. 5107 ; Allows for accessing nested body parts. 5109 section-spec = section-msgtext / (section-part ["." section-text]) 5111 section-text = section-msgtext / "MIME" 5112 ; text other than actual body part (headers, etc.) 5114 select = "SELECT" SP mailbox 5116 seq-number = nz-number / "*" 5117 ; message sequence number (COPY, FETCH, STORE 5118 ; commands) or unique identifier (UID COPY, 5119 ; UID FETCH, UID STORE commands). 5120 ; * represents the largest number in use. In 5121 ; the case of message sequence numbers, it is 5122 ; the number of messages in a non-empty mailbox. 5123 ; In the case of unique identifiers, it is the 5124 ; unique identifier of the last message in the 5125 ; mailbox or, if the mailbox is empty, the 5126 ; mailbox's current UIDNEXT value. 5127 ; The server should respond with a tagged BAD 5128 ; response to a command that uses a message 5129 ; sequence number greater than the number of 5130 ; messages in the selected mailbox. This 5131 ; includes "*" if the selected mailbox is empty. 5133 seq-range = seq-number ":" seq-number 5134 ; two seq-number values and all values between 5135 ; these two regardless of order. 5136 ; Example: 2:4 and 4:2 are equivalent and indicate 5137 ; values 2, 3, and 4. 5138 ; Example: a unique identifier sequence range of 5139 ; 3291:* includes the UID of the last message in 5140 ; the mailbox, even if that value is less than 3291. 5142 sequence-set = (seq-number / seq-range) ["," sequence-set] 5143 ; set of seq-number values, regardless of order. 5144 ; Servers MAY coalesce overlaps and/or execute the 5145 ; sequence in any order. 5146 ; Example: a message sequence number set of 5147 ; 2,4:7,9,12:* for a mailbox with 15 messages is 5148 ; equivalent to 2,4,5,6,7,9,12,13,14,15 5149 ; Example: a message sequence number set of *:4,5:7 5150 ; for a mailbox with 10 messages is equivalent to 5151 ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and 5152 ; overlap coalesced to be 4,5,6,7,8,9,10. 5154 status = "STATUS" SP mailbox SP 5155 "(" status-att *(SP status-att) ")" 5157 status-att = "MESSAGES" / "UIDNEXT" / "UIDVALIDITY" / 5158 "UNSEEN" / "SIZE" 5160 status-att-val = ("MESSAGES" SP number) / 5161 ("UIDNEXT" SP nz-number) / 5162 ("UIDVALIDITY" SP nz-number) / 5163 ("UNSEEN" SP number) / 5164 ("SIZE" SP number64) 5165 ; Extensions to the STATUS responses 5166 ; should extend this production. 5167 ; Extensions should use the generic 5168 ; syntax defined by tagged-ext. 5170 status-att-list = status-att-val *(SP status-att-val) 5172 store = "STORE" SP sequence-set SP store-att-flags 5174 store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP 5175 (flag-list / (flag *(SP flag))) 5177 string = quoted / literal 5179 subscribe = "SUBSCRIBE" SP mailbox 5181 tag = 1* 5183 tagged-ext-label = tagged-label-fchar *tagged-label-char 5184 ;; Is a valid RFC 3501 "atom". 5186 tagged-label-fchar = ALPHA / "-" / "_" / "." 5188 tagged-label-char = tagged-label-fchar / DIGIT / ":" 5190 tagged-ext-comp = astring / 5191 tagged-ext-comp *(SP tagged-ext-comp) / 5192 "(" tagged-ext-comp ")" 5193 ;; Extensions that follow this general 5194 ;; syntax should use nstring instead of 5195 ;; astring when appropriate in the context 5196 ;; of the extension. 5197 ;; Note that a message set or a "number" 5198 ;; can always be represented as an "atom". 5199 ;; An URL should be represented as 5200 ;; a "quoted" string. 5202 tagged-ext-simple = sequence-set / number / number64 5204 tagged-ext-val = tagged-ext-simple / 5205 "(" [tagged-ext-comp] ")" 5207 text = 1*TEXT-CHAR 5209 TEXT-CHAR = 5211 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 5212 ; Hours minutes seconds 5214 uid = "UID" SP 5215 (copy / move / fetch / search / store / uid-expunge) 5216 ; Unique identifiers used instead of message 5217 ; sequence numbers 5219 uid-expunge = "EXPUNGE" SP sequence-set 5220 ; Unique identifiers used instead of message 5221 ; sequence numbers 5223 uid-set = (uniqueid / uid-range) *("," uid-set) 5225 uid-range = (uniqueid ":" uniqueid) 5226 ; two uniqueid values and all values 5227 ; between these two regards of order. 5228 ; Example: 2:4 and 4:2 are equivalent. 5230 uniqueid = nz-number 5231 ; Strictly ascending 5233 unsubscribe = "UNSUBSCRIBE" SP mailbox 5235 userid = astring 5237 UTF8-2 = 5239 UTF8-3 = 5240 UTF8-4 = 5242 x-command = "X" atom 5244 zone = ("+" / "-") 4DIGIT 5245 ; Signed four-digit value of hhmm representing 5246 ; hours and minutes east of Greenwich (that is, 5247 ; the amount that the given time differs from 5248 ; Universal Time). Subtracting the timezone 5249 ; from the given time will give the UT form. 5250 ; The Universal Time zone is "+0000". 5252 10. Author's Note 5254 This document is a revision or rewrite of earlier documents, and 5255 supercedes the protocol specification in those documents: RFC 2060, 5256 RFC 1730, unpublished IMAP2bis.TXT document, RFC 1176, and RFC 1064. 5258 11. Security Considerations 5260 IMAP4rev2 protocol transactions, including electronic mail data, are 5261 sent in the clear over the network unless protection from snooping is 5262 negotiated. This can be accomplished either by the use of IMAPS 5263 service, STARTTLS command, negotiated privacy protection in the 5264 AUTHENTICATE command, or some other protection mechanism. 5266 11.1. STARTTLS Security Considerations 5268 IMAP client and server implementations MUST comply with relevant TLS 5269 recommendations from [RFC8314]. Additionally, when using TLS 1.2, 5270 IMAP implementations MUST implement 5271 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite, and SHOULD 5272 implement the TLS_RSA_WITH_AES_128_CBC_SHA [TLS] cipher suite. This 5273 is important as it assures that any two compliant implementations can 5274 be configured to interoperate. Other TLS cipher suites recommended 5275 in RFC 7525 are RECOMMENDED: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 5276 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 and 5277 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384. All other cipher suites are 5278 OPTIONAL. Note that this is a change from section 2.1 of [IMAP-TLS]. 5280 During the [TLS] negotiation, the client MUST check its understanding 5281 of the server hostname against the server's identity as presented in 5282 the server Certificate message, in order to prevent man-in-the-middle 5283 attacks. This procedure is described in [RFC7817]. 5285 Both the client and server MUST check the result of the STARTTLS 5286 command and subsequent [TLS] negotiation to see whether acceptable 5287 authentication and/or privacy was achieved. 5289 11.2. COPYUID and APPENDUID response codes 5291 The COPYUID and APPENDUID response codes return information about the 5292 mailbox, which may be considered sensitive if the mailbox has 5293 permissions set that permit the client to COPY or APPEND to the 5294 mailbox, but not SELECT or EXAMINE it. 5296 Consequently, these response codes SHOULD NOT be issued if the client 5297 does not have access to SELECT or EXAMINE the mailbox. 5299 11.3. Other Security Considerations 5301 A server error message for an AUTHENTICATE command which fails due to 5302 invalid credentials SHOULD NOT detail why the credentials are 5303 invalid. 5305 Use of the LOGIN command sends passwords in the clear. This can be 5306 avoided by using the AUTHENTICATE command with a [SASL] mechanism 5307 that does not use plaintext passwords, by first negotiating 5308 encryption via STARTTLS or some other protection mechanism. 5310 A server implementation MUST implement a configuration that, at the 5311 time of authentication, requires: 5312 (1) The STARTTLS command has been negotiated. 5313 OR 5314 (2) Some other mechanism that protects the session from password 5315 snooping has been provided. 5316 OR 5317 (3) The following measures are in place: 5318 (a) The LOGINDISABLED capability is advertised, and [SASL] mechanisms 5319 (such as PLAIN) using plaintext passwords are NOT advertised in the 5320 CAPABILITY list. 5321 AND 5322 (b) The LOGIN command returns an error even if the password is 5323 correct. 5324 AND 5325 (c) The AUTHENTICATE command returns an error with all [SASL] 5326 mechanisms that use plaintext passwords, even if the password is 5327 correct. 5329 A server error message for a failing LOGIN command SHOULD NOT specify 5330 that the user name, as opposed to the password, is invalid. 5332 A server SHOULD have mechanisms in place to limit or delay failed 5333 AUTHENTICATE/LOGIN attempts. 5335 Additional security considerations are discussed in the section 5336 discussing the AUTHENTICATE and LOGIN commands. 5338 12. IANA Considerations 5340 IANA is requested to update "Service Names and Transport Protocol 5341 Port Numbers" registry as follows: 5343 1. Registration for TCP "imap" port 143 should be updated to point 5344 to this document and RFC 3501. 5346 2. Registration for TCP "imaps" port 993 should be updated to point 5347 to this document, RFC 8314 and RFC 3501. 5349 3. Both UDP port 143 and UDP port 993 should be marked as "Reserved" 5350 in the registry. 5352 Additional IANA actions are specified in subsection of this section. 5354 12.1. Updates to IMAP4 Capabilities registry 5356 IMAP4 capabilities are registered by publishing a standards track or 5357 IESG approved informational or experimental RFC. The registry is 5358 currently located at: http://www.iana.org/assignments/ 5359 imap4-capabilities 5361 As this specification revises the STARTTLS and LOGINDISABLED 5362 extensions previously defined in [IMAP-TLS], IANA is requested to 5363 update registry entries for these 2 extensions to point to this 5364 document. 5366 12.2. GSSAPI/SASL service name 5368 GSSAPI/Kerberos/SASL service names are registered by publishing a 5369 standards track or IESG approved experimental RFC. The registry is 5370 currently located at: http://www.iana.org/assignments/gssapi-service- 5371 names 5373 IANA is requested to update the "imap" service name previously 5374 registered in RFC 3501, to point to this document. 5376 13. References 5378 13.1. Normative References 5380 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 5381 Specifications: ABNF", STD 68, RFC 5234, January 2008, 5382 . 5384 [ANONYMOUS] 5385 Zeilenga, K., "Anonymous Simple Authentication and 5386 Security Layer (SASL) Mechanism", RFC 4505, June 2006, 5387 . 5389 [CHARSET] Freed, N. and J. Postel, "IANA Charset Registration 5390 Procedures", BCP 19, RFC 2978, October 2000, 5391 . 5393 [DIGEST-MD5] 5394 Leach, P. and C. Newman, "Using Digest Authentication as a 5395 SASL Mechanism", RFC 2831, May 2000, 5396 . 5398 [DISPOSITION] 5399 Troost, R., Dorner, S., and K. Moore, Ed., "Communicating 5400 Presentation Information in Internet Messages: The 5401 Content-Disposition Header Field", RFC 2183, August 1997, 5402 . 5404 [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 5405 Security Layer (SASL) Mechanism", RFC 4616, August 2006, 5406 . 5408 [KEYWORDS] 5409 Bradner, S., "Key words for use in RFCs to Indicate 5410 Requirement Levels", BCP 14, RFC 2119, March 1997, 5411 . 5413 [LANGUAGE-TAGS] 5414 Alvestrand, H., "Content Language Headers", RFC 3282, May 5415 2002, . 5417 [LOCATION] 5418 Palme, J., Hopmann, A., and N. Shelness, "MIME 5419 Encapsulation of Aggregate Documents, such as HTML 5420 (MHTML)", RFC 2557, March 1999, 5421 . 5423 [MD5] Myers, J. and M. Rose, "The Content-MD5 Header Field", 5424 RFC 1864, October 1995, 5425 . 5427 [MIME-HDRS] 5428 Moore, K., "MIME (Multipurpose Internet Mail Extensions) 5429 Part Three: Message Header Extensions for Non-ASCII Text", 5430 RFC 2047, November 1996, 5431 . 5433 [MIME-IMB] 5434 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5435 Extensions (MIME) Part One: Format of Internet Message 5436 Bodies", RFC 2045, November 1996, 5437 . 5439 [MIME-IMT] 5440 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5441 Extensions (MIME) Part Two: Media Types", RFC 2046, 5442 November 1996, . 5444 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 5445 Word Extensions: Character Sets, Languages, and 5446 Continuations", RFC 2231, DOI 10.17487/RFC2231, November 5447 1997, . 5449 [RFC-5322] 5450 Resnick, P., Ed., "Internet Message Format", RFC 5322, 5451 October 2008, . 5453 [SASL] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 5454 Authentication and Security Layer (SASL)", RFC 4422, June 5455 2006, . 5457 [TLS] Dierks, T. and E. Rescorla, "The Transport Layer Security 5458 (TLS) Protocol Version 1.2", RFC 5246, August 2008, 5459 . 5461 [UTF-7] Goldsmith, D. and M. Davis, "UTF-7 A Mail-Safe 5462 Transformation Format of Unicode", RFC 2152, May 1997, 5463 . 5465 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 5466 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 5467 2003, . 5469 [MULTIAPPEND] 5470 Crispin, M., "Internet Message Access Protocol (IMAP) - 5471 MULTIAPPEND Extension", RFC 3502, March 2003, 5472 . 5474 [IMAP-IMPLEMENTATION] 5475 Leiba, B., "IMAP4 Implementation Recommendations", 5476 RFC 2683, September 1999, 5477 . 5479 [IMAP-MULTIACCESS] 5480 Gahrns, M., "IMAP4 Multi-Accessed Mailbox Practice", 5481 RFC 2180, July 1997, 5482 . 5484 [NET-UNICODE] 5485 Klensin, J. and M. Padlipsky, "Unicode Format for Network 5486 Interchange", RFC 5198, DOI 10.17487/RFC5198, March 2008, 5487 . 5489 [I18N-HDRS] 5490 Yang, A., Steele, S., and N. Freed, "Internationalized 5491 Email Headers", RFC 6532, DOI 10.17487/RFC6532, February 5492 2012, . 5494 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 5495 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 5496 . 5498 [RFC7817] Melnikov, A., "Updated Transport Layer Security (TLS) 5499 Server Identity Check Procedure for Email-Related 5500 Protocols", RFC 7817, DOI 10.17487/RFC7817, March 2016, 5501 . 5503 [RFC7888] Melnikov, A., Ed., "IMAP4 Non-synchronizing Literals", 5504 RFC 7888, DOI 10.17487/RFC7888, May 2016, 5505 . 5507 [RFC8314] Moore, K. and C. Newman, "Cleartext Considered Obsolete: 5508 Use of Transport Layer Security (TLS) for Email Submission 5509 and Access", RFC 8314, DOI 10.17487/RFC8314, January 2018, 5510 . 5512 13.2. Informative References (related protocols) 5514 [IMAP-DISC] 5515 Melnikov, A., Ed., "Synchronization Operations for 5516 Disconnected IMAP4 Clients", RFC 4549, June 2006, 5517 . 5519 [IMAP-I18N] 5520 Newman, C., Gulbrandsen, A., and A. Melnikov, "Internet 5521 Message Access Protocol Internationalization", RFC 5255, 5522 DOI 10.17487/RFC5255, June 2008, 5523 . 5525 [IMAP-MODEL] 5526 Crispin, M., "Distributed Electronic Mail Models in 5527 IMAP4", RFC 1733, December 1994, 5528 . 5530 [IMAP-UTF-8] 5531 Resnick, P., Ed., Newman, C., Ed., and S. Shen, Ed., "IMAP 5532 Support for UTF-8", RFC 6855, DOI 10.17487/RFC6855, March 5533 2013, . 5535 [ACAP] Newman, C. and J. G. Myers, "ACAP -- Application 5536 Configuration Access Protocol", RFC 2244, November 1997, 5537 . 5539 [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 5540 October 2008, . 5542 [RFC3516] Nerenberg, L., "IMAP4 Binary Content Extension", RFC 3516, 5543 DOI 10.17487/RFC3516, April 2003, 5544 . 5546 [RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", 5547 RFC 4314, December 2005, 5548 . 5550 [RFC2087] Myers, J., "IMAP4 QUOTA extension", RFC 2087, January 5551 1997, . 5553 [IMAP-URL] 5554 Melnikov, A., Ed. and C. Newman, "IMAP URL Scheme", 5555 RFC 5092, DOI 10.17487/RFC5092, November 2007, 5556 . 5558 13.3. Informative References (historical aspects of IMAP and related 5559 protocols) 5561 [IMAP-COMPAT] 5562 Crispin, M., "IMAP4 Compatibility with IMAP2bis", 5563 RFC 2061, December 1996, 5564 . 5566 [IMAP-HISTORICAL] 5567 Crispin, M., "IMAP4 Compatibility with IMAP2 and 5568 IMAP2bis", RFC 1732, December 1994, 5569 . 5571 [IMAP-OBSOLETE] 5572 Crispin, M., "Internet Message Access Protocol - Obsolete 5573 Syntax", RFC 2062, December 1996, 5574 . 5576 [IMAP2] Crispin, M., "Interactive Mail Access Protocol: Version 5577 2", RFC 1176, August 1990, 5578 . 5580 [RFC-822] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 5581 TEXT MESSAGES", STD 11, RFC 822, August 1982, 5582 . 5584 [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, 5585 RFC 821, August 1982, 5586 . 5588 [IMAP-TLS] 5589 Newman, C., "Using TLS with IMAP, POP3 and ACAP", 5590 RFC 2595, June 1999, 5591 . 5593 Appendix A. Backward compatibility with IMAP4rev1 5595 An implementation that wants to remain compatible with IMAP4rev1 can 5596 advertise both IMAP4rev1 and IMAP4rev2 in its CAPABILITY response/ 5597 response code. While some IMAP4rev1 responses were removed in 5598 IMAP4rev2, their presence will not break IMAP4rev2-only clients. 5600 If both IMAP4rev1 and IMAP4rev2 are advertised, an IMAP client that 5601 wants to use IMAP4rev2 MUST issue an "ENABLE IMAP4rev2" command. 5603 Servers advertising both IMAP4rev1 and IMAP4rev2 SHOULD NOT generate 5604 UTF-8 quoted strings unless the client has issued "ENABLE IMAP4rev2". 5605 Consider implementation of mechanisms described or referenced in 5606 [IMAP-UTF-8] to achieve this goal. 5608 Servers advertising both IMAP4rev1 and IMAP4rev2, and clients 5609 intending to be compatible with IMAP4rev1 servers MUST be compatible 5610 with the international mailbox naming convention described in the 5611 following subsection. 5613 A.1. Mailbox International Naming Convention 5615 By convention, international mailbox names in IMAP4rev2 are specified 5616 using a modified version of the UTF-7 encoding described in [UTF-7]. 5617 Modified UTF-7 may also be usable in servers that implement an 5618 earlier version of this protocol. 5620 In modified UTF-7, printable US-ASCII characters, except for "&", 5621 represent themselves; that is, characters with octet values 0x20-0x25 5622 and 0x27-0x7e. The character "&" (0x26) is represented by the two- 5623 octet sequence "&-". 5625 All other characters (octet values 0x00-0x1f and 0x7f-0xff) are 5626 represented in modified BASE64, with a further modification from 5627 [UTF-7] that "," is used instead of "/". Modified BASE64 MUST NOT be 5628 used to represent any printing US-ASCII character which can represent 5629 itself. Only characters inside the modified BASE64 alphabet are 5630 permitted in modified BASE64 text. 5632 "&" is used to shift to modified BASE64 and "-" to shift back to US- 5633 ASCII. There is no implicit shift from BASE64 to US-ASCII, and null 5634 shifts ("-&" while in BASE64; note that "&-" while in US-ASCII means 5635 "&") are not permitted. However, all names start in US-ASCII, and 5636 MUST end in US-ASCII; that is, a name that ends with a non-ASCII 5637 ISO-10646 character MUST end with a "-"). 5639 The purpose of these modifications is to correct the following 5640 problems with UTF-7: 5642 1. UTF-7 uses the "+" character for shifting; this conflicts with 5643 the common use of "+" in mailbox names, in particular USENET 5644 newsgroup names. 5646 2. UTF-7's encoding is BASE64 which uses the "/" character; this 5647 conflicts with the use of "/" as a popular hierarchy delimiter. 5649 3. UTF-7 prohibits the unencoded usage of "\"; this conflicts with 5650 the use of "\" as a popular hierarchy delimiter. 5652 4. UTF-7 prohibits the unencoded usage of "~"; this conflicts with 5653 the use of "~" in some servers as a home directory indicator. 5655 5. UTF-7 permits multiple alternate forms to represent the same 5656 string; in particular, printable US-ASCII characters can be 5657 represented in encoded form. 5659 Although modified UTF-7 is a convention, it establishes certain 5660 requirements on server handling of any mailbox name with an embedded 5661 "&" character. In particular, server implementations MUST preserve 5662 the exact form of the modified BASE64 portion of a modified UTF-7 5663 name and treat that text as case-sensitive, even if names are 5664 otherwise case-insensitive or case-folded. 5666 Server implementations SHOULD verify that any mailbox name with an 5667 embedded "&" character, used as an argument to CREATE, is: in the 5668 correctly modified UTF-7 syntax, has no superfluous shifts, and has 5669 no encoding in modified BASE64 of any printing US-ASCII character 5670 which can represent itself. However, client implementations MUST NOT 5671 depend upon the server doing this, and SHOULD NOT attempt to create a 5672 mailbox name with an embedded "&" character unless it complies with 5673 the modified UTF-7 syntax. 5675 Server implementations which export a mail store that does not follow 5676 the modified UTF-7 convention MUST convert to modified UTF-7 any 5677 mailbox name that contains either non-ASCII characters or the "&" 5678 character. 5680 For example, here is a mailbox name which mixes English, Chinese, 5681 and Japanese text: ~peter/mail/&U,BTFw-/&ZeVnLIqe- 5683 For example, the string "&Jjo!" is not a valid mailbox name 5684 because it does not contain a shift to US-ASCII before the "!". 5685 The correct form is "&Jjo-!". The string "&U,BTFw-&ZeVnLIqe-" is 5686 not permitted because it contains a superfluous shift. The 5687 correct form is "&U,BTF2XlZyyKng-". 5689 Appendix B. Backward compatibility with BINARY extension 5691 IMAP4rev2 is incorporates subset of functionality provided by the 5692 BINARY extension [RFC3516], in particular it includes additional 5693 FETCH items (BINARY, BINARY.PEEK and BINARY.SIZE), but not extensions 5694 to the APPEND command. IMAP4rev2 implementations that supports full 5695 RFC 3516 functionality need to also advertise the BINARY token in the 5696 CAPABILITY response. 5698 Appendix C. Changes from RFC 3501 / IMAP4rev1 5700 The following is the plan for remaining changes. The plan might 5701 change over time. 5703 1. Fold in the following extensions/RFC: RFC 5530 (IMAP Response 5704 Codes, done), UIDPLUS (done), ENABLE (done), ESEARCH (done), 5705 SPECIAL-USE (list of new mailbox attributes is done), LITERAL- 5706 (done), NAMESPACE (done), SASL-IR (done), IDLE (done), MOVE 5707 (done). 5709 2. Add CLOSED response code (from CONDSTORE) - done 5711 3. Add support for $MDNSent and $Forwarded IMAP keywords - done. 5712 Add more examples showing their use? Also add other keywords 5713 like $Phishing, $Junk, $NonJunk? 5715 4. Require all unsolicited FETCH updates to include UID - done. 5717 5. Update recommendations on TLS ciphers to match UTA WG work (as 5718 per RFC 8314, RFC 7525 and RFC 7817) - done. 5720 6. Possibly fold in the following extensions/RFC: Base LIST- 5721 EXTENDED syntax plus deprecate LSUB (replace it with LIST 5722 \Subscribed) minus the requirement to support multiple list 5723 patterns, STATUS-in-LIST, SEARCHRES, BINARY (only the FETCH 5724 changes on leaf body part and make APPEND related ones optional. 5725 See the mailing list discussion) - done. 5727 7. Add STATUS SIZE (total mailbox size) - done Add STATUS DELETED 5728 (number of messages with \Deleted flag set)? Or DELETEDSIZE? 5730 8. Deprecate features: What should we do with NEW search key (which 5731 implies RECENT): deprecate it or just redefine it to ignore 5732 RECENT state? 5734 9. Drop UTF-7, all mailboxes are always in UTF-8 - done. 5736 10. Revise IANA registration of IMAP extensions and give advice on 5737 use of "X-" convention. 5739 11. Allow word-based searching (as per Chris Newman)? 5741 The following changes since RFC 3501 were done so far: 5743 1. Folded in IMAP UNSELECT (RFC 3691), UIDPLUS (RFC 4315), ESEARCH 5744 (RFC 4731), ENABLE (RFC 5161), IDLE (RFC 2177), SASL-IR (RFC 5745 4959) and MOVE (RFC 6851) extensions. Also folded RFC 5530 and 5746 FETCH side of the BINARY extension (RFC 3516). 5748 2. Clarified that server should decode parameter value 5749 continuations as described in [RFC2231]. This requirement was 5750 hidden in RFC 2231 itself. 5752 3. SEARCH command now requires to return ESEARCH response (SEARCH 5753 response is now deprecated). 5755 4. Added CLOSED response code from RFC 7162. 5757 5. Updated to use modern TLS-related recommendations as per RFC 5758 8314, RFC 7817, RFC 7525. 5760 6. For future extensibility extended ABNF for tagged-ext-simple to 5761 allow for bare number64. 5763 7. Added SHOULD level requirement on IMAP servers to support 5764 $MDNSent and $Forwarded keywords. 5766 8. Added STATUS SIZE. 5768 9. Mailbox names and message headers now allow for UTF-8. Support 5769 for Modified UTF-7 in mailbox names is not required, unless 5770 compatibility with IMAP4rev1 is desired. 5772 10. UNSEEN response code on SELECT/EXAMINE is now deprecated. 5774 11. RECENT response on SELECT/EXAMINE, \Recent flag, RECENT STATUS 5775 item are now deprecated. 5777 Appendix D. Acknowledgement 5779 Earlier versions of this document were edited by Mark Crispin. 5780 Sadly, he is no longer available to help with this work. Editors of 5781 this revisions are hoping that Mark would have approved. 5783 Chris Newman has contributed text on I18N and use of UTF-8 in 5784 messages and mailbox names. 5786 Thank you to Tony Hansen for helping with the index generation. 5788 This document incorporate text from RFC 4315, RFC 4466, RFC 4731, RFC 5789 5161, RFC 6154 so work done by authors/editors of these documents is 5790 appreciated. 5792 Index 5794 $ 5795 $Forwarded (predefined flag) 12 5796 $MDNSent (predefined flag) 12 5798 + 5799 +FLAGS 68 5800 +FLAGS.SILENT 68 5802 - 5803 -FLAGS 68 5804 -FLAGS.SILENT 68 5806 A 5807 ALERT (response code) 75 5808 ALL (fetch item) 63 5809 ALL (search key) 60 5810 ALL (search result option) 59 5811 ALREADYEXISTS (response code) 75 5812 ANSWERED (search key) 60 5813 APPEND (command) 51 5814 APPENDUID (response code) 75 5815 AUTHENTICATE (command) 27 5816 AUTHENTICATIONFAILED (response code) 76 5817 AUTHORIZATIONFAILED (response code) 76 5819 B 5820 BAD (response) 83 5821 BADCHARSET (response code) 76 5822 BCC (search key) 60 5823 BEFORE (search key) 60 5824 BINARY.PEEK[]<> (fetch item) 64 5825 BINARY.SIZE[] (fetch item) 64 5826 BINARY.SIZE[] (fetch result) 92 5827 BINARY[]<> (fetch result) 92 5828 BINARY[]<> (fetch item) 64 5829 BODY (fetch item) 64 5830 BODY (fetch result) 92 5831 BODY (search key) 60 5832 BODY.PEEK[
]<> (fetch item) 66 5833 BODYSTRUCTURE (fetch item) 67 5834 BODYSTRUCTURE (fetch result) 93 5835 BODY[
]<> (fetch result) 92 5836 BODY[
]<> (fetch item) 64 5837 BYE (response) 83 5838 Body Structure (message attribute) 13 5840 C 5841 CANNOT (response code) 77 5842 CAPABILITY (command) 24 5843 CAPABILITY (response code) 77 5844 CAPABILITY (response) 84 5845 CC (search key) 60 5846 CHECK (command) 56 5847 CLIENTBUG (response code) 77 5848 CLOSE (command) 56 5849 CLOSED (response code) 77 5850 CONTACTADMIN (response code) 78 5851 COPY (command) 68 5852 COPYUID (response code) 78 5853 CORRUPTION (response code) 78 5854 COUNT (search result option) 59 5855 CREATE (command) 35 5857 D 5858 DELETE (command) 36 5859 DELETED (search key) 60 5860 DRAFT (search key) 60 5862 E 5863 ENABLE (command) 31 5864 ENVELOPE (fetch item) 67 5865 ENVELOPE (fetch result) 96 5866 ESEARCH (response) 89 5867 EXAMINE (command) 35 5868 EXPIRED (response code) 78 5869 EXPUNGE (command) 57 5870 EXPUNGE (response) 91 5871 EXPUNGEISSUED (response code) 79 5872 Envelope Structure (message attribute) 13 5874 F 5875 FAST (fetch item) 63 5876 FETCH (command) 63 5877 FETCH (response) 91 5878 FLAGGED (search key) 60 5879 FLAGS (fetch item) 67 5880 FLAGS (fetch result) 97 5881 FLAGS (response) 90 5882 FLAGS (store command data item) 68 5883 FLAGS.SILENT (store command data item) 68 5884 FROM (search key) 60 5885 FULL (fetch item) 64 5886 Flags (message attribute) 11 5888 H 5889 HEADER (part specifier) 65 5890 HEADER (search key) 60 5891 HEADER.FIELDS (part specifier) 65 5892 HEADER.FIELDS.NOT (part specifier) 65 5894 I 5895 IDLE (command) 53 5896 INTERNALDATE (fetch item) 67 5897 INTERNALDATE (fetch result) 97 5898 INUSE (response code) 79 5899 Internal Date (message attribute) 12 5901 K 5902 KEYWORD (search key) 61 5903 Keyword (type of flag) 12 5905 L 5906 LARGER (search key) 61 5907 LIMIT (response code) 79 5908 LIST (command) 41 5909 LIST (response) 85 5910 LOGOUT (command) 25 5911 LSUB (command) 44 5912 LSUB (response) 88 5914 M 5915 MAX (search result option) 58 5916 MAY (specification requirement term) 5 5917 MESSAGES (status item) 50 5918 MIME (part specifier) 65 5919 MIN (search result option) 58 5920 MOVE (command) 69 5921 MUST (specification requirement term) 5 5922 MUST NOT (specification requirement term) 5 5923 Message Sequence Number (message attribute) 11 5925 N 5926 NAMESPACE (command) 45 5927 NAMESPACE (response) 89 5928 NEW (search key) 61 5929 NO (response) 82 5930 NONEXISTENT (response code) 79 5931 NOOP (command) 25 5932 NOPERM (response code) 79 5933 NOT (search key) 61 5935 O 5936 OK (response) 82 5937 ON (search key) 61 5938 OPTIONAL (specification requirement term) 5 5939 OR (search key) 61 5940 OVERQUOTA (response code) 80 5942 P 5943 PARSE (response code) 80 5944 PERMANENTFLAGS (response code) 80 5945 PREAUTH (response) 83 5946 PRIVACYREQUIRED (response code) 80 5947 Permanent Flag (class of flag) 12 5948 Predefined keywords 12 5950 R 5951 READ-ONLY (response code) 81 5952 READ-WRITE (response code) 81 5953 RECOMMENDED (specification requirement term) 5 5954 RENAME (command) 38 5955 REQUIRED (specification requirement term) 5 5956 RFC822 (fetch item) 67 5957 RFC822 (fetch result) 97 5958 RFC822.HEADER (fetch item) 67 5959 RFC822.HEADER (fetch result) 97 5960 RFC822.SIZE (fetch item) 67 5961 RFC822.SIZE (fetch result) 97 5962 RFC822.TEXT (fetch item) 67 5963 RFC822.TEXT (fetch result) 97 5965 S 5966 SEARCH (command) 58 5967 SEEN (search key) 61 5968 SELECT (command) 33 5969 SENTBEFORE (search key) 61 5970 SENTON (search key) 61 5971 SENTSINCE (search key) 61 5972 SERVERBUG (response code) 81 5973 SHOULD (specification requirement term) 5 5974 SHOULD NOT (specification requirement term) 5 5975 SINCE (search key) 61 5976 SIZE (status item) 51 5977 SMALLER (search key) 61 5978 STARTTLS (command) 26 5979 STATUS (command) 49 5980 STATUS (response) 89 5981 STORE (command) 67 5982 SUBJECT (search key) 61 5983 SUBSCRIBE (command) 40 5984 Session Flag (class of flag) 12 5985 System Flag (type of flag) 11 5987 T 5988 TEXT (part specifier) 65 5989 TEXT (search key) 61 5990 TO (search key) 61 5991 TRYCREATE (response code) 81 5993 U 5994 UID (command) 71 5995 UID (fetch item) 67 5996 UID (fetch result) 97 5997 UID (search key) 62 5998 UIDNEXT (response code) 81 5999 UIDNEXT (status item) 50 6000 UIDNOTSTICKY (response code) 81 6001 UIDVALIDITY (response code) 81 6002 UIDVALIDITY (status item) 50 6003 UNANSWERED (search key) 62 6004 UNAVAILABLE (response code) 81 6005 UNDELETED (search key) 62 6006 UNDRAFT (search key) 62 6007 UNFLAGGED (search key) 62 6008 UNKEYWORD (search key) 62 6009 UNKNOWN-CTE (response code) 82 6010 UNSEEN (search key) 62 6011 UNSEEN (status item) 50 6012 UNSELECT (command) 57 6013 UNSUBSCRIBE (command) 41 6014 Unique Identifier (UID) (message attribute) 9 6016 X 6017 X (command) 73 6019 [ 6020 [RFC-5322] Size (message attribute) 13 6022 \ 6023 \All (mailbox name attribute) 87 6024 \Answered (system flag) 11 6025 \Archive (mailbox name attribute) 87 6026 \Deleted (system flag) 11 6027 \Draft (system flag) 12 6028 \Drafts (mailbox name attribute) 87 6029 \Flagged (mailbox name attribute) 87 6030 \Flagged (system flag) 11 6031 \HasChildren (mailbox name attribute) 86 6032 \HasNoChildren (mailbox name attribute) 86 6033 \Junk (mailbox name attribute) 87 6034 \Marked (mailbox name attribute) 86 6035 \Noinferiors (mailbox name attribute) 86 6036 \Noselect (mailbox name attribute) 86 6037 \Recent (system flag) 12 6038 \Seen (system flag) 11 6039 \Sent (mailbox name attribute) 87 6040 \Trash (mailbox name attribute) 87 6041 \Unmarked (mailbox name attribute) 86 6043 Authors' Addresses 6045 Alexey Melnikov (editor) 6046 Isode Ltd 6047 14 Castle Mews 6048 Hampton, Middlesex TW12 2NP 6049 UK 6051 Email: Alexey.Melnikov@isode.com 6052 Barry Leiba (editor) 6053 Huawei Technologies 6055 Phone: +1 646 827 0648 6056 Email: barryleiba@computer.org 6057 URI: http://internetmessagingtechnology.org/