idnits 2.17.00 (12 Aug 2021) /tmp/idnits36975/draft-ietf-extra-imap4rev2-02.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 17 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 (October 19, 2018) is 1309 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 5470, but not defined == Missing Reference: 'IMAP-OBSOLETE' is mentioned on line 5465, but not defined == Missing Reference: 'IMAP-COMPAT' is mentioned on line 5455, but not defined == Missing Reference: 'IMAP-HISTORICAL' is mentioned on line 5460, but not defined == Missing Reference: 'RFC-822' is mentioned on line 5474, but not defined ** Obsolete undefined reference: RFC 822 (Obsoleted by RFC 2822) == Missing Reference: 'HEADER' is mentioned on line 4463, but not defined == Missing Reference: 'IMAP-DISC' is mentioned on line 5412, but not defined == Missing Reference: 'SMTP' is mentioned on line 5437, but not defined == Missing Reference: 'IMAP-URL' is mentioned on line 5447, but not defined == Missing Reference: 'UNSEEN 12' is mentioned on line 1609, but not defined == Missing Reference: 'UIDVALIDITY 3857529045' is mentioned on line 4446, but not defined == Missing Reference: 'UIDNEXT 4392' is mentioned on line 1643, but not defined == Missing Reference: 'UNSEEN 8' is mentioned on line 1641, but not defined == Missing Reference: 'UNSEEN 1' is mentioned on line 2436, but not defined == Missing Reference: 'UIDNEXT 2' is mentioned on line 2438, but not defined == Missing Reference: 'UIDVALIDITY 1' is mentioned on line 2508, but not defined == Missing Reference: 'IMAP-I18N' is mentioned on line 5417, but not defined == Missing Reference: 'TEXT' is mentioned on line 4398, but not defined == Missing Reference: 'RFC4314' is mentioned on line 5440, but not defined == Missing Reference: 'RFC2087' is mentioned on line 5444, but not defined ** Obsolete undefined reference: RFC 2087 (Obsoleted by RFC 9208) == Missing Reference: 'UNSEEN 17' is mentioned on line 4445, but not defined == Missing Reference: 'READ-WRITE' is mentioned on line 4447, but not defined == Missing Reference: 'RFC4422' is mentioned on line 4758, but not defined == Missing Reference: 'IMAP-TLS' is mentioned on line 5482, but not defined == Missing Reference: 'IMAP-MODEL' is mentioned on line 5423, but not defined == Missing Reference: 'IMAP-UTF-8' is mentioned on line 5500, but not defined == Missing Reference: 'ACAP' is mentioned on line 5433, but not defined == Missing Reference: 'RFC-821' is mentioned on line 5478, 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 (~~), 30 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: April 22, 2019 October 19, 2018 8 INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev2 9 draft-ietf-extra-imap4rev2-02.txt 11 Abstract 13 The Internet Message Access Protocol, Version 4rev2 (IMAP4rev2) 14 allows a client to access and manipulate electronic mail messages on 15 a server. IMAP4rev2 permits manipulation of mailboxes (remote 16 message folders) in a way that is functionally equivalent to local 17 folders. IMAP4rev2 also provides the capability for an offline 18 client to resynchronize with the server. 20 IMAP4rev2 includes operations for creating, deleting, and renaming 21 mailboxes, checking for new messages, permanently removing messages, 22 setting and clearing flags, RFC 5322 and RFC 2045 parsing, searching, 23 and selective fetching of message attributes, texts, and portions 24 thereof. Messages in IMAP4rev2 are accessed by the use of numbers. 25 These numbers are either message sequence numbers or unique 26 identifiers. 28 IMAP4rev2 does not specify a means of posting mail; this function is 29 handled by a mail submission protocol such as RFC 6409. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at https://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on April 22, 2019. 48 Copyright Notice 50 Copyright (c) 2018 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 . . . . . . . . . . . 13 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 . . . . . . . . . . . . . . . . . 14 96 3.2. Authenticated State . . . . . . . . . . . . . . . . . . . 14 97 3.3. Selected State . . . . . . . . . . . . . . . . . . . . . 14 98 3.4. Logout State . . . . . . . . . . . . . . . . . . . . . . 14 99 4. Data Formats . . . . . . . . . . . . . . . . . . . . . . . . 16 100 4.1. Atom . . . . . . . . . . . . . . . . . . . . . . . . . . 16 101 4.1.1. Sequence set and UID set . . . . . . . . . . . . . . 16 102 4.2. Number . . . . . . . . . . . . . . . . . . . . . . . . . 16 103 4.3. String . . . . . . . . . . . . . . . . . . . . . . . . . 16 104 4.3.1. 8-bit and Binary Strings . . . . . . . . . . . . . . 17 105 4.4. Parenthesized List . . . . . . . . . . . . . . . . . . . 18 106 4.5. NIL . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 107 5. Operational Considerations . . . . . . . . . . . . . . . . . 18 108 5.1. Mailbox Naming . . . . . . . . . . . . . . . . . . . . . 18 109 5.1.1. Mailbox Hierarchy Naming . . . . . . . . . . . . . . 19 110 5.1.2. Namespaces . . . . . . . . . . . . . . . . . . . . . 19 111 5.2. Mailbox Size and Message Status Updates . . . . . . . . . 21 112 5.3. Response when no Command in Progress . . . . . . . . . . 21 113 5.4. Autologout Timer . . . . . . . . . . . . . . . . . . . . 21 114 5.5. Multiple Commands in Progress (Command Pipelining) . . . 22 115 6. Client Commands . . . . . . . . . . . . . . . . . . . . . . . 23 116 6.1. Client Commands - Any State . . . . . . . . . . . . . . . 23 117 6.1.1. CAPABILITY Command . . . . . . . . . . . . . . . . . 24 118 6.1.2. NOOP Command . . . . . . . . . . . . . . . . . . . . 25 119 6.1.3. LOGOUT Command . . . . . . . . . . . . . . . . . . . 25 120 6.2. Client Commands - Not Authenticated State . . . . . . . . 26 121 6.2.1. STARTTLS Command . . . . . . . . . . . . . . . . . . 26 122 6.2.2. AUTHENTICATE Command . . . . . . . . . . . . . . . . 27 123 6.2.3. LOGIN Command . . . . . . . . . . . . . . . . . . . . 30 124 6.3. Client Commands - Authenticated State . . . . . . . . . . 31 125 6.3.1. ENABLE Command . . . . . . . . . . . . . . . . . . . 31 126 6.3.2. SELECT Command . . . . . . . . . . . . . . . . . . . 33 127 6.3.3. EXAMINE Command . . . . . . . . . . . . . . . . . . . 35 128 6.3.4. CREATE Command . . . . . . . . . . . . . . . . . . . 36 129 6.3.5. DELETE Command . . . . . . . . . . . . . . . . . . . 37 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 . . . . . . . . . . . . . . . . . . . . 54 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. UID Command . . . . . . . . . . . . . . . . . . . . . 69 149 6.5. Client Commands - Experimental/Expansion . . . . . . . . 71 150 6.5.1. X Command . . . . . . . . . . . . . . . . . . . 71 151 7. Server Responses . . . . . . . . . . . . . . . . . . . . . . 71 152 7.1. Server Responses - Status Responses . . . . . . . . . . . 72 153 7.1.1. OK Response . . . . . . . . . . . . . . . . . . . . . 79 154 7.1.2. NO Response . . . . . . . . . . . . . . . . . . . . . 80 155 7.1.3. BAD Response . . . . . . . . . . . . . . . . . . . . 80 156 7.1.4. PREAUTH Response . . . . . . . . . . . . . . . . . . 81 157 7.1.5. BYE Response . . . . . . . . . . . . . . . . . . . . 81 158 7.2. Server Responses - Server and Mailbox Status . . . . . . 82 159 7.2.1. The ENABLED Response . . . . . . . . . . . . . . . . 82 160 7.2.2. CAPABILITY Response . . . . . . . . . . . . . . . . . 82 161 7.2.3. LIST Response . . . . . . . . . . . . . . . . . . . . 83 162 7.2.4. LSUB Response . . . . . . . . . . . . . . . . . . . . 86 163 7.2.5. NAMESPACE Response . . . . . . . . . . . . . . . . . 86 164 7.2.6. STATUS Response . . . . . . . . . . . . . . . . . . . 86 165 7.2.7. ESEARCH Response . . . . . . . . . . . . . . . . . . 87 166 7.2.8. FLAGS Response . . . . . . . . . . . . . . . . . . . 87 167 7.3. Server Responses - Mailbox Size . . . . . . . . . . . . . 88 168 7.3.1. EXISTS Response . . . . . . . . . . . . . . . . . . . 88 169 7.3.2. RECENT Response . . . . . . . . . . . . . . . . . . . 88 170 7.4. Server Responses - Message Status . . . . . . . . . . . . 89 171 7.4.1. EXPUNGE Response . . . . . . . . . . . . . . . . . . 89 172 7.4.2. FETCH Response . . . . . . . . . . . . . . . . . . . 90 173 7.5. Server Responses - Command Continuation Request . . . . . 95 174 8. Sample IMAP4rev2 connection . . . . . . . . . . . . . . . . . 95 175 9. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 97 176 10. Author's Note . . . . . . . . . . . . . . . . . . . . . . . . 111 177 11. Security Considerations . . . . . . . . . . . . . . . . . . . 111 178 11.1. STARTTLS Security Considerations . . . . . . . . . . . . 111 179 11.2. COPYUID and APPENDUID response codes . . . . . . . . . . 111 180 11.3. Other Security Considerations . . . . . . . . . . . . . 112 181 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 112 182 12.1. Updates to IMAP4 Capabilities registry . . . . . . . . . 113 183 12.2. GSSAPI/SASL service name . . . . . . . . . . . . . . . . 113 184 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 113 185 13.1. Normative References . . . . . . . . . . . . . . . . . . 113 186 13.2. Informative References (related protocols) . . . . . . . 116 187 13.3. Informative References (historical aspects of IMAP and 188 related protocols) . . . . . . . . . . . . . . . . . . . 117 189 Appendix A. Backward compatibility with IMAP4rev1 . . . . . . . 118 190 A.1. Mailbox International Naming Convention . . . . . . . . . 118 191 Appendix B. Changes from RFC 3501 / IMAP4rev1 . . . . . . . . . 120 192 Appendix C. Acknowledgement . . . . . . . . . . . . . . . . . . 121 193 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 194 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 127 196 1. How to Read This Document 198 1.1. Organization of This Document 200 This document is written from the point of view of the implementor of 201 an IMAP4rev2 client or server. Beyond the protocol overview in 202 section 2, it is not optimized for someone trying to understand the 203 operation of the protocol. The material in sections 3 through 5 204 provides the general context and definitions with which IMAP4rev2 205 operates. 207 Sections 6, 7, and 9 describe the IMAP commands, responses, and 208 syntax, respectively. The relationships among these are such that it 209 is almost impossible to understand any of them separately. In 210 particular, do not attempt to deduce command syntax from the command 211 section alone; instead refer to the Formal Syntax section. 213 1.2. Conventions Used in This Document 215 "Conventions" are basic principles or procedures. Document 216 conventions are noted in this section. 218 In examples, "C:" and "S:" indicate lines sent by the client and 219 server respectively. 221 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 222 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 223 document are to be interpreted as described in [KEYWORDS]. 225 The word "can" (not "may") is used to refer to a possible 226 circumstance or situation, as opposed to an optional facility of the 227 protocol. 229 "User" is used to refer to a human user, whereas "client" refers to 230 the software being run by the user. 232 "Connection" refers to the entire sequence of client/server 233 interaction from the initial establishment of the network connection 234 until its termination. 236 "Session" refers to the sequence of client/server interaction from 237 the time that a mailbox is selected (SELECT or EXAMINE command) until 238 the time that selection ends (SELECT or EXAMINE of another mailbox, 239 CLOSE command, or connection termination). 241 Characters are 7-bit US-ASCII unless otherwise specified. Other 242 character sets are indicated using a "CHARSET", as described in 243 [MIME-IMT] and defined in [CHARSET]. CHARSETs have important 244 additional semantics in addition to defining character set; refer to 245 these documents for more detail. 247 There are several protocol conventions in IMAP. These refer to 248 aspects of the specification which are not strictly part of the IMAP 249 protocol, but reflect generally-accepted practice. Implementations 250 need to be aware of these conventions, and avoid conflicts whether or 251 not they implement the convention. For example, "&" may not be used 252 as a hierarchy delimiter since it conflicts with the Mailbox 253 International Naming Convention, and other uses of "&" in mailbox 254 names are impacted as well. 256 1.3. Special Notes to Implementors 258 Implementors of the IMAP protocol are strongly encouraged to read the 259 IMAP implementation recommendations document [IMAP-IMPLEMENTATION] in 260 conjunction with this document, to help understand the intricacies of 261 this protocol and how best to build an interoperable product. 263 IMAP4rev2 is designed to be upwards compatible from the [IMAP2] and 264 unpublished IMAP2bis protocols. IMAP4rev2 is largely compatible with 265 the IMAP4rev1 protocol described in RFC 3501 and the IMAP4 protocol 266 described in RFC 1730; the exception being in certain facilities 267 added in RFC 1730 that proved problematic and were subsequently 268 removed. In the course of the evolution of IMAP4rev2, some aspects 269 in the earlier protocols have become obsolete. Obsolete commands, 270 responses, and data formats which an IMAP4rev2 implementation can 271 encounter when used with an earlier implementation are described in 272 [IMAP-OBSOLETE]. 274 Other compatibility issues with IMAP2bis, the most common variant of 275 the earlier protocol, are discussed in [IMAP-COMPAT]. A full 276 discussion of compatibility issues with rare (and presumed extinct) 277 variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is 278 primarily of historical interest. 280 IMAP was originally developed for the older [RFC-822] standard, and 281 as a consequence several fetch items in IMAP incorporate "RFC822" in 282 their name. With the exception of RFC822.SIZE, there are more modern 283 replacements; for example, the modern version of RFC822.HEADER is 284 BODY.PEEK[HEADER]. In all cases, "RFC822" should be interpreted as a 285 reference to the updated [RFC-5322] standard. 287 2. Protocol Overview 289 2.1. Link Level 291 The IMAP4rev2 protocol assumes a reliable data stream such as that 292 provided by TCP. When TCP is used, an IMAP4rev2 server listens on 293 port 143. 295 2.2. Commands and Responses 297 An IMAP4rev2 connection consists of the establishment of a client/ 298 server network connection, an initial greeting from the server, and 299 client/server interactions. These client/server interactions consist 300 of a client command, server data, and a server completion result 301 response. 303 All interactions transmitted by client and server are in the form of 304 lines, that is, strings that end with a CRLF. The protocol receiver 305 of an IMAP4rev2 client or server is either reading a line, or is 306 reading a sequence of octets with a known count followed by a line. 308 2.2.1. Client Protocol Sender and Server Protocol Receiver 310 The client command begins an operation. Each client command is 311 prefixed with an identifier (typically a short alphanumeric string, 312 e.g., A0001, A0002, etc.) called a "tag". A different tag is 313 generated by the client for each command. 315 Clients MUST follow the syntax outlined in this specification 316 strictly. It is a syntax error to send a command with missing or 317 extraneous spaces or arguments. 319 There are two cases in which a line from the client does not 320 represent a complete command. In one case, a command argument is 321 quoted with an octet count (see the description of literal in String 322 under Data Formats); in the other case, the command arguments require 323 server feedback (see the AUTHENTICATE command). In either case, the 324 server sends a command continuation request response if it is ready 325 for the octets (if appropriate) and the remainder of the command. 326 This response is prefixed with the token "+". 328 Note: If instead, the server detected an error in the command, it 329 sends a BAD completion response with a tag matching the command 330 (as described below) to reject the command and prevent the client 331 from sending any more of the command. 333 It is also possible for the server to send a completion response 334 for some other command (if multiple commands are in progress), or 335 untagged data. In either case, the command continuation request 336 is still pending; the client takes the appropriate action for the 337 response, and reads another response from the server. In all 338 cases, the client MUST send a complete command (including 339 receiving all command continuation request responses and command 340 continuations for the command) before initiating a new command. 342 The protocol receiver of an IMAP4rev2 server reads a command line 343 from the client, parses the command and its arguments, and transmits 344 server data and a server command completion result response. 346 2.2.2. Server Protocol Sender and Client Protocol Receiver 348 Data transmitted by the server to the client and status responses 349 that do not indicate command completion are prefixed with the token 350 "*", and are called untagged responses. 352 Server data MAY be sent as a result of a client command, or MAY be 353 sent unilaterally by the server. There is no syntactic difference 354 between server data that resulted from a specific command and server 355 data that were sent unilaterally. 357 The server completion result response indicates the success or 358 failure of the operation. It is tagged with the same tag as the 359 client command which began the operation. Thus, if more than one 360 command is in progress, the tag in a server completion response 361 identifies the command to which the response applies. There are 362 three possible server completion responses: OK (indicating success), 363 NO (indicating failure), or BAD (indicating a protocol error such as 364 unrecognized command or command syntax error). 366 Servers SHOULD enforce the syntax outlined in this specification 367 strictly. Any client command with a protocol syntax error, including 368 (but not limited to) missing or extraneous spaces or arguments, 369 SHOULD be rejected, and the client given a BAD server completion 370 response. 372 The protocol receiver of an IMAP4rev2 client reads a response line 373 from the server. It then takes action on the response based upon the 374 first token of the response, which can be a tag, a "*", or a "+". 376 A client MUST be prepared to accept any server response at all times. 377 This includes server data that was not requested. Server data SHOULD 378 be recorded, so that the client can reference its recorded copy 379 rather than sending a command to the server to request the data. In 380 the case of certain server data, the data MUST be recorded. 382 This topic is discussed in greater detail in the Server Responses 383 section. 385 2.3. Message Attributes 387 In addition to message text, each message has several attributes 388 associated with it. These attributes can be retrieved individually 389 or in conjunction with other attributes or message texts. 391 2.3.1. Message Numbers 393 Messages in IMAP4rev2 are accessed by one of two numbers; the unique 394 identifier or the message sequence number. 396 2.3.1.1. Unique Identifier (UID) Message Attribute 398 An unsigned 32-bit value assigned to each message, which when used 399 with the unique identifier validity value (see below) forms a 64-bit 400 value that MUST NOT refer to any other message in the mailbox or any 401 subsequent mailbox with the same name forever. Unique identifiers 402 are assigned in a strictly ascending fashion in the mailbox; as each 403 message is added to the mailbox it is assigned a higher UID than the 404 message(s) which were added previously. Unlike message sequence 405 numbers, unique identifiers are not necessarily contiguous. 407 The unique identifier of a message MUST NOT change during the 408 session, and SHOULD NOT change between sessions. Any change of 409 unique identifiers between sessions MUST be detectable using the 410 UIDVALIDITY mechanism discussed below. Persistent unique identifiers 411 are required for a client to resynchronize its state from a previous 412 session with the server (e.g., disconnected or offline access 413 clients); this is discussed further in [IMAP-DISC]. 415 Associated with every mailbox are two 32-bit unsigned values which 416 aid in unique identifier handling: the next unique identifier value 417 (UIDNEXT) and the unique identifier validity value (UIDVALIDITY). 419 The next unique identifier value is the predicted value that will be 420 assigned to a new message in the mailbox. Unless the unique 421 identifier validity also changes (see below), the next unique 422 identifier value MUST have the following two characteristics. First, 423 the next unique identifier value MUST NOT change unless new messages 424 are added to the mailbox; and second, the next unique identifier 425 value MUST change whenever new messages are added to the mailbox, 426 even if those new messages are subsequently expunged. 428 Note: The next unique identifier value is intended to provide a 429 means for a client to determine whether any messages have been 430 delivered to the mailbox since the previous time it checked this 431 value. It is not intended to provide any guarantee that any 432 message will have this unique identifier. A client can only 433 assume, at the time that it obtains the next unique identifier 434 value, that messages arriving after that time will have a UID 435 greater than or equal to that value. 437 The unique identifier validity value is sent in a UIDVALIDITY 438 response code in an OK untagged response at mailbox selection time. 439 If unique identifiers from an earlier session fail to persist in this 440 session, the unique identifier validity value MUST be greater than 441 the one used in the earlier session. 443 Note: Ideally, unique identifiers SHOULD persist at all times. 444 Although this specification recognizes that failure to persist can 445 be unavoidable in certain server environments, it STRONGLY 446 ENCOURAGES message store implementation techniques that avoid this 447 problem. For example: 449 1. Unique identifiers MUST be strictly ascending in the mailbox 450 at all times. If the physical message store is re-ordered by 451 a non-IMAP agent, this requires that the unique identifiers in 452 the mailbox be regenerated, since the former unique 453 identifiers are no longer strictly ascending as a result of 454 the re-ordering. 456 2. If the message store has no mechanism to store unique 457 identifiers, it must regenerate unique identifiers at each 458 session, and each session must have a unique UIDVALIDITY 459 value. 461 3. If the mailbox is deleted and a new mailbox with the same name 462 is created at a later date, the server must either keep track 463 of unique identifiers from the previous instance of the 464 mailbox, or it must assign a new UIDVALIDITY value to the new 465 instance of the mailbox. A good UIDVALIDITY value to use in 466 this case is a 32-bit representation of the creation date/time 467 of the mailbox. It is alright to use a constant such as 1, 468 but only if it guaranteed that unique identifiers will never 469 be reused, even in the case of a mailbox being deleted (or 470 renamed) and a new mailbox by the same name created at some 471 future time. 473 4. The combination of mailbox name, UIDVALIDITY, and UID must 474 refer to a single immutable message on that server forever. 475 In particular, the internal date, [RFC-5322] size, envelope, 476 body structure, and message texts (RFC822, RFC822.HEADER, 477 RFC822.TEXT, and all BODY[...] fetch data items) must never 478 change. This does not include message numbers, nor does it 479 include attributes that can be set by a STORE command (e.g., 480 FLAGS). 482 2.3.1.2. Message Sequence Number Message Attribute 484 A relative position from 1 to the number of messages in the mailbox. 485 This position MUST be ordered by ascending unique identifier. As 486 each new message is added, it is assigned a message sequence number 487 that is 1 higher than the number of messages in the mailbox before 488 that new message was added. 490 Message sequence numbers can be reassigned during the session. For 491 example, when a message is permanently removed (expunged) from the 492 mailbox, the message sequence number for all subsequent messages is 493 decremented. The number of messages in the mailbox is also 494 decremented. Similarly, a new message can be assigned a message 495 sequence number that was once held by some other message prior to an 496 expunge. 498 In addition to accessing messages by relative position in the 499 mailbox, message sequence numbers can be used in mathematical 500 calculations. For example, if an untagged "11 EXISTS" is received, 501 and previously an untagged "8 EXISTS" was received, three new 502 messages have arrived with message sequence numbers of 9, 10, and 11. 503 Another example, if message 287 in a 523 message mailbox has UID 504 12345, there are exactly 286 messages which have lesser UIDs and 236 505 messages which have greater UIDs. 507 2.3.2. Flags Message Attribute 509 A list of zero or more named tokens associated with the message. A 510 flag is set by its addition to this list, and is cleared by its 511 removal. There are two types of flags in IMAP4rev2. A flag of 512 either type can be permanent or session-only. 514 A system flag is a flag name that is pre-defined in this 515 specification and begin with "\". Certain system flags (\Deleted and 516 \Seen) have special semantics described elsewhere. The currently- 517 defined system flags are: 519 \Seen Message has been read 521 \Answered Message has been answered 523 \Flagged Message is "flagged" for urgent/special attention 525 \Deleted Message is "deleted" for removal by later EXPUNGE 526 \Draft Message has not completed composition (marked as a draft). 528 \Recent Message is "recently" arrived in this mailbox. This session 529 is the first session to have been notified about this message; if 530 the session is read-write, subsequent sessions will not see 531 \Recent set for this message. This flag can not be altered by the 532 client. 534 If it is not possible to determine whether or not this session is 535 the first session to be notified about a message, then that 536 message SHOULD be considered recent. 538 If multiple connections have the same mailbox selected 539 simultaneously, it is undefined which of these connections will 540 see newly-arrived messages with \Recent set and which will see it 541 without \Recent set. 543 A keyword is defined by the server implementation. Keywords do not 544 begin with "\". Servers MAY permit the client to define new keywords 545 in the mailbox (see the description of the PERMANENTFLAGS response 546 code for more information). Some keywords that start with "$" are 547 also defined in this specification. 549 This document defines several keywords that were not originally 550 defined in RFC 3501, but which were found to be useful by client 551 implementations. These keywords SHOULD be supported (i.e. allowed in 552 APPEND, COPY and SEARCH commands) by server implementations: 554 \Forwarded Message has been forwarded to another email address, 555 embedded within or attached to a new message. An email client 556 sets this keyword when it successfully forwards the message to 557 another email address. Typical usage of this keyword is to show a 558 different (or additional) icon for a message that has been 559 forwarded. Once set, the flag SHOULD NOT be cleared. 561 $MDNSent Message Disposition Notification was generated and sent for 562 this message. 564 A flag can be permanent or session-only on a per-flag basis. 565 Permanent flags are those which the client can add or remove from the 566 message flags permanently; that is, concurrent and subsequent 567 sessions will see any change in permanent flags. Changes to session 568 flags are valid only in that session. 570 Note: The \Recent system flag is a special case of a session flag. 571 \Recent can not be used as an argument in a STORE or APPEND 572 command, and thus can not be changed at all. 574 2.3.3. Internal Date Message Attribute 576 The internal date and time of the message on the server. This is not 577 the date and time in the [RFC-5322] header, but rather a date and 578 time which reflects when the message was received. In the case of 579 messages delivered via [SMTP], this SHOULD be the date and time of 580 final delivery of the message as defined by [SMTP]. In the case of 581 messages delivered by the IMAP4rev2 COPY command, this SHOULD be the 582 internal date and time of the source message. In the case of 583 messages delivered by the IMAP4rev2 APPEND command, this SHOULD be 584 the date and time as specified in the APPEND command description. 585 All other cases are implementation defined. 587 2.3.4. [RFC-5322] Size Message Attribute 589 The number of octets in the message, as expressed in [RFC-5322] 590 format. 592 2.3.5. Envelope Structure Message Attribute 594 A parsed representation of the [RFC-5322] header of the message. 595 Note that the IMAP Envelope structure is not the same as an [SMTP] 596 envelope. 598 2.3.6. Body Structure Message Attribute 600 A parsed representation of the [MIME-IMB] body structure information 601 of the message. 603 2.4. Message Texts 605 In addition to being able to fetch the full [RFC-5322] text of a 606 message, IMAP4rev2 permits the fetching of portions of the full 607 message text. Specifically, it is possible to fetch the [RFC-5322] 608 message header, [RFC-5322] message body, a [MIME-IMB] body part, or a 609 [MIME-IMB] header. 611 3. State and Flow Diagram 613 Once the connection between client and server is established, an 614 IMAP4rev2 connection is in one of four states. The initial state is 615 identified in the server greeting. Most commands are only valid in 616 certain states. It is a protocol error for the client to attempt a 617 command while the connection is in an inappropriate state, and the 618 server will respond with a BAD or NO (depending upon server 619 implementation) command completion result. 621 3.1. Not Authenticated State 623 In the not authenticated state, the client MUST supply authentication 624 credentials before most commands will be permitted. This state is 625 entered when a connection starts unless the connection has been pre- 626 authenticated. 628 3.2. Authenticated State 630 In the authenticated state, the client is authenticated and MUST 631 select a mailbox to access before commands that affect messages will 632 be permitted. This state is entered when a pre-authenticated 633 connection starts, when acceptable authentication credentials have 634 been provided, after an error in selecting a mailbox, or after a 635 successful CLOSE command. 637 3.3. Selected State 639 In a selected state, a mailbox has been selected to access. This 640 state is entered when a mailbox has been successfully selected. 642 3.4. Logout State 644 In the logout state, the connection is being terminated. This state 645 can be entered as a result of a client request (via the LOGOUT 646 command) or by unilateral action on the part of either the client or 647 server. 649 If the client requests the logout state, the server MUST send an 650 untagged BYE response and a tagged OK response to the LOGOUT command 651 before the server closes the connection; and the client MUST read the 652 tagged OK response to the LOGOUT command before the client closes the 653 connection. 655 A server MUST NOT unilaterally close the connection without sending 656 an untagged BYE response that contains the reason for having done so. 657 A client SHOULD NOT unilaterally close the connection, and instead 658 SHOULD issue a LOGOUT command. If the server detects that the client 659 has unilaterally closed the connection, the server MAY omit the 660 untagged BYE response and simply close its connection. 662 +----------------------+ 663 |connection established| 664 +----------------------+ 665 || 666 \/ 667 +--------------------------------------+ 668 | server greeting | 669 +--------------------------------------+ 670 || (1) || (2) || (3) 671 \/ || || 672 +-----------------+ || || 673 |Not Authenticated| || || 674 +-----------------+ || || 675 || (7) || (4) || || 676 || \/ \/ || 677 || +----------------+ || 678 || | Authenticated |<=++ || 679 || +----------------+ || || 680 || || (7) || (5) || (6) || 681 || || \/ || || 682 || || +--------+ || || 683 || || |Selected|==++ || 684 || || +--------+ || 685 || || || (7) || 686 \/ \/ \/ \/ 687 +--------------------------------------+ 688 | Logout | 689 +--------------------------------------+ 690 || 691 \/ 692 +-------------------------------+ 693 |both sides close the connection| 694 +-------------------------------+ 696 (1) connection without pre-authentication (OK greeting) 697 (2) pre-authenticated connection (PREAUTH greeting) 698 (3) rejected connection (BYE greeting) 699 (4) successful LOGIN or AUTHENTICATE command 700 (5) successful SELECT or EXAMINE command 701 (6) CLOSE command, unsolicited CLOSED response code or 702 failed SELECT or EXAMINE command 703 (7) LOGOUT command, server shutdown, or connection closed 705 4. Data Formats 707 IMAP4rev2 uses textual commands and responses. Data in IMAP4rev2 can 708 be in one of several forms: atom, number, string, parenthesized list, 709 or NIL. Note that a particular data item may take more than one 710 form; for example, a data item defined as using "astring" syntax may 711 be either an atom or a string. 713 4.1. Atom 715 An atom consists of one or more non-special characters. 717 4.1.1. Sequence set and UID set 719 A set of messages can be referenced by a sequence set containing 720 either message sequence numbers or unique identifiers. See Section 9 721 for details. Sequence sets can contain ranges (e.g. "5:50"), an 722 enumeration of specific message/UID numbers, a special symbol "*", or 723 a combination of the above. 725 A "UID set" is similar to the sequence set of unique identifiers; 726 however, the "*" value for a sequence number is not permitted. 728 4.2. Number 730 A number consists of one or more digit characters, and represents a 731 numeric value. 733 4.3. String 735 A string is in one of three forms: synchonizing literal, non- 736 synchronizing literal or quoted string. The synchronizing literal 737 form is the general form of string. The non-synchronizing literal 738 form is also the general form, but has length limitation. The quoted 739 string form is an alternative that avoids the overhead of processing 740 a literal at the cost of limitations of characters which may be used. 742 When the distinction between synchronizing and non-synchronizing 743 literals is not important, this document just uses the term 744 "literal". 746 A synchronizing literal is a sequence of zero or more octets 747 (including CR and LF), prefix-quoted with an octet count in the form 748 of an open brace ("{"), the number of octets, close brace ("}"), and 749 CRLF. In the case of synchronizing literals transmitted from server 750 to client, the CRLF is immediately followed by the octet data. In 751 the case of synchronizing literals transmitted from client to server, 752 the client MUST wait to receive a command continuation request 753 (described later in this document) before sending the octet data (and 754 the remainder of the command). 756 The non-synchronizing literal is an alternate form of synchronizing 757 literal, and it may appear in communication from client to server 758 instead of the synchonizing form of literal. The non-synchronizing 759 literal form MUST NOT be sent from server to client. The non- 760 synchronizing literal is distinguished from the synchronizing literal 761 by having a plus ("+") between the octet count and the closing brace 762 ("}"). The server does not generate a command continuation request 763 in response to a non-synchronizing literal, and clients are not 764 required to wait before sending the octets of a non- synchronizing 765 literal. Non-synchronizing literals MUST NOT be larger than 4096 766 octets. Any literal larger than 4096 bytes MUST be sent as a 767 synchronizing literal. (Non-synchronizing literals defined in this 768 document are the same as non-synchronizing literals defined by 769 LITERAL- extension from [RFC7888]. See that document for details on 770 how to handle invalid non-synchronizing literals longer than 4096 771 octets and for interaction with other IMAP extensions.) 773 A quoted string is a sequence of zero or more Unicode characters, 774 excluding CR and LF, encoded in UTF-8, with double quote (<">) 775 characters at each end. 777 The empty string is represented as "" (a quoted string with zero 778 characters between double quotes), as {0} followed by CRLF (a 779 synchronizing literal with an octet count of 0) or as {0+} followed 780 by CRLF (a non-synchronizing literal with an octet count of 0). 782 Note: Even if the octet count is 0, a client transmitting a 783 synchronizing literal MUST wait to receive a command continuation 784 request. 786 4.3.1. 8-bit and Binary Strings 788 8-bit textual and binary mail is supported through the use of a 789 [MIME-IMB] content transfer encoding. IMAP4rev2 implementations MAY 790 transmit 8-bit or multi-octet characters in literals, but SHOULD do 791 so only when the [CHARSET] is identified. 793 IMAP4rev2 is compatible with [I18N-HDRS]. As a result, the 794 identified charset for header-field values with 8-bit content is 795 UTF-8 [UTF-8]. IMAP4rev2 implementations MUST accept and MAY 796 transmit [UTF-8] text in quoted-strings as long as the string does 797 not contain NUL, CR, or LF. This differs from IMAP4rev1 798 implementations. 800 Although a BINARY body encoding is defined, unencoded binary strings 801 are not permitted. A "binary string" is any string with NUL 802 characters. Implementations MUST encode binary data into a textual 803 form, such as BASE64, before transmitting the data. A string with an 804 excessive amount of CTL characters MAY also be considered to be 805 binary. 807 4.4. Parenthesized List 809 Data structures are represented as a "parenthesized list"; a sequence 810 of data items, delimited by space, and bounded at each end by 811 parentheses. A parenthesized list can contain other parenthesized 812 lists, using multiple levels of parentheses to indicate nesting. 814 The empty list is represented as () -- a parenthesized list with no 815 members. 817 4.5. NIL 819 The special form "NIL" represents the non-existence of a particular 820 data item that is represented as a string or parenthesized list, as 821 distinct from the empty string "" or the empty parenthesized list (). 823 Note: NIL is never used for any data item which takes the form of 824 an atom. For example, a mailbox name of "NIL" is a mailbox named 825 NIL as opposed to a non-existent mailbox name. This is because 826 mailbox uses "astring" syntax which is an atom or a string. 827 Conversely, an addr-name of NIL is a non-existent personal name, 828 because addr-name uses "nstring" syntax which is NIL or a string, 829 but never an atom. 831 5. Operational Considerations 833 The following rules are listed here to ensure that all IMAP4rev2 834 implementations interoperate properly. 836 5.1. Mailbox Naming 838 In IMAP4rev2, Mailbox names are encoded in Net-Unicode [NET-UNICODE] 839 (this differs from IMAP4rev1). Client implementations MAY attempt to 840 create Net-Unicode mailbox names, and MUST interpret any 8-bit 841 mailbox names returned by LIST or LSUB as [NET-UNICODE]. Server 842 implementations MUST prohibit the creation of 8-bit mailbox names 843 that do not comply with Net-Unicode (however, servers MAY accept a 844 de-normalized UTF-8 mailbox name and convert it to Net-Unicode prior 845 to mailbox creation). 847 The case-insensitive mailbox name INBOX is a special name reserved to 848 mean "the primary mailbox for this user on this server". (Note that 849 this special name may not exist on some servers for some users.) The 850 interpretation of all other names is implementation-dependent. 852 In particular, this specification takes no position on case 853 sensitivity in non-INBOX mailbox names. Some server implementations 854 are fully case-sensitive in ASCII range; others preserve case of a 855 newly-created name but otherwise are case-insensitive; and yet others 856 coerce names to a particular case. Client implementations MUST 857 interact with any of these. 859 There are certain client considerations when creating a new mailbox 860 name: 862 1. Any character which is one of the atom-specials (see the Formal 863 Syntax) will require that the mailbox name be represented as a 864 quoted string or literal. 866 2. CTL and other non-graphic characters are difficult to represent 867 in a user interface and are best avoided. Servers MAY refuse to 868 create mailbox names containing Unicode CTL characters. 870 3. Although the list-wildcard characters ("%" and "*") are valid in 871 a mailbox name, it is difficult to use such mailbox names with 872 the LIST and LSUB commands due to the conflict with wildcard 873 interpretation. 875 4. Usually, a character (determined by the server implementation) is 876 reserved to delimit levels of hierarchy. 878 5. Two characters, "#" and "&", have meanings by convention, and 879 should be avoided except when used in that convention. 881 5.1.1. Mailbox Hierarchy Naming 883 If it is desired to export hierarchical mailbox names, mailbox names 884 MUST be left-to-right hierarchical using a single character to 885 separate levels of hierarchy. The same hierarchy separator character 886 is used for all levels of hierarchy within a single name. 888 5.1.2. Namespaces 890 Personal Namespace: A namespace that the server considers within the 891 personal scope of the authenticated user on a particular connection. 892 Typically, only the authenticated user has access to mailboxes in 893 their Personal Namespace. It is the part of the namespace that 894 belongs to the user that is allocated for mailboxes. If an INBOX 895 exists for a user, it MUST appear within the user's personal 896 namespace. In the typical case, there SHOULD be only one Personal 897 Namespace on a server. 899 Other Users' Namespace: A namespace that consists of mailboxes from 900 the Personal Namespaces of other users. To access mailboxes in the 901 Other Users' Namespace, the currently authenticated user MUST be 902 explicitly granted access rights. For example, it is common for a 903 manager to grant to their secretary access rights to their mailbox. 904 In the typical case, there SHOULD be only one Other Users' Namespace 905 on a server. 907 Shared Namespace: A namespace that consists of mailboxes that are 908 intended to be shared amongst users and do not exist within a user's 909 Personal Namespace. 911 The namespaces a server uses MAY differ on a per-user basis. 913 5.1.2.1. Historic Mailbox Namespace Naming Convention 915 By convention, the first hierarchical element of any mailbox name 916 which begins with "#" identifies the "namespace" of the remainder of 917 the name. This makes it possible to disambiguate between different 918 types of mailbox stores, each of which have their own namespaces. 920 For example, implementations which offer access to USENET 921 newsgroups MAY use the "#news" namespace to partition the USENET 922 newsgroup namespace from that of other mailboxes. Thus, the 923 comp.mail.misc newsgroup would have a mailbox name of 924 "#news.comp.mail.misc", and the name "comp.mail.misc" can refer to 925 a different object (e.g., a user's private mailbox). 927 Namespaces that include the "#" character are not IMAP URL [IMAP-URL] 928 friendly requiring the "#" character to be represented as %23 when 929 within URLs. As such, server implementers MAY instead consider using 930 namespace prefixes that do not contain the "#" character. 932 5.1.2.2. Common namespace models 934 Previous version of this protocol does not define a default server 935 namespace. Two common namespace models have evolved: 937 The "Personal Mailbox" model, in which the default namespace that is 938 presented consists of only the user's personal mailboxes. To access 939 shared mailboxes, the user must use an escape mechanism to reach 940 another namespace. 942 The "Complete Hierarchy" model, in which the default namespace that 943 is presented includes the user's personal mailboxes along with any 944 other mailboxes they have access to. 946 5.2. Mailbox Size and Message Status Updates 948 At any time, a server can send data that the client did not request. 949 Sometimes, such behavior is REQUIRED. For example, agents other than 950 the server MAY add messages to the mailbox (e.g., new message 951 delivery), change the flags of the messages in the mailbox (e.g., 952 simultaneous access to the same mailbox by multiple agents), or even 953 remove messages from the mailbox. A server MUST send mailbox size 954 updates automatically if a mailbox size change is observed during the 955 processing of a command. A server SHOULD send message flag updates 956 automatically, without requiring the client to request such updates 957 explicitly. 959 Special rules exist for server notification of a client about the 960 removal of messages to prevent synchronization errors; see the 961 description of the EXPUNGE response for more detail. In particular, 962 it is NOT permitted to send an EXISTS response that would reduce the 963 number of messages in the mailbox; only the EXPUNGE response can do 964 this. 966 Regardless of what implementation decisions a client makes on 967 remembering data from the server, a client implementation MUST record 968 mailbox size updates. It MUST NOT assume that any command after the 969 initial mailbox selection will return the size of the mailbox. 971 5.3. Response when no Command in Progress 973 Server implementations are permitted to send an untagged response 974 (except for EXPUNGE) while there is no command in progress. Server 975 implementations that send such responses MUST deal with flow control 976 considerations. Specifically, they MUST either (1) verify that the 977 size of the data does not exceed the underlying transport's available 978 window size, or (2) use non-blocking writes. 980 5.4. Autologout Timer 982 If a server has an inactivity autologout timer that applies to 983 sessions after authentication, the duration of that timer MUST be at 984 least 30 minutes. The receipt of ANY command from the client during 985 that interval SHOULD suffice to reset the autologout timer. 987 5.5. Multiple Commands in Progress (Command Pipelining) 989 The client MAY send another command without waiting for the 990 completion result response of a command, subject to ambiguity rules 991 (see below) and flow control constraints on the underlying data 992 stream. Similarly, a server MAY begin processing another command 993 before processing the current command to completion, subject to 994 ambiguity rules. However, any command continuation request responses 995 and command continuations MUST be negotiated before any subsequent 996 command is initiated. 998 The exception is if an ambiguity would result because of a command 999 that would affect the results of other commands. Clients MUST NOT 1000 send multiple commands without waiting if an ambiguity would result. 1001 If the server detects a possible ambiguity, it MUST execute commands 1002 to completion in the order given by the client. 1004 The most obvious example of ambiguity is when a command would affect 1005 the results of another command, e.g., a FETCH of a message's flags 1006 and a STORE of that same message's flags. 1008 A non-obvious ambiguity occurs with commands that permit an untagged 1009 EXPUNGE response (commands other than FETCH, STORE, and SEARCH), 1010 since an untagged EXPUNGE response can invalidate sequence numbers in 1011 a subsequent command. This is not a problem for FETCH, STORE, or 1012 SEARCH commands because servers are prohibited from sending EXPUNGE 1013 responses while any of those commands are in progress. Therefore, if 1014 the client sends any command other than FETCH, STORE, or SEARCH, it 1015 MUST wait for the completion result response before sending a command 1016 with message sequence numbers. 1018 Note: EXPUNGE responses are permitted while UID FETCH, UID STORE, 1019 and UID SEARCH are in progress. If the client sends a UID 1020 command, it MUST wait for a completion result response before 1021 sending a command which uses message sequence numbers (this may 1022 include UID SEARCH). Any message sequence numbers in an argument 1023 to UID SEARCH are associated with messages prior to the effect of 1024 any untagged EXPUNGE returned by the UID SEARCH. 1026 For example, the following non-waiting command sequences are invalid: 1028 FETCH + NOOP + STORE 1030 STORE + COPY + FETCH 1032 COPY + COPY 1034 CHECK + FETCH 1036 The following are examples of valid non-waiting command sequences: 1038 FETCH + STORE + SEARCH + CHECK 1040 STORE + COPY + EXPUNGE 1042 UID SEARCH + UID SEARCH may be valid or invalid as a non-waiting 1043 command sequence, depending upon whether or not the second UID 1044 SEARCH contains message sequence numbers. 1046 6. Client Commands 1048 IMAP4rev2 commands are described in this section. Commands are 1049 organized by the state in which the command is permitted. Commands 1050 which are permitted in multiple states are listed in the minimum 1051 permitted state (for example, commands valid in authenticated and 1052 selected state are listed in the authenticated state commands). 1054 Command arguments, identified by "Arguments:" in the command 1055 descriptions below, are described by function, not by syntax. The 1056 precise syntax of command arguments is described in the Formal Syntax 1057 (Section 9). 1059 Some commands cause specific server responses to be returned; these 1060 are identified by "Responses:" in the command descriptions below. 1061 See the response descriptions in the Responses section for 1062 information on these responses, and the Formal Syntax section for the 1063 precise syntax of these responses. It is possible for server data to 1064 be transmitted as a result of any command. Thus, commands that do 1065 not specifically require server data specify "no specific responses 1066 for this command" instead of "none". 1068 The "Result:" in the command description refers to the possible 1069 tagged status responses to a command, and any special interpretation 1070 of these status responses. 1072 The state of a connection is only changed by successful commands 1073 which are documented as changing state. A rejected command (BAD 1074 response) never changes the state of the connection or of the 1075 selected mailbox. A failed command (NO response) generally does not 1076 change the state of the connection or of the selected mailbox; the 1077 exception being the SELECT and EXAMINE commands. 1079 6.1. Client Commands - Any State 1081 The following commands are valid in any state: CAPABILITY, NOOP, and 1082 LOGOUT. 1084 6.1.1. CAPABILITY Command 1086 Arguments: none 1088 Responses: REQUIRED untagged response: CAPABILITY 1090 Result: OK - capability completed 1091 BAD - command unknown or arguments invalid 1093 The CAPABILITY command requests a listing of capabilities that the 1094 server supports. The server MUST send a single untagged CAPABILITY 1095 response with "IMAP4rev2" as one of the listed capabilities before 1096 the (tagged) OK response. 1098 A capability name which begins with "AUTH=" indicates that the server 1099 supports that particular authentication mechanism. All such names 1100 are, by definition, part of this specification. For example, the 1101 authorization capability for an experimental "blurdybloop" 1102 authenticator would be "AUTH=XBLURDYBLOOP" and not 1103 "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP". 1105 Other capability names refer to extensions, revisions, or amendments 1106 to this specification. See the documentation of the CAPABILITY 1107 response for additional information. No capabilities, beyond the 1108 base IMAP4rev2 set defined in this specification, are enabled without 1109 explicit client action to invoke the capability. 1111 Client and server implementations MUST implement the STARTTLS, 1112 LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) capabilities. 1113 See the Security Considerations section for important information. 1115 See the section entitled "Client Commands - Experimental/Expansion" 1116 for information about the form of site or implementation-specific 1117 capabilities. 1119 Example: C: abcd CAPABILITY 1120 S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI 1121 LOGINDISABLED 1122 S: abcd OK CAPABILITY completed 1123 C: efgh STARTTLS 1124 S: efgh OK STARTLS completed 1125 1126 C: ijkl CAPABILITY 1127 S: * CAPABILITY IMAP4rev2 AUTH=GSSAPI AUTH=PLAIN 1128 S: ijkl OK CAPABILITY completed 1130 6.1.2. NOOP Command 1132 Arguments: none 1134 Responses: no specific responses for this command (but see below) 1136 Result: OK - noop completed 1137 BAD - command unknown or arguments invalid 1139 The NOOP command always succeeds. It does nothing. 1141 Since any command can return a status update as untagged data, the 1142 NOOP command can be used as a periodic poll for new messages or 1143 message status updates during a period of inactivity (this is the 1144 preferred method to do this). The NOOP command can also be used to 1145 reset any inactivity autologout timer on the server. 1147 Example: C: a002 NOOP 1148 S: a002 OK NOOP completed 1149 . . . 1150 C: a047 NOOP 1151 S: * 22 EXPUNGE 1152 S: * 23 EXISTS 1153 S: * 3 RECENT 1154 S: * 14 FETCH (FLAGS (\Seen \Deleted)) 1155 S: a047 OK NOOP completed 1157 6.1.3. LOGOUT Command 1159 Arguments: none 1161 Responses: REQUIRED untagged response: BYE 1163 Result: OK - logout completed 1164 BAD - command unknown or arguments invalid 1166 The LOGOUT command informs the server that the client is done with 1167 the connection. The server MUST send a BYE untagged response before 1168 the (tagged) OK response, and then close the network connection. 1170 Example: C: A023 LOGOUT 1171 S: * BYE IMAP4rev2 Server logging out 1172 S: A023 OK LOGOUT completed 1173 (Server and client then close the connection) 1175 6.2. Client Commands - Not Authenticated State 1177 In the not authenticated state, the AUTHENTICATE or LOGIN command 1178 establishes authentication and enters the authenticated state. The 1179 AUTHENTICATE command provides a general mechanism for a variety of 1180 authentication techniques, privacy protection, and integrity 1181 checking; whereas the LOGIN command uses a traditional user name and 1182 plaintext password pair and has no means of establishing privacy 1183 protection or integrity checking. 1185 The STARTTLS command is an alternate form of establishing session 1186 privacy protection and integrity checking, but does not by itself 1187 establish authentication or enter the authenticated state. 1189 Server implementations MAY allow access to certain mailboxes without 1190 establishing authentication. This can be done by means of the 1191 ANONYMOUS [SASL] authenticator described in [ANONYMOUS]. An older 1192 convention is a LOGIN command using the userid "anonymous"; in this 1193 case, a password is required although the server may choose to accept 1194 any password. The restrictions placed on anonymous users are 1195 implementation-dependent. 1197 Once authenticated (including as anonymous), it is not possible to 1198 re-enter not authenticated state. 1200 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1201 the following commands are valid in the not authenticated state: 1202 STARTTLS, AUTHENTICATE and LOGIN. See the Security Considerations 1203 section for important information about these commands. 1205 6.2.1. STARTTLS Command 1207 Arguments: none 1209 Responses: no specific response for this command 1211 Result: OK - starttls completed, begin TLS negotiation 1212 BAD - command unknown or arguments invalid 1214 A [TLS] negotiation begins immediately after the CRLF at the end of 1215 the tagged OK response from the server. Once a client issues a 1216 STARTTLS command, it MUST NOT issue further commands until a server 1217 response is seen and the [TLS] negotiation is complete. 1219 The server remains in the non-authenticated state, even if client 1220 credentials are supplied during the [TLS] negotiation. This does not 1221 preclude an authentication mechanism such as EXTERNAL (defined in 1223 [SASL]) from using client identity determined by the [TLS] 1224 negotiation. 1226 Once [TLS] has been started, the client MUST discard cached 1227 information about server capabilities and SHOULD re-issue the 1228 CAPABILITY command. This is necessary to protect against man-in- 1229 the-middle attacks which alter the capabilities list prior to 1230 STARTTLS. The server MAY advertise different capabilities, and in 1231 particular SHOULD NOT advertise the STARTTLS capability, after a 1232 successful STARTTLS command. 1234 Example: C: a001 CAPABILITY 1235 S: * CAPABILITY IMAP4rev2 STARTTLS LOGINDISABLED 1236 S: a001 OK CAPABILITY completed 1237 C: a002 STARTTLS 1238 S: a002 OK Begin TLS negotiation now 1239 1240 C: a003 CAPABILITY 1241 S: * CAPABILITY IMAP4rev2 AUTH=PLAIN 1242 S: a003 OK CAPABILITY completed 1243 C: a004 LOGIN joe password 1244 S: a004 OK LOGIN completed 1246 6.2.2. AUTHENTICATE Command 1248 Arguments: SASL authentication mechanism name 1249 OPTIONAL initial response 1251 Responses: continuation data can be requested 1253 Result: OK - authenticate completed, now in authenticated state 1254 NO - authenticate failure: unsupported authentication 1255 mechanism, credentials rejected 1256 BAD - command unknown or arguments invalid, 1257 authentication exchange cancelled 1259 The AUTHENTICATE command indicates a [SASL] authentication mechanism 1260 to the server. If the server supports the requested authentication 1261 mechanism, it performs an authentication protocol exchange to 1262 authenticate and identify the client. It MAY also negotiate an 1263 OPTIONAL security layer for subsequent protocol interactions. If the 1264 requested authentication mechanism is not supported, the server 1265 SHOULD reject the AUTHENTICATE command by sending a tagged NO 1266 response. 1268 The AUTHENTICATE command supports the optional "initial response" 1269 feature defined in Section 5.1 of [SASL]. The client doesn't need to 1270 use it. If a SASL mechanism supports "initial response", but it is 1271 not specified by the client, the server handles this as specified in 1272 Section 3 of [SASL]. 1274 The service name specified by this protocol's profile of [SASL] is 1275 "imap". 1277 The authentication protocol exchange consists of a series of server 1278 challenges and client responses that are specific to the 1279 authentication mechanism. A server challenge consists of a command 1280 continuation request response with the "+" token followed by a BASE64 1281 encoded string. The client response consists of a single line 1282 consisting of a BASE64 encoded string. If the client wishes to 1283 cancel an authentication exchange, it issues a line consisting of a 1284 single "*". If the server receives such a response, or if it 1285 receives an invalid BASE64 string (e.g. characters outside the 1286 BASE64 alphabet, or non-terminal "="), it MUST reject the 1287 AUTHENTICATE command by sending a tagged BAD response. 1289 As with any other client response, this initial response MUST be 1290 encoded as BASE64 (see Section 4 of [RFC4648]). It also MUST be 1291 transmitted outside of a quoted string or literal. To send a zero- 1292 length initial response, the client MUST send a single pad character 1293 ("="). This indicates that the response is present, but is a zero- 1294 length string. 1296 When decoding the BASE64 data in the initial response, decoding 1297 errors MUST be treated as in any normal SASL client response, i.e. 1298 with a tagged BAD response. In particular, the server should check 1299 for any characters not explicitly allowed by the BASE64 alphabet, as 1300 well as any sequence of BASE64 characters that contains the pad 1301 character ('=') anywhere other than the end of the string (e.g., 1302 "=AAA" and "AAA=BBB" are not allowed). 1304 If the client uses an initial response with a SASL mechanism that 1305 does not support an initial response, the server MUST reject the 1306 command with a tagged BAD response. 1308 If a security layer is negotiated through the [SASL] authentication 1309 exchange, it takes effect immediately following the CRLF that 1310 concludes the authentication exchange for the client, and the CRLF of 1311 the tagged OK response for the server. 1313 While client and server implementations MUST implement the 1314 AUTHENTICATE command itself, it is not required to implement any 1315 authentication mechanisms other than the PLAIN mechanism described in 1316 [PLAIN]. Also, an authentication mechanism is not required to 1317 support any security layers. 1319 Note: a server implementation MUST implement a configuration in 1320 which it does NOT permit any plaintext password mechanisms, unless 1321 either the STARTTLS command has been negotiated or some other 1322 mechanism that protects the session from password snooping has 1323 been provided. Server sites SHOULD NOT use any configuration 1324 which permits a plaintext password mechanism without such a 1325 protection mechanism against password snooping. Client and server 1326 implementations SHOULD implement additional [SASL] mechanisms that 1327 do not use plaintext passwords, such the GSSAPI mechanism 1328 described in [SASL] and/or the [DIGEST-MD5] mechanism. 1330 Servers and clients can support multiple authentication mechanisms. 1331 The server SHOULD list its supported authentication mechanisms in the 1332 response to the CAPABILITY command so that the client knows which 1333 authentication mechanisms to use. 1335 A server MAY include a CAPABILITY response code in the tagged OK 1336 response of a successful AUTHENTICATE command in order to send 1337 capabilities automatically. It is unnecessary for a client to send a 1338 separate CAPABILITY command if it recognizes these automatic 1339 capabilities. This should only be done if a security layer was not 1340 negotiated by the AUTHENTICATE command, because the tagged OK 1341 response as part of an AUTHENTICATE command is not protected by 1342 encryption/integrity checking. [SASL] requires the client to re- 1343 issue a CAPABILITY command in this case. The server MAY advertise 1344 different capabilities after a successful AUTHENTICATE command. 1346 If an AUTHENTICATE command fails with a NO response, the client MAY 1347 try another authentication mechanism by issuing another AUTHENTICATE 1348 command. It MAY also attempt to authenticate by using the LOGIN 1349 command (see Section 6.2.3 for more detail). In other words, the 1350 client MAY request authentication types in decreasing order of 1351 preference, with the LOGIN command as a last resort. 1353 The authorization identity passed from the client to the server 1354 during the authentication exchange is interpreted by the server as 1355 the user name whose privileges the client is requesting. 1357 Example: S: * OK IMAP4rev2 Server 1358 C: A001 AUTHENTICATE GSSAPI 1359 S: + 1360 C: YIIB+wYJKoZIhvcSAQICAQBuggHqMIIB5qADAgEFoQMCAQ6iBw 1361 MFACAAAACjggEmYYIBIjCCAR6gAwIBBaESGxB1Lndhc2hpbmd0 1362 b24uZWR1oi0wK6ADAgEDoSQwIhsEaW1hcBsac2hpdmFtcy5jYW 1363 Mud2FzaGluZ3Rvbi5lZHWjgdMwgdCgAwIBAaEDAgEDooHDBIHA 1364 cS1GSa5b+fXnPZNmXB9SjL8Ollj2SKyb+3S0iXMljen/jNkpJX 1365 AleKTz6BQPzj8duz8EtoOuNfKgweViyn/9B9bccy1uuAE2HI0y 1366 C/PHXNNU9ZrBziJ8Lm0tTNc98kUpjXnHZhsMcz5Mx2GR6dGknb 1367 I0iaGcRerMUsWOuBmKKKRmVMMdR9T3EZdpqsBd7jZCNMWotjhi 1368 vd5zovQlFqQ2Wjc2+y46vKP/iXxWIuQJuDiisyXF0Y8+5GTpAL 1369 pHDc1/pIGmMIGjoAMCAQGigZsEgZg2on5mSuxoDHEA1w9bcW9n 1370 FdFxDKpdrQhVGVRDIzcCMCTzvUboqb5KjY1NJKJsfjRQiBYBdE 1371 NKfzK+g5DlV8nrw81uOcP8NOQCLR5XkoMHC0Dr/80ziQzbNqhx 1372 O6652Npft0LQwJvenwDI13YxpwOdMXzkWZN/XrEqOWp6GCgXTB 1373 vCyLWLlWnbaUkZdEYbKHBPjd8t/1x5Yg== 1374 S: + YGgGCSqGSIb3EgECAgIAb1kwV6ADAgEFoQMCAQ+iSzBJoAMC 1375 AQGiQgRAtHTEuOP2BXb9sBYFR4SJlDZxmg39IxmRBOhXRKdDA0 1376 uHTCOT9Bq3OsUTXUlk0CsFLoa8j+gvGDlgHuqzWHPSQg== 1377 C: 1378 S: + YDMGCSqGSIb3EgECAgIBAAD/////6jcyG4GE3KkTzBeBiVHe 1379 ceP2CWY0SR0fAQAgAAQEBAQ= 1380 C: YDMGCSqGSIb3EgECAgIBAAD/////3LQBHXTpFfZgrejpLlLImP 1381 wkhbfa2QteAQAgAG1yYwE= 1382 S: A001 OK GSSAPI authentication successful 1384 Note: The line breaks within server challenges and client responses 1385 are for editorial clarity and are not in real authenticators. 1387 6.2.3. LOGIN Command 1389 Arguments: user name 1390 password 1392 Responses: no specific responses for this command 1394 Result: OK - login completed, now in authenticated state 1395 NO - login failure: user name or password rejected 1396 BAD - command unknown or arguments invalid 1398 The LOGIN command identifies the client to the server and carries the 1399 plaintext password authenticating this user. 1401 A server MAY include a CAPABILITY response code in the tagged OK 1402 response to a successful LOGIN command in order to send capabilities 1403 automatically. It is unnecessary for a client to send a separate 1404 CAPABILITY command if it recognizes these automatic capabilities. 1406 Example: C: a001 LOGIN SMITH SESAME 1407 S: a001 OK LOGIN completed 1409 Note: Use of the LOGIN command over an insecure network (such as the 1410 Internet) is a security risk, because anyone monitoring network 1411 traffic can obtain plaintext passwords. The LOGIN command SHOULD NOT 1412 be used except as a last resort, and it is recommended that client 1413 implementations have a means to disable any automatic use of the 1414 LOGIN command. 1416 Unless either the client is accessing IMAP service on IMAPS port 1417 [RFC8314], the STARTTLS command has been negotiated or some other 1418 mechanism that protects the session from password snooping has been 1419 provided, a server implementation MUST implement a configuration in 1420 which it advertises the LOGINDISABLED capability and does NOT permit 1421 the LOGIN command. Server sites SHOULD NOT use any configuration 1422 which permits the LOGIN command without such a protection mechanism 1423 against password snooping. A client implementation MUST NOT send a 1424 LOGIN command if the LOGINDISABLED capability is advertised. 1426 6.3. Client Commands - Authenticated State 1428 In the authenticated state, commands that manipulate mailboxes as 1429 atomic entities are permitted. Of these commands, the SELECT and 1430 EXAMINE commands will select a mailbox for access and enter the 1431 selected state. 1433 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1434 the following commands are valid in the authenticated state: ENABLE, 1435 SELECT, EXAMINE, NAMESPACE, CREATE, DELETE, RENAME, SUBSCRIBE, 1436 UNSUBSCRIBE, LIST, LSUB, STATUS, APPEND and IDLE. 1438 6.3.1. ENABLE Command 1440 Arguments: capability names 1442 Responses: no specific responses for this command 1444 Result: OK - Relevant capabilities enabled 1445 BAD - No arguments, or syntax error in an argument 1447 Several IMAP extensions allow the server to return unsolicited 1448 responses specific to these extensions in certain circumstances. 1449 However, servers cannot send those unsolicited responses (with the 1450 exception of response codes included in tagged or untagged OK/NO/BAD 1451 responses, which can always be sent) until they know that the clients 1452 support such extensions and thus won't choke on the extension 1453 response data. 1455 The ENABLE command provides an explicit indication from the client 1456 that it supports particular extensions. 1458 The ENABLE command takes a list of capability names, and requests the 1459 server to enable the named extensions. Once enabled using ENABLE, 1460 each extension remains active until the IMAP connection is closed. 1461 For each argument, the server does the following: 1463 o If the argument is not an extension known to the server, the 1464 server MUST ignore the argument. 1466 o If the argument is an extension known to the server, and it is not 1467 specifically permitted to be enabled using ENABLE, the server MUST 1468 ignore the argument. (Note that knowing about an extension 1469 doesn't necessarily imply supporting that extension.) 1471 o If the argument is an extension that is supported by the server 1472 and that needs to be enabled, the server MUST enable the extension 1473 for the duration of the connection. Note that once an extension 1474 is enabled, there is no way to disable it. 1476 If the ENABLE command is successful, the server MUST send an untagged 1477 ENABLED response Section 7.2.1. 1479 Clients SHOULD only include extensions that need to be enabled by the 1480 server. For example, a client can enable IMAP4rev2 specific 1481 behaviour when both IMAP4rev1 and IMAP4rev2 are advertised in the 1482 CAPABILITY response. Future RFCs may add to this list. 1484 The ENABLE command is only valid in the authenticated state, before 1485 any mailbox is selected. Clients MUST NOT issue ENABLE once they 1486 SELECT/EXAMINE a mailbox; however, server implementations don't have 1487 to check that no mailbox is selected or was previously selected 1488 during the duration of a connection. 1490 The ENABLE command can be issued multiple times in a session. It is 1491 additive; i.e., "ENABLE a b", followed by "ENABLE c" is the same as a 1492 single command "ENABLE a b c". When multiple ENABLE commands are 1493 issued, each corresponding ENABLED response SHOULD only contain 1494 extensions enabled by the corresponding ENABLE command. 1496 There are no limitations on pipelining ENABLE. For example, it is 1497 possible to send ENABLE and then immediately SELECT, or a LOGIN 1498 immediately followed by ENABLE. 1500 The server MUST NOT change the CAPABILITY list as a result of 1501 executing ENABLE; i.e., a CAPABILITY command issued right after an 1502 ENABLE command MUST list the same capabilities as a CAPABILITY 1503 command issued before the ENABLE command. This is demonstrated in 1504 the following example: 1506 C: t1 CAPABILITY 1507 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1508 S: t1 OK foo 1509 C: t2 ENABLE CONDSTORE X-GOOD-IDEA 1510 S: * ENABLED X-GOOD-IDEA 1511 S: t2 OK foo 1512 C: t3 CAPABILITY 1513 S: * CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE X-GOOD-IDEA 1514 S: t3 OK foo again 1516 In the following example, the client enables CONDSTORE: 1518 C: a1 ENABLE CONDSTORE 1519 S: * ENABLED CONDSTORE 1520 S: a1 OK Conditional Store enabled 1522 6.3.1.1. Note to Designers of Extensions That May Use the ENABLE 1523 Command 1525 Designers of IMAP extensions are discouraged from creating extensions 1526 that require ENABLE unless there is no good alternative design. 1527 Specifically, extensions that cause potentially incompatible behavior 1528 changes to deployed server responses (and thus benefit from ENABLE) 1529 have a higher complexity cost than extensions that do not. 1531 6.3.2. SELECT Command 1533 Arguments: mailbox name 1535 Responses: REQUIRED untagged responses: FLAGS, EXISTS, RECENT 1536 REQUIRED OK untagged responses: UNSEEN (if any unseen 1537 exist), PERMANENTFLAGS, 1538 UIDNEXT, UIDVALIDITY 1540 Result: OK - select completed, now in selected state 1541 NO - select failure, now in authenticated state: no 1542 such mailbox, can't access mailbox 1543 BAD - command unknown or arguments invalid 1545 The SELECT command selects a mailbox so that messages in the mailbox 1546 can be accessed. Before returning an OK to the client, the server 1547 MUST send the following untagged data to the client. Note that 1548 earlier versions of this protocol only required the FLAGS, EXISTS, 1549 and RECENT untagged data; consequently, client implementations SHOULD 1550 implement default behavior for missing data as discussed with the 1551 individual item. 1553 FLAGS Defined flags in the mailbox. See the description of the 1554 FLAGS response for more detail. 1556 EXISTS The number of messages in the mailbox. See the 1557 description of the EXISTS response for more detail. 1559 RECENT The number of messages with the \Recent flag set. See 1560 the description of the RECENT response for more detail. 1562 OK [UNSEEN ] The message sequence number of the first unseen 1563 message in the mailbox. If there are any unseen messages in the 1564 mailbox, an UNSEEN response MUST be sent, if not it MUST be 1565 omitted. If this is missing, the client can not make any 1566 assumptions about the first unseen message in the mailbox, and 1567 needs to issue a SEARCH command if it wants to find it. 1569 OK [PERMANENTFLAGS ()] A list of message flags that 1570 the client can change permanently. If this is missing, the client 1571 should assume that all flags can be changed permanently. 1573 OK [UIDNEXT ] The next unique identifier value. Refer to 1574 Section 2.3.1.1 for more information. If this is missing, the 1575 client can not make any assumptions about the next unique 1576 identifier value. 1578 OK [UIDVALIDITY ] The unique identifier validity value. Refer to 1579 Section 2.3.1.1 for more information. If this is missing, the 1580 server does not support unique identifiers. 1582 Only one mailbox can be selected at a time in a connection; 1583 simultaneous access to multiple mailboxes requires multiple 1584 connections. The SELECT command automatically deselects any 1585 currently selected mailbox before attempting the new selection. 1586 Consequently, if a mailbox is selected and a SELECT command that 1587 fails is attempted, no mailbox is selected. When deselecting a 1588 selected mailbox, the server MUST return an untagged OK response with 1589 the "[CLOSED]" response code when the currently selected mailbox is 1590 closed. 1592 If the client is permitted to modify the mailbox, the server SHOULD 1593 prefix the text of the tagged OK response with the "[READ-WRITE]" 1594 response code. 1596 If the client is not permitted to modify the mailbox but is permitted 1597 read access, the mailbox is selected as read-only, and the server 1598 MUST prefix the text of the tagged OK response to SELECT with the 1599 "[READ-ONLY]" response code. Read-only access through SELECT differs 1600 from the EXAMINE command in that certain read-only mailboxes MAY 1601 permit the change of permanent state on a per-user (as opposed to 1602 global) basis. Netnews messages marked in a server-based .newsrc 1603 file are an example of such per-user permanent state that can be 1604 modified with read-only mailboxes. 1606 Example: C: A142 SELECT INBOX 1607 S: * 172 EXISTS 1608 S: * 1 RECENT 1609 S: * OK [UNSEEN 12] Message 12 is first unseen 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 (\Deleted \Seen \*)] Limited 1614 S: A142 OK [READ-WRITE] SELECT completed 1616 6.3.3. EXAMINE Command 1618 Arguments: mailbox name 1620 Responses: REQUIRED untagged responses: FLAGS, EXISTS, RECENT 1621 REQUIRED OK untagged responses: UNSEEN, PERMANENTFLAGS, 1622 UIDNEXT, UIDVALIDITY 1624 Result: OK - examine completed, now in selected state 1625 NO - examine failure, now in authenticated state: no 1626 such mailbox, can't access mailbox BAD - command unknown 1627 or arguments invalid 1629 The EXAMINE command is identical to SELECT and returns the same 1630 output; however, the selected mailbox is identified as read-only. No 1631 changes to the permanent state of the mailbox, including per-user 1632 state, are permitted; in particular, EXAMINE MUST NOT cause messages 1633 to lose the \Recent flag. 1635 The text of the tagged OK response to the EXAMINE command MUST begin 1636 with the "[READ-ONLY]" response code. 1638 Example: C: A932 EXAMINE blurdybloop 1639 S: * 17 EXISTS 1640 S: * 2 RECENT 1641 S: * OK [UNSEEN 8] Message 8 is first unseen 1642 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1643 S: * OK [UIDNEXT 4392] Predicted next UID 1644 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1645 S: * OK [PERMANENTFLAGS ()] No permanent flags permitted 1646 S: A932 OK [READ-ONLY] EXAMINE completed 1648 6.3.4. CREATE Command 1650 Arguments: mailbox name 1652 Responses: no specific responses for this command 1654 Result: OK - create completed 1655 NO - create failure: can't create mailbox with that name 1656 BAD - command unknown or arguments invalid 1658 The CREATE command creates a mailbox with the given name. An OK 1659 response is returned only if a new mailbox with that name has been 1660 created. It is an error to attempt to create INBOX or a mailbox with 1661 a name that refers to an extant mailbox. Any error in creation will 1662 return a tagged NO response. If a client attempts to create a UTF-8 1663 mailbox name that is not a valid Net-Unicode name, the server MUST 1664 reject the creation or convert the name to Net-Unicode prior to 1665 creating the mailbox. 1667 If the mailbox name is suffixed with the server's hierarchy separator 1668 character (as returned from the server by a LIST command), this is a 1669 declaration that the client intends to create mailbox names under 1670 this name in the hierarchy. Server implementations that do not 1671 require this declaration MUST ignore the declaration. In any case, 1672 the name created is without the trailing hierarchy delimiter. 1674 If the server's hierarchy separator character appears elsewhere in 1675 the name, the server SHOULD create any superior hierarchical names 1676 that are needed for the CREATE command to be successfully completed. 1677 In other words, an attempt to create "foo/bar/zap" on a server in 1678 which "/" is the hierarchy separator character SHOULD create foo/ and 1679 foo/bar/ if they do not already exist. 1681 If a new mailbox is created with the same name as a mailbox which was 1682 deleted, its unique identifiers MUST be greater than any unique 1683 identifiers used in the previous incarnation of the mailbox UNLESS 1684 the new incarnation has a different unique identifier validity value. 1685 See the description of the UID command for more detail. 1687 Example: C: A003 CREATE owatagusiam/ 1688 S: A003 OK CREATE completed 1689 C: A004 CREATE owatagusiam/blurdybloop 1690 S: A004 OK CREATE completed 1692 Note: The interpretation of this example depends on whether "/" 1693 was returned as the hierarchy separator from LIST. If "/" is the 1694 hierarchy separator, a new level of hierarchy named "owatagusiam" 1695 with a member called "blurdybloop" is created. Otherwise, two 1696 mailboxes at the same hierarchy level are created. 1698 6.3.5. DELETE Command 1700 Arguments: mailbox name 1702 Responses: no specific responses for this command 1704 Result: OK - delete completed 1705 NO - delete failure: can't delete mailbox with that name 1706 BAD - command unknown or arguments invalid 1708 The DELETE command permanently removes the mailbox with the given 1709 name. A tagged OK response is returned only if the mailbox has been 1710 deleted. It is an error to attempt to delete INBOX or a mailbox name 1711 that does not exist. 1713 The DELETE command MUST NOT remove inferior hierarchical names. For 1714 example, if a mailbox "foo" has an inferior "foo.bar" (assuming "." 1715 is the hierarchy delimiter character), removing "foo" MUST NOT remove 1716 "foo.bar". It is an error to attempt to delete a name that has 1717 inferior hierarchical names and also has the \Noselect mailbox name 1718 attribute (see the description of the LIST response for more 1719 details). 1721 It is permitted to delete a name that has inferior hierarchical names 1722 and does not have the \Noselect mailbox name attribute. If the 1723 server implementation does not permit deleting the name while 1724 inferior hierarchical names exists the \Noselect mailbox name 1725 attribute is set for that name. In any case, all messages in that 1726 mailbox are removed by the DELETE command. 1728 The value of the highest-used unique identifier of the deleted 1729 mailbox MUST be preserved so that a new mailbox created with the same 1730 name will not reuse the identifiers of the former incarnation, UNLESS 1731 the new incarnation has a different unique identifier validity value. 1732 See the description of the UID command for more detail. 1734 Examples: C: A682 LIST "" * 1735 S: * LIST () "/" blurdybloop 1736 S: * LIST (\Noselect) "/" foo 1737 S: * LIST () "/" foo/bar 1738 S: A682 OK LIST completed 1739 C: A683 DELETE blurdybloop 1740 S: A683 OK DELETE completed 1741 C: A684 DELETE foo 1742 S: A684 NO Name "foo" has inferior hierarchical names 1743 C: A685 DELETE foo/bar 1744 S: A685 OK DELETE Completed 1745 C: A686 LIST "" * 1746 S: * LIST (\Noselect) "/" foo 1747 S: A686 OK LIST completed 1748 C: A687 DELETE foo 1749 S: A687 OK DELETE Completed 1750 C: A82 LIST "" * 1751 S: * LIST () "." blurdybloop 1752 S: * LIST () "." foo 1753 S: * LIST () "." foo.bar 1754 S: A82 OK LIST completed 1755 C: A83 DELETE blurdybloop 1756 S: A83 OK DELETE completed 1757 C: A84 DELETE foo 1758 S: A84 OK DELETE Completed 1759 C: A85 LIST "" * 1760 S: * LIST () "." foo.bar 1761 S: A85 OK LIST completed 1762 C: A86 LIST "" % 1763 S: * LIST (\Noselect) "." foo 1764 S: A86 OK LIST completed 1766 6.3.6. RENAME Command 1768 Arguments: existing mailbox name 1769 new mailbox name 1771 Responses: no specific responses for this command 1773 Result: OK - rename completed 1774 NO - rename failure: can't rename mailbox with that name, 1775 can't rename to mailbox with that name 1776 BAD - command unknown or arguments invalid 1778 The RENAME command changes the name of a mailbox. A tagged OK 1779 response is returned only if the mailbox has been renamed. It is an 1780 error to attempt to rename from a mailbox name that does not exist or 1781 to a mailbox name that already exists. Any error in renaming will 1782 return a tagged NO response. 1784 If the name has inferior hierarchical names, then the inferior 1785 hierarchical names MUST also be renamed. For example, a rename of 1786 "foo" to "zap" will rename "foo/bar" (assuming "/" is the hierarchy 1787 delimiter character) to "zap/bar". 1789 If the server's hierarchy separator character appears in the name, 1790 the server SHOULD create any superior hierarchical names that are 1791 needed for the RENAME command to complete successfully. In other 1792 words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a 1793 server in which "/" is the hierarchy separator character SHOULD 1794 create baz/ and baz/rag/ if they do not already exist. 1796 The value of the highest-used unique identifier of the old mailbox 1797 name MUST be preserved so that a new mailbox created with the same 1798 name will not reuse the identifiers of the former incarnation, UNLESS 1799 the new incarnation has a different unique identifier validity value. 1800 See the description of the UID command for more detail. 1802 Renaming INBOX is permitted, and has special behavior. It moves all 1803 messages in INBOX to a new mailbox with the given name, leaving INBOX 1804 empty. If the server implementation supports inferior hierarchical 1805 names of INBOX, these are unaffected by a rename of INBOX. 1807 Examples: C: A682 LIST "" * 1808 S: * LIST () "/" blurdybloop 1809 S: * LIST (\Noselect) "/" foo 1810 S: * LIST () "/" foo/bar 1811 S: A682 OK LIST completed 1812 C: A683 RENAME blurdybloop sarasoop 1813 S: A683 OK RENAME completed 1814 C: A684 RENAME foo zowie 1815 S: A684 OK RENAME Completed 1816 C: A685 LIST "" * 1817 S: * LIST () "/" sarasoop 1818 S: * LIST (\Noselect) "/" zowie 1819 S: * LIST () "/" zowie/bar 1820 S: A685 OK LIST completed 1822 C: Z432 LIST "" * 1823 S: * LIST () "." INBOX 1824 S: * LIST () "." INBOX.bar 1825 S: Z432 OK LIST completed 1826 C: Z433 RENAME INBOX old-mail 1827 S: Z433 OK RENAME completed 1828 C: Z434 LIST "" * 1829 S: * LIST () "." INBOX 1830 S: * LIST () "." INBOX.bar 1831 S: * LIST () "." old-mail 1832 S: Z434 OK LIST completed 1834 6.3.7. SUBSCRIBE Command 1836 Arguments: mailbox 1838 Responses: no specific responses for this command 1840 Result: OK - subscribe completed 1841 NO - subscribe failure: can't subscribe to that name 1842 BAD - command unknown or arguments invalid 1844 The SUBSCRIBE command adds the specified mailbox name to the server's 1845 set of "active" or "subscribed" mailboxes as returned by the LSUB 1846 command. This command returns a tagged OK response only if the 1847 subscription is successful. 1849 A server MAY validate the mailbox argument to SUBSCRIBE to verify 1850 that it exists. However, it MUST NOT unilaterally remove an existing 1851 mailbox name from the subscription list even if a mailbox by that 1852 name no longer exists. 1854 Note: This requirement is because a server site can choose to 1855 routinely remove a mailbox with a well-known name (e.g., "system- 1856 alerts") after its contents expire, with the intention of 1857 recreating it when new contents are appropriate. 1859 Example: C: A002 SUBSCRIBE #news.comp.mail.mime 1860 S: A002 OK SUBSCRIBE completed 1862 6.3.8. UNSUBSCRIBE Command 1864 Arguments: mailbox name 1866 Responses: no specific responses for this command 1868 Result: OK - unsubscribe completed 1869 NO - unsubscribe failure: can't unsubscribe that name 1870 BAD - command unknown or arguments invalid 1872 The UNSUBSCRIBE command removes the specified mailbox name from the 1873 server's set of "active" or "subscribed" mailboxes as returned by the 1874 LSUB command. This command returns a tagged OK response only if the 1875 unsubscription is successful. 1877 Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime 1878 S: A002 OK UNSUBSCRIBE completed 1880 6.3.9. LIST Command 1882 Arguments: reference name 1883 mailbox name with possible wildcards 1885 Responses: untagged responses: LIST 1887 Result: OK - list completed 1888 NO - list failure: can't list that reference or name 1889 BAD - command unknown or arguments invalid 1891 The LIST command returns a subset of names from the complete set of 1892 all names available to the client. Zero or more untagged LIST 1893 replies are returned, containing the name attributes, hierarchy 1894 delimiter, and name; see the description of the LIST reply for more 1895 detail. 1897 The LIST command SHOULD return its data quickly, without undue delay. 1898 For example, it SHOULD NOT go to excess trouble to calculate the 1899 \Marked or \Unmarked status or perform other processing; if each name 1900 requires 1 second of processing, then a list of 1200 names would take 1901 20 minutes! 1902 An empty ("" string) reference name argument indicates that the 1903 mailbox name is interpreted as by SELECT. The returned mailbox names 1904 MUST match the supplied mailbox name pattern. A non-empty reference 1905 name argument is the name of a mailbox or a level of mailbox 1906 hierarchy, and indicates the context in which the mailbox name is 1907 interpreted. 1909 An empty ("" string) mailbox name argument is a special request to 1910 return the hierarchy delimiter and the root name of the name given in 1911 the reference. The value returned as the root MAY be the empty 1912 string if the reference is non-rooted or is an empty string. In all 1913 cases, a hierarchy delimiter (or NIL if there is no hierarchy) is 1914 returned. This permits a client to get the hierarchy delimiter (or 1915 find out that the mailbox names are flat) even when no mailboxes by 1916 that name currently exist. 1918 The reference and mailbox name arguments are interpreted into a 1919 canonical form that represents an unambiguous left-to-right 1920 hierarchy. The returned mailbox names will be in the interpreted 1921 form. 1923 Note: The interpretation of the reference argument is 1924 implementation-defined. It depends upon whether the server 1925 implementation has a concept of the "current working directory" 1926 and leading "break out characters", which override the current 1927 working directory. 1929 For example, on a server which exports a UNIX or NT filesystem, 1930 the reference argument contains the current working directory, and 1931 the mailbox name argument would contain the name as interpreted in 1932 the current working directory. 1934 If a server implementation has no concept of break out characters, 1935 the canonical form is normally the reference name appended with 1936 the mailbox name. Note that if the server implements the 1937 namespace convention (Section 5.1.2.1), "#" is a break out 1938 character and must be treated as such. 1940 If the reference argument is not a level of mailbox hierarchy 1941 (that is, it is a \NoInferiors name), and/or the reference 1942 argument does not end with the hierarchy delimiter, it is 1943 implementation-dependent how this is interpreted. For example, a 1944 reference of "foo/bar" and mailbox name of "rag/baz" could be 1945 interpreted as "foo/bar/rag/baz", "foo/barrag/baz", or "foo/rag/ 1946 baz". A client SHOULD NOT use such a reference argument except at 1947 the explicit request of the user. A hierarchical browser MUST NOT 1948 make any assumptions about server interpretation of the reference 1949 unless the reference is a level of mailbox hierarchy AND ends with 1950 the hierarchy delimiter. 1952 Any part of the reference argument that is included in the 1953 interpreted form SHOULD prefix the interpreted form. It SHOULD also 1954 be in the same form as the reference name argument. This rule 1955 permits the client to determine if the returned mailbox name is in 1956 the context of the reference argument, or if something about the 1957 mailbox argument overrode the reference argument. Without this rule, 1958 the client would have to have knowledge of the server's naming 1959 semantics including what characters are "breakouts" that override a 1960 naming context. 1962 For example, here are some examples of how references 1963 and mailbox names might be interpreted on a UNIX-based 1964 server: 1966 Reference Mailbox Name Interpretation 1967 ------------ ------------ -------------- 1968 ~smith/Mail/ foo.* ~smith/Mail/foo.* 1969 archive/ % archive/% 1970 #news. comp.mail.* #news.comp.mail.* 1971 ~smith/Mail/ /usr/doc/foo /usr/doc/foo 1972 archive/ ~fred/Mail/* ~fred/Mail/* 1974 The first three examples demonstrate interpretations in 1975 the context of the reference argument. Note that 1976 "~smith/Mail" SHOULD NOT be transformed into something 1977 like "/u2/users/smith/Mail", or it would be impossible 1978 for the client to determine that the interpretation was 1979 in the context of the reference. 1981 The character "*" is a wildcard, and matches zero or more characters 1982 at this position. The character "%" is similar to "*", but it does 1983 not match a hierarchy delimiter. If the "%" wildcard is the last 1984 character of a mailbox name argument, matching levels of hierarchy 1985 are also returned. If these levels of hierarchy are not also 1986 selectable mailboxes, they are returned with the \Noselect mailbox 1987 name attribute (see the description of the LIST response for more 1988 details). 1990 Server implementations are permitted to "hide" otherwise accessible 1991 mailboxes from the wildcard characters, by preventing certain 1992 characters or names from matching a wildcard in certain situations. 1993 For example, a UNIX-based server might restrict the interpretation of 1994 "*" so that an initial "/" character does not match. 1996 The special name INBOX is included in the output from LIST, if INBOX 1997 is supported by this server for this user and if the uppercase string 1998 "INBOX" matches the interpreted reference and mailbox name arguments 1999 with wildcards as described above. The criteria for omitting INBOX 2000 is whether SELECT INBOX will return failure; it is not relevant 2001 whether the user's real INBOX resides on this or some other server. 2003 Example: C: A101 LIST "" "" 2004 S: * LIST (\Noselect) "/" "" 2005 S: A101 OK LIST Completed 2006 C: A102 LIST #news.comp.mail.misc "" 2007 S: * LIST (\Noselect) "." #news. 2008 S: A102 OK LIST Completed 2009 C: A103 LIST /usr/staff/jones "" 2010 S: * LIST (\Noselect) "/" / 2011 S: A103 OK LIST Completed 2012 C: A202 LIST ~/Mail/ % 2013 S: * LIST (\Noselect) "/" ~/Mail/foo 2014 S: * LIST () "/" ~/Mail/meetings 2015 S: A202 OK LIST completed 2017 6.3.10. LSUB Command 2019 Arguments: reference name 2020 mailbox name with possible wildcards 2022 Responses: untagged responses: LSUB 2024 Result: OK - lsub completed 2025 NO - lsub failure: can't list that reference or name 2026 BAD - command unknown or arguments invalid 2028 The LSUB command returns a subset of names from the set of names that 2029 the user has declared as being "active" or "subscribed". Zero or 2030 more untagged LSUB replies are returned. The arguments to LSUB are 2031 in the same form as those for LIST. 2033 The returned untagged LSUB response MAY contain different mailbox 2034 flags from a LIST untagged response. If this should happen, the 2035 flags in the untagged LIST are considered more authoritative. 2037 A special situation occurs when using LSUB with the % wildcard. 2038 Consider what happens if "foo/bar" (with a hierarchy delimiter of 2039 "/") is subscribed but "foo" is not. A "%" wildcard to LSUB must 2040 return foo, not foo/bar, in the LSUB response, and it MUST be flagged 2041 with the \Noselect attribute. 2043 The server MUST NOT unilaterally remove an existing mailbox name from 2044 the subscription list even if a mailbox by that name no longer 2045 exists. 2047 Example: C: A002 LSUB "#news." "comp.mail.*" 2048 S: * LSUB () "." #news.comp.mail.mime 2049 S: * LSUB () "." #news.comp.mail.misc 2050 S: A002 OK LSUB completed 2051 C: A003 LSUB "#news." "comp.%" 2052 S: * LSUB (\NoSelect) "." #news.comp.mail 2053 S: A003 OK LSUB completed 2055 6.3.11. NAMESPACE Command 2057 Arguments: none 2059 Responses: REQUIRED untagged responses: NAMESPACE 2061 Result: OK - command completed 2062 NO - Can't complete the command 2063 BAD - arguments invalid 2065 The NAMESPACE command causes a single ungagged NAMESPACE response to 2066 be returned. The untagged NAMESPACE response contains the prefix and 2067 hierarchy delimiter to the server's Personal Namespace(s), Other 2068 Users' Namespace(s), and Shared Namespace(s) that the server wishes 2069 to expose. The response will contain a NIL for any namespace class 2070 that is not available. Namespace_Response_Extensions MAY be included 2071 in the response. Namespace_Response_Extensions which are not on the 2072 IETF standards track, MUST be prefixed with an "X-". 2074 Example 1: 2076 In this example a server supports a single personal namespace. No 2077 leading prefix is used on personal mailboxes and "/" is the hierarchy 2078 delimiter. 2080 C: A001 NAMESPACE 2081 S: * NAMESPACE (("" "/")) NIL NIL 2082 S: A001 OK NAMESPACE command completed 2084 Example 2: 2086 A user logged on anonymously to a server. No personal mailboxes are 2087 associated with the anonymous user and the user does not have access 2088 to the Other Users' Namespace. No prefix is required to access 2089 shared mailboxes and the hierarchy delimiter is "." 2090 C: A001 NAMESPACE 2091 S: * NAMESPACE NIL NIL (("" ".")) 2092 S: A001 OK NAMESPACE command completed 2094 Example 3: 2096 A server that contains a Personal Namespace and a single Shared 2097 Namespace. 2099 C: A001 NAMESPACE 2100 S: * NAMESPACE (("" "/")) NIL (("Public Folders/" "/")) 2101 S: A001 OK NAMESPACE command completed 2103 Example 4: 2105 A server that contains a Personal Namespace, Other Users' Namespace 2106 and multiple Shared Namespaces. Note that the hierarchy delimiter 2107 used within each namespace can be different. 2109 C: A001 NAMESPACE 2110 S: * NAMESPACE (("" "/")) (("~" "/")) (("#shared/" "/") 2111 ("#public/" "/")("#ftp/" "/")("#news." ".")) 2112 S: A001 OK NAMESPACE command completed 2114 The prefix string allows a client to do things such as automatically 2115 creating personal mailboxes or LISTing all available mailboxes within 2116 a namespace. 2118 Example 5: 2120 A server that supports only the Personal Namespace, with a leading 2121 prefix of INBOX to personal mailboxes and a hierarchy delimiter of 2122 "." 2124 C: A001 NAMESPACE 2125 S: * NAMESPACE (("INBOX." ".")) NIL NIL 2126 S: A001 OK NAMESPACE command completed 2128 < Automatically create a mailbox to store sent items.> 2130 C: A002 CREATE "INBOX.Sent Mail" 2131 S: A002 OK CREATE command completed 2133 Although typically a server will support only a single Personal 2134 Namespace, and a single Other User's Namespace, circumstances exist 2135 where there MAY be multiples of these, and a client MUST be prepared 2136 for them. If a client is configured such that it is required to 2137 create a certain mailbox, there can be circumstances where it is 2138 unclear which Personal Namespaces it should create the mailbox in. 2139 In these situations a client SHOULD let the user select which 2140 namespaces to create the mailbox in. 2142 Example 6: 2144 In this example, a server supports 2 Personal Namespaces. In 2145 addition to the regular Personal Namespace, the user has an 2146 additional personal namespace to allow access to mailboxes in an MH 2147 format mailstore. 2149 The client is configured to save a copy of all mail sent by the user 2150 into a mailbox called 'Sent Mail'. Furthermore, after a message is 2151 deleted from a mailbox, the client is configured to move that message 2152 to a mailbox called 'Deleted Items'. 2154 Note that this example demonstrates how some extension flags can be 2155 passed to further describe the #mh namespace. 2157 C: A001 NAMESPACE 2158 S: * NAMESPACE (("" "/")("#mh/" "/" "X-PARAM" ("FLAG1" "FLAG2"))) 2159 NIL NIL 2160 S: A001 OK NAMESPACE command completed 2162 < It is desired to keep only one copy of sent mail. It is unclear 2163 which Personal Namespace the client should use to create the 'Sent 2164 Mail' mailbox. The user is prompted to select a namespace and 2165 only one 'Sent Mail' mailbox is created. > 2167 C: A002 CREATE "Sent Mail" 2168 S: A002 OK CREATE command completed 2170 < The client is designed so that it keeps two 'Deleted Items' 2171 mailboxes, one for each namespace. > 2173 C: A003 CREATE "Delete Items" 2174 S: A003 OK CREATE command completed 2176 C: A004 CREATE "#mh/Deleted Items" 2177 S: A004 OK CREATE command completed 2179 The next level of hierarchy following the Other Users' Namespace 2180 prefix SHOULD consist of , where is a user name 2181 as per the LOGIN or AUTHENTICATE command. 2183 A client can construct a LIST command by appending a "%" to the Other 2184 Users' Namespace prefix to discover the Personal Namespaces of other 2185 users that are available to the currently authenticated user. 2187 In response to such a LIST command, a server SHOULD NOT return user 2188 names that have not granted access to their personal mailboxes to the 2189 user in question. 2191 A server MAY return a LIST response containing only the names of 2192 users that have explicitly granted access to the user in question. 2194 Alternatively, a server MAY return NO to such a LIST command, 2195 requiring that a user name be included with the Other Users' 2196 Namespace prefix before listing any other user's mailboxes. 2198 Example 7: 2200 A server that supports providing a list of other user's mailboxes 2201 that are accessible to the currently logged on user. 2203 C: A001 NAMESPACE 2204 S: * NAMESPACE (("" "/")) (("Other Users/" "/")) NIL 2205 S: A001 OK NAMESPACE command completed 2207 C: A002 LIST "" "Other Users/%" 2208 S: * LIST () "/" "Other Users/Mike" 2209 S: * LIST () "/" "Other Users/Karen" 2210 S: * LIST () "/" "Other Users/Matthew" 2211 S: * LIST () "/" "Other Users/Tesa" 2212 S: A002 OK LIST command completed 2214 Example 8: 2216 A server that does not support providing a list of other user's 2217 mailboxes that are accessible to the currently logged on user. The 2218 mailboxes are listable if the client includes the name of the other 2219 user with the Other Users' Namespace prefix. 2221 C: A001 NAMESPACE 2222 S: * NAMESPACE (("" "/")) (("#Users/" "/")) NIL 2223 S: A001 OK NAMESPACE command completed 2225 < In this example, the currently logged on user has access to the 2226 Personal Namespace of user Mike, but the server chose to suppress 2227 this information in the LIST response. However, by appending the 2228 user name Mike (received through user input) to the Other Users' 2229 Namespace prefix, the client is able to get a listing of the 2230 personal mailboxes of user Mike. > 2232 C: A002 LIST "" "#Users/%" 2233 S: A002 NO The requested item could not be found. 2235 C: A003 LIST "" "#Users/Mike/%" 2236 S: * LIST () "/" "#Users/Mike/INBOX" 2237 S: * LIST () "/" "#Users/Mike/Foo" 2238 S: A003 OK LIST command completed. 2240 A prefix string might not contain a hierarchy delimiter, because in 2241 some cases it is not needed as part of the prefix. 2243 Example 9: 2245 A server that allows access to the Other Users' Namespace by 2246 prefixing the others' mailboxes with a '~' followed by , 2247 where is a user name as per the LOGIN or AUTHENTICATE 2248 command. 2250 C: A001 NAMESPACE 2251 S: * NAMESPACE (("" "/")) (("~" "/")) NIL 2252 S: A001 OK NAMESPACE command completed 2254 < List the mailboxes for user mark > 2256 C: A002 LIST "" "~mark/%" 2257 S: * LIST () "/" "~mark/INBOX" 2258 S: * LIST () "/" "~mark/foo" 2259 S: A002 OK LIST command completed 2261 6.3.12. STATUS Command 2263 Arguments: mailbox name 2264 status data item names 2266 Responses: REQUIRED untagged responses: STATUS 2268 Result: OK - status completed 2269 NO - status failure: no status for that name 2270 BAD - command unknown or arguments invalid 2272 The STATUS command requests the status of the indicated mailbox. It 2273 does not change the currently selected mailbox, nor does it affect 2274 the state of any messages in the queried mailbox (in particular, 2275 STATUS MUST NOT cause messages to lose the \Recent flag). 2277 The STATUS command provides an alternative to opening a second 2278 IMAP4rev2 connection and doing an EXAMINE command on a mailbox to 2279 query that mailbox's status without deselecting the current mailbox 2280 in the first IMAP4rev2 connection. 2282 Unlike the LIST command, the STATUS command is not guaranteed to be 2283 fast in its response. Under certain circumstances, it can be quite 2284 slow. In some implementations, the server is obliged to open the 2285 mailbox read-only internally to obtain certain status information. 2286 Also unlike the LIST command, the STATUS command does not accept 2287 wildcards. 2289 Note: The STATUS command is intended to access the status of 2290 mailboxes other than the currently selected mailbox. Because the 2291 STATUS command can cause the mailbox to be opened internally, and 2292 because this information is available by other means on the 2293 selected mailbox, the STATUS command SHOULD NOT be used on the 2294 currently selected mailbox. 2296 The STATUS command MUST NOT be used as a "check for new messages 2297 in the selected mailbox" operation (refer to sections 7, 2298 Section 7.3.1, and Section 7.3.2 for more information about the 2299 proper method for new message checking). 2301 Because the STATUS command is not guaranteed to be fast in its 2302 results, clients SHOULD NOT expect to be able to issue many 2303 consecutive STATUS commands and obtain reasonable performance. 2305 The currently defined status data items that can be requested are: 2307 MESSAGES The number of messages in the mailbox. 2309 RECENT The number of messages with the \Recent flag set. 2311 UIDNEXT The next unique identifier value of the mailbox. Refer to 2312 Section 2.3.1.1 for more information. 2314 UIDVALIDITY The unique identifier validity value of the mailbox. 2315 Refer to Section 2.3.1.1 for more information. 2317 UNSEEN The number of messages which do not have the \Seen flag set. 2319 SIZE The total size of the mailbox in octets. This is not strictly 2320 required to be an exact value, but it MUST be equal to or greater 2321 than the sum of the values of the RFC822.SIZE FETCH message data 2322 items (see Section 6.4.6) of all messages in the mailbox. 2324 Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES) 2325 S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 2326 S: A042 OK STATUS completed 2328 6.3.13. APPEND Command 2330 Arguments: mailbox name 2331 OPTIONAL flag parenthesized list 2332 OPTIONAL date/time string 2333 message literal 2335 Responses: no specific responses for this command 2337 Result: OK - append completed 2338 NO - append error: can't append to that mailbox, error 2339 in flags or date/time or message text 2340 BAD - command unknown or arguments invalid 2342 The APPEND command appends the literal argument as a new message to 2343 the end of the specified destination mailbox. This argument SHOULD 2344 be in the format of an [RFC-5322] or [I18N-HDRS] message. 8-bit 2345 characters are permitted in the message. A server implementation 2346 that is unable to preserve 8-bit data properly MUST be able to 2347 reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB] 2348 content transfer encoding. 2350 Note: There may be exceptions, e.g., draft messages, in which 2351 required [RFC-5322] header lines are omitted in the message 2352 literal argument to APPEND. The full implications of doing so 2353 must be understood and carefully weighed. 2355 If a flag parenthesized list is specified, the flags SHOULD be set in 2356 the resulting message; otherwise, the flag list of the resulting 2357 message is set to empty by default. In either case, the Recent flag 2358 is also set. 2360 If a date-time is specified, the internal date SHOULD be set in the 2361 resulting message; otherwise, the internal date of the resulting 2362 message is set to the current date and time by default. 2364 If the append is unsuccessful for any reason, the mailbox MUST be 2365 restored to its state before the APPEND attempt; no partial appending 2366 is permitted. 2368 If the destination mailbox does not exist, a server MUST return an 2369 error, and MUST NOT automatically create the mailbox. Unless it is 2370 certain that the destination mailbox can not be created, the server 2371 MUST send the response code "[TRYCREATE]" as the prefix of the text 2372 of the tagged NO response. This gives a hint to the client that it 2373 can attempt a CREATE command and retry the APPEND if the CREATE is 2374 successful. 2376 On successful completion of an APPEND, the server SHOULD return an 2377 APPENDUID response code. 2379 In the case of a mailbox that has permissions set so that the client 2380 can APPEND to the mailbox, but not SELECT or EXAMINE it, the server 2381 SHOULD NOT send an APPENDUID response code as it would disclose 2382 information about the mailbox. 2384 In the case of a mailbox that has UIDNOTSTICKY status (see 2385 UIDNOTSTICKY response code definition), the server MAY omit the 2386 APPENDUID response code as it is not meaningful. 2388 If the server does not return the APPENDUID response codes, the 2389 client can discover this information by selecting the destination 2390 mailbox. The location of messages placed in the destination mailbox 2391 by APPEND can be determined by using FETCH and/or SEARCH commands 2392 (e.g., for Message-ID or some unique marker placed in the message in 2393 an APPEND). 2395 If the mailbox is currently selected, the normal new message actions 2396 SHOULD occur. Specifically, the server SHOULD notify the client 2397 immediately via an untagged EXISTS response. If the server does not 2398 do so, the client MAY issue a NOOP command (or failing that, a CHECK 2399 command) after one or more APPEND commands. 2401 Example: C: A003 APPEND saved-messages (\Seen) {310} 2402 S: + Ready for literal data 2403 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2404 C: From: Fred Foobar 2405 C: Subject: afternoon meeting 2406 C: To: mooch@owatagu.siam.edu 2407 C: Message-Id: 2408 C: MIME-Version: 1.0 2409 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2410 C: 2411 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2412 C: 2413 S: A003 OK APPEND completed 2415 Example: C: A003 APPEND saved-messages (\Seen) {297} 2416 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 2417 C: From: Fred Foobar 2418 C: Subject: afternoon meeting 2419 C: To: mooch@example.com 2420 C: Message-Id: 2421 C: MIME-Version: 1.0 2422 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 2423 C: 2424 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 2425 C: 2426 S: A003 OK [APPENDUID 38505 3955] APPEND completed 2427 C: A004 COPY 2:4 meeting 2428 S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done 2429 C: A005 UID COPY 305:310 meeting 2430 S: A005 OK No matching messages, so nothing copied 2431 C: A006 COPY 2 funny 2432 S: A006 OK Done 2433 C: A007 SELECT funny 2434 S: * 1 EXISTS 2435 S: * 1 RECENT 2436 S: * OK [UNSEEN 1] Message 1 is first unseen 2437 S: * OK [UIDVALIDITY 3857529045] Validity session-only 2438 S: * OK [UIDNEXT 2] Predicted next UID 2439 S: * NO [UIDNOTSTICKY] Non-persistent UIDs 2440 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 2441 S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited 2442 S: A007 OK [READ-WRITE] SELECT completed 2444 In this example, A003 and A004 demonstrate successful appending and 2445 copying to a mailbox that returns the UIDs assigned to the messages. 2446 A005 is an example in which no messages were copied; this is because 2447 in A003, we see that message 2 had UID 304, and message 3 had UID 2448 319; therefore, UIDs 305 through 310 do not exist (refer to 2449 Section 2.3.1.1 for further explanation). A006 is an example of a 2450 message being copied that did not return a COPYUID; and, as expected, 2451 A007 shows that the mail store containing that mailbox does not 2452 support persistent UIDs. 2454 Note: The APPEND command is not used for message delivery, because 2455 it does not provide a mechanism to transfer [SMTP] envelope 2456 information. 2458 6.3.14. IDLE Command 2460 Arguments: none 2462 Responses: continuation data will be requested; the client sends the 2463 continuation data "DONE" to end the command 2465 Result: OK - IDLE completed after client sent "DONE" 2466 NO - failure: the server will not allow the IDLE command 2467 at this time 2468 BAD - command unknown or arguments invalid 2470 Without the IDLE command a client requires to poll the server for 2471 changes to the selected mailbox (new mail, deletions, flag changes). 2472 It's often more desirable to have the server transmit updates to the 2473 client in real time. This allows a user to see new mail immediately. 2474 The IDLE command allows a client to tell the server that it's ready 2475 to accept such real-time updates. 2477 The IDLE command is sent from the client to the server when the 2478 client is ready to accept unsolicited mailbox update messages. The 2479 server requests a response to the IDLE command using the continuation 2480 ("+") response. The IDLE command remains active until the client 2481 responds to the continuation, and as long as an IDLE command is 2482 active, the server is now free to send untagged EXISTS, EXPUNGE, and 2483 other responses at any time. 2485 The IDLE command is terminated by the receipt of a "DONE" 2486 continuation from the client; such response satisfies the server's 2487 continuation request. At that point, the server MAY send any 2488 remaining queued untagged responses and then MUST immediately send 2489 the tagged response to the IDLE command and prepare to process other 2490 commands. As in the base specification, the processing of any new 2491 command may cause the sending of unsolicited untagged responses, 2492 subject to the ambiguity limitations. The client MUST NOT send a 2493 command while the server is waiting for the DONE, since the server 2494 will not be able to distinguish a command from a continuation. 2496 The server MAY consider a client inactive if it has an IDLE command 2497 running, and if such a server has an inactivity timeout it MAY log 2498 the client off implicitly at the end of its timeout period. Because 2499 of that, clients using IDLE are advised to terminate the IDLE and re- 2500 issue it at least every 29 minutes to avoid being logged off. This 2501 still allows a client to receive immediate mailbox updates even 2502 though it need only "poll" at half hour intervals. 2504 Example: C: A001 SELECT INBOX 2505 S: * FLAGS (Deleted Seen) 2506 S: * 3 EXISTS 2507 S: * 0 RECENT 2508 S: * OK [UIDVALIDITY 1] 2509 S: A001 OK SELECT completed 2510 C: A002 IDLE 2511 S: + idling 2512 ...time passes; new mail arrives... 2513 S: * 4 EXISTS 2514 C: DONE 2515 S: A002 OK IDLE terminated 2516 ...another client expunges message 2 now... 2517 C: A003 FETCH 4 ALL 2518 S: * 4 FETCH (...) 2519 S: A003 OK FETCH completed 2520 C: A004 IDLE 2521 S: * 2 EXPUNGE 2522 S: * 3 EXISTS 2523 S: + idling 2524 ...time passes; another client expunges message 3... 2525 S: * 3 EXPUNGE 2526 S: * 2 EXISTS 2527 ...time passes; new mail arrives... 2528 S: * 3 EXISTS 2529 C: DONE 2530 S: A004 OK IDLE terminated 2531 C: A005 FETCH 3 ALL 2532 S: * 3 FETCH (...) 2533 S: A005 OK FETCH completed 2534 C: A006 IDLE 2536 6.4. Client Commands - Selected State 2538 In the selected state, commands that manipulate messages in a mailbox 2539 are permitted. 2541 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 2542 and the authenticated state commands (SELECT, EXAMINE, NAMESPACE, 2543 CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB , STATUS, 2544 and APPEND), the following commands are valid in the selected state: 2545 CHECK, CLOSE, UNSELECT, EXPUNGE, SEARCH, FETCH, STORE, COPY, and UID. 2547 6.4.1. CHECK Command 2549 Arguments: none 2551 Responses: no specific responses for this command 2553 Result: OK - check completed 2554 BAD - command unknown or arguments invalid 2556 The CHECK command requests a checkpoint of the currently selected 2557 mailbox. A checkpoint refers to any implementation-dependent 2558 housekeeping associated with the mailbox (e.g., resolving the 2559 server's in-memory state of the mailbox with the state on its disk) 2560 that is not normally executed as part of each command. A checkpoint 2561 MAY take a non-instantaneous amount of real time to complete. If a 2562 server implementation has no such housekeeping considerations, CHECK 2563 is equivalent to NOOP. 2565 There is no guarantee that an EXISTS untagged response will happen as 2566 a result of CHECK. NOOP, not CHECK, SHOULD be used for new message 2567 polling. 2569 Example: C: FXXZ CHECK 2570 S: FXXZ OK CHECK Completed 2572 6.4.2. CLOSE Command 2574 Arguments: none 2576 Responses: no specific responses for this command 2578 Result: OK - close completed, now in authenticated state 2579 BAD - command unknown or arguments invalid 2581 The CLOSE command permanently removes all messages that have the 2582 \Deleted flag set from the currently selected mailbox, and returns to 2583 the authenticated state from the selected state. No untagged EXPUNGE 2584 responses are sent. 2586 No messages are removed, and no error is given, if the mailbox is 2587 selected by an EXAMINE command or is otherwise selected read-only. 2589 Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command 2590 MAY be issued without previously issuing a CLOSE command. The 2591 SELECT, EXAMINE, and LOGOUT commands implicitly close the currently 2592 selected mailbox without doing an expunge. However, when many 2593 messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT sequence is 2594 considerably faster than an EXPUNGE-LOGOUT or EXPUNGE-SELECT because 2595 no untagged EXPUNGE responses (which the client would probably 2596 ignore) are sent. 2598 Example: C: A341 CLOSE 2599 S: A341 OK CLOSE completed 2601 6.4.3. UNSELECT Command 2603 Arguments: none 2605 Responses: no specific responses for this command 2607 Result: OK - unselect completed, now in authenticated state 2608 BAD - no mailbox selected, or argument supplied but none 2609 permitted 2611 The UNSELECT command frees server's resources associated with the 2612 selected mailbox and returns the server to the authenticated state. 2613 This command performs the same actions as CLOSE, except that no 2614 messages are permanently removed from the currently selected mailbox. 2616 Example: C: A342 UNSELECT 2617 S: A342 OK Unselect completed 2619 6.4.4. EXPUNGE Command 2621 Arguments: none 2623 Responses: untagged responses: EXPUNGE 2625 Result: OK - expunge completed 2626 NO - expunge failure: can't expunge (e.g., permission 2627 denied) 2628 BAD - command unknown or arguments invalid 2630 The EXPUNGE command permanently removes all messages that have the 2631 \Deleted flag set from the currently selected mailbox. Before 2632 returning an OK to the client, an untagged EXPUNGE response is sent 2633 for each message that is removed. Note that if any messages with the 2634 \Recent flag set are expunged, an untagged RECENT response is sent 2635 after the untagged EXPUNGE(s) to update the client's count of RECENT 2636 messages. 2638 Example: C: A202 EXPUNGE 2639 S: * 3 EXPUNGE 2640 S: * 3 EXPUNGE 2641 S: * 5 EXPUNGE 2642 S: * 8 EXPUNGE 2643 S: A202 OK EXPUNGE completed 2645 Note: In this example, messages 3, 4, 7, and 11 had the \Deleted flag 2646 set. See the description of the EXPUNGE response for further 2647 explanation. 2649 6.4.5. SEARCH Command 2651 Arguments: OPTIONAL result specifier 2652 OPTIONAL [CHARSET] specification 2653 searching criteria (one or more) 2655 Responses: REQUIRED untagged response: ESEARCH 2657 Result: OK - search completed 2658 NO - search error: can't search that [CHARSET] or 2659 criteria 2660 BAD - command unknown or arguments invalid 2662 The SEARCH command searches the mailbox for messages that match the 2663 given searching criteria. 2665 The SEARCH command may contain result options. Result options 2666 control what kind of information is returned about messages matching 2667 the search criteria in an untagged ESEARCH response. If no result 2668 option is specified or empty list of options is specified "()", ALL 2669 is assumed (see below). The order of individual options is 2670 arbitrary. Individual options may contain parameters enclosed in 2671 parentheses (*). If an option has parameters, they consist of atoms 2672 and/or strings and/or lists in a specific order. Any options not 2673 defined by extensions that the server supports must be rejected with 2674 a BAD response. 2676 (*) - if an option has a mandatory parameter, which can always be 2677 represented as a number or a sequence-set, the option parameter does 2678 not need the enclosing (). See ABNF for more details. 2680 This document specifies the following result options: 2682 MIN 2684 Return the lowest message number/UID that satisfies the SEARCH 2685 criteria. 2687 If the SEARCH results in no matches, the server MUST NOT 2688 include the MIN result option in the ESEARCH response; however, 2689 it still MUST send the ESEARCH response. 2691 MAX 2693 Return the highest message number/UID that satisfies the SEARCH 2694 criteria. 2696 If the SEARCH results in no matches, the server MUST NOT 2697 include the MAX result option in the ESEARCH response; however, 2698 it still MUST send the ESEARCH response. 2700 ALL 2702 Return all message numbers/UIDs that satisfy the SEARCH 2703 criteria using the sequence-set syntax. Note, the client MUST 2704 NOT assume that messages/UIDs will be listed in any particular 2705 order. 2707 If the SEARCH results in no matches, the server MUST NOT 2708 include the ALL result option in the ESEARCH response; however, 2709 it still MUST send the ESEARCH response. 2711 COUNT Return number of the messages that satisfy the SEARCH 2712 criteria. This result option MUST always be included in the 2713 ESEARCH response. 2715 Note: future extensions to this document can allow servers to return 2716 multiple ESEARCH responses for a single extended SEARCH command. 2717 However all options specified above MUST result in a single ESEARCH 2718 response. These extensions will have to describe how results from 2719 multiple ESEARCH responses are to be amalgamated. 2721 Searching criteria consist of one or more search keys. 2723 When multiple keys are specified, the result is the intersection (AND 2724 function) of all the messages that match those keys. For example, 2725 the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers to all 2726 deleted messages from Smith that were placed in the mailbox since 2727 February 1, 1994. A search key can also be a parenthesized list of 2728 one or more search keys (e.g., for use with the OR and NOT keys). 2730 Server implementations MAY exclude [MIME-IMB] body parts with 2731 terminal content media types other than TEXT and MESSAGE from 2732 consideration in SEARCH matching. 2734 The OPTIONAL [CHARSET] specification consists of the word "CHARSET" 2735 followed by a registered [CHARSET]. It indicates the [CHARSET] of 2736 the strings that appear in the search criteria. [MIME-IMB] content 2737 transfer encodings, and [MIME-HDRS] strings in [RFC-5322]/[MIME-IMB] 2738 headers, MUST be decoded before comparing text. US-ASCII and UTF-8 2739 charsets MUST be supported; other [CHARSET]s MAY be supported. If 2740 "CHARSET" is not provided, an IMAP4rev2 server MUST assume UTF-8. 2742 If the server does not support the specified [CHARSET], it MUST 2743 return a tagged NO response (not a BAD). This response SHOULD 2744 contain the BADCHARSET response code, which MAY list the [CHARSET]s 2745 supported by the server. 2747 In all search keys that use strings, a message matches the key if the 2748 string is a substring of the associated text. The matching SHOULD be 2749 case-insensitive for characters within ASCII range. Consider using 2750 [IMAP-I18N] for language-sensitive case-insensitive searching. Note 2751 that the empty string is a substring; this is useful when doing a 2752 HEADER search in order to test for a header field presence in the 2753 message. 2755 The defined search keys are as follows. Refer to the Formal Syntax 2756 section for the precise syntactic definitions of the arguments. 2758 Messages with message sequence numbers corresponding 2759 to the specified message sequence number set. 2761 ALL All messages in the mailbox; the default initial key for ANDing. 2763 ANSWERED Messages with the \Answered flag set. 2765 BCC Messages that contain the specified string in the 2766 envelope structure's BCC field. 2768 BEFORE Messages whose internal date (disregarding time and 2769 timezone) is earlier than the specified date. 2771 BODY Messages that contain the specified string in the body 2772 of the message. 2774 CC Messages that contain the specified string in the 2775 envelope structure's CC field. 2777 DELETED Messages with the \Deleted flag set. 2779 DRAFT Messages with the \Draft flag set. 2781 FLAGGED Messages with the \Flagged flag set. 2783 FROM Messages that contain the specified string in the 2784 envelope structure's FROM field. 2786 HEADER Messages that have a header with the 2787 specified field-name (as defined in [RFC-5322]) and that contains 2788 the specified string in the text of the header (what comes after 2789 the colon). If the string to search is zero-length, this matches 2790 all messages that have a header line with the specified field-name 2791 regardless of the contents. 2793 KEYWORD Messages with the specified keyword flag set. 2795 LARGER Messages with an [RFC-5322] size larger than the 2796 specified number of octets. 2798 NEW Messages that have the \Recent flag set but not the \Seen flag. 2799 This is functionally equivalent to "(RECENT UNSEEN)". 2801 NOT Messages that do not match the specified search 2802 key. 2804 OLD Messages that do not have the \Recent flag set. This is 2805 functionally equivalent to "NOT RECENT" (as opposed to "NOT NEW"). 2807 ON Messages whose internal date (disregarding time and 2808 timezone) is within the specified date. 2810 OR Messages that match either search 2811 key. 2813 RECENT Messages that have the \Recent flag set. 2815 SEEN Messages that have the \Seen flag set. 2817 SENTBEFORE Messages whose [RFC-5322] Date: header 2818 (disregarding time and timezone) is earlier than the specified 2819 date. 2821 SENTON Messages whose [RFC-5322] Date: header (disregarding 2822 time and timezone) is within the specified date. 2824 SENTSINCE Messages whose [RFC-5322] Date: header 2825 (disregarding time and timezone) is within or later than the 2826 specified date. 2828 SINCE Messages whose internal date (disregarding time and 2829 timezone) is within or later than the specified date. 2831 SMALLER Messages with an [RFC-5322] size smaller than the 2832 specified number of octets. 2834 SUBJECT Messages that contain the specified string in the 2835 envelope structure's SUBJECT field. 2837 TEXT Messages that contain the specified string in the 2838 header or body of the message. 2840 TO Messages that contain the specified string in the 2841 envelope structure's TO field. 2843 UID Messages with unique identifiers corresponding to 2844 the specified unique identifier set. Sequence set ranges are 2845 permitted. 2847 UNANSWERED Messages that do not have the \Answered flag set. 2849 UNDELETED Messages that do not have the \Deleted flag set. 2851 UNDRAFT Messages that do not have the \Draft flag set. 2853 UNFLAGGED Messages that do not have the \Flagged flag set. 2855 UNKEYWORD Messages that do not have the specified keyword 2856 flag set. 2858 UNSEEN Messages that do not have the \Seen flag set. 2860 Example: C: A282 SEARCH RETURN (MIN COUNT) FLAGGED 2861 SINCE 1-Feb-1994 NOT FROM "Smith" 2862 S: * ESEARCH (TAG "A282") MIN 2 COUNT 3 2863 S: A282 OK SEARCH completed 2865 Example: C: A283 SEARCH RETURN () FLAGGED 2866 SINCE 1-Feb-1994 NOT FROM "Smith" 2867 S: * ESEARCH (TAG "A283") ALL 2,10:11 2868 S: A283 OK SEARCH completed 2870 Example: C: A284 SEARCH TEXT "string not in mailbox" 2871 S: * ESEARCH (TAG "A284") 2872 S: A284 OK SEARCH completed 2873 C: A285 SEARCH CHARSET UTF-8 TEXT {6} 2874 S: + Ready for literal text 2875 C: XXXXXX 2876 S: * ESEARCH (TAG "A285") ALL 43 2877 S: A285 OK SEARCH completed 2879 Note: Since this document is restricted to 7-bit ASCII text, it is 2880 not possible to show actual UTF-8 data. The "XXXXXX" is a 2881 placeholder for what would be 6 octets of 8-bit data in an actual 2882 transaction. 2884 The following example demonstrates finding the first unseen message 2885 as returned in the UNSEEN response code on a successful SELECT 2886 command: 2888 Example: C: A284 SEARCH RETURN (MIN) UNSEEN 2889 S: * ESEARCH (TAG "A284") MIN 4 2890 S: A284 OK SEARCH completed 2892 The following example demonstrates that if the ESEARCH UID indicator 2893 is present, all data in the ESEARCH response is referring to UIDs; 2894 for example, the MIN result specifier will be followed by a UID. 2896 Example: C: A285 UID SEARCH RETURN (MIN MAX) 1:5000 2897 S: * ESEARCH (TAG "A285") UID MIN 7 MAX 3800 2898 S: A285 OK SEARCH completed 2900 The following example demonstrates returning the number of deleted 2901 messages: 2903 Example: C: A286 SEARCH RETURN (COUNT) DELETED 2904 S: * ESEARCH (TAG "A286") COUNT 15 2905 S: A286 OK SEARCH completed 2907 6.4.6. FETCH Command 2909 Arguments: sequence set 2910 message data item names or macro 2912 Responses: untagged responses: FETCH 2914 Result: OK - fetch completed 2915 NO - fetch error: can't fetch that data 2916 BAD - command unknown or arguments invalid 2918 The FETCH command retrieves data associated with a message in the 2919 mailbox. The data items to be fetched can be either a single atom or 2920 a parenthesized list. 2922 Most data items, identified in the formal syntax under the msg-att- 2923 static rule, are static and MUST NOT change for any particular 2924 message. Other data items, identified in the formal syntax under the 2925 msg-att-dynamic rule, MAY change, either as a result of a STORE 2926 command or due to external events. 2928 For example, if a client receives an ENVELOPE for a message when 2929 it already knows the envelope, it can safely ignore the newly 2930 transmitted envelope. 2932 There are three macros which specify commonly-used sets of data 2933 items, and can be used instead of data items. A macro must be used 2934 by itself, and not in conjunction with other macros or data items. 2936 ALL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) 2938 FAST Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE) 2940 FULL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE 2941 BODY) 2943 The currently defined data items that can be fetched are: 2945 BODY Non-extensible form of BODYSTRUCTURE. 2947 BODY[
]<> 2949 The text of a particular body section. The section 2950 specification is a set of zero or more part specifiers 2951 delimited by periods. A part specifier is either a part number 2952 or one of the following: HEADER, HEADER.FIELDS, 2953 HEADER.FIELDS.NOT, MIME, and TEXT. An empty section 2954 specification refers to the entire message, including the 2955 header. 2957 Every message has at least one part number. Non-[MIME-IMB] 2958 messages, and non-multipart [MIME-IMB] messages with no 2959 encapsulated message, only have a part 1. 2961 Multipart messages are assigned consecutive part numbers, as 2962 they occur in the message. If a particular part is of type 2963 message or multipart, its parts MUST be indicated by a period 2964 followed by the part number within that nested multipart part. 2966 A part of type MESSAGE/RFC822 or MESSAGE/GLOBAL also has nested 2967 part numbers, referring to parts of the MESSAGE part's body. 2969 The HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, and TEXT part 2970 specifiers can be the sole part specifier or can be prefixed by 2971 one or more numeric part specifiers, provided that the numeric 2972 part specifier refers to a part of type MESSAGE/RFC822 or 2973 MESSAGE/GLOBAL. The MIME part specifier MUST be prefixed by 2974 one or more numeric part specifiers. 2976 The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part 2977 specifiers refer to the [RFC-5322] header of the message or of 2978 an encapsulated [MIME-IMT] MESSAGE/RFC822 or MESSAGE/GLOBAL 2979 message. HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a 2980 list of field-name (as defined in [RFC-5322]) names, and return 2981 a subset of the header. The subset returned by HEADER.FIELDS 2982 contains only those header fields with a field-name that 2983 matches one of the names in the list; similarly, the subset 2984 returned by HEADER.FIELDS.NOT contains only the header fields 2985 with a non-matching field-name. The field-matching is ASCII 2986 range case-insensitive but otherwise exact. Subsetting does 2987 not exclude the [RFC-5322] delimiting blank line between the 2988 header and the body; the blank line is included in all header 2989 fetches, except in the case of a message which has no body and 2990 no blank line. 2992 The MIME part specifier refers to the [MIME-IMB] header for 2993 this part. 2995 The TEXT part specifier refers to the text body of the message, 2996 omitting the [RFC-5322] header. 2998 Here is an example of a complex message with some of its 2999 part specifiers: 3001 HEADER ([RFC-5322] header of the message) 3002 TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 3003 1 TEXT/PLAIN 3004 2 APPLICATION/OCTET-STREAM 3005 3 MESSAGE/RFC822 3006 3.HEADER ([RFC-5322] header of the message) 3007 3.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 3008 3.1 TEXT/PLAIN 3009 3.2 APPLICATION/OCTET-STREAM 3010 4 MULTIPART/MIXED 3011 4.1 IMAGE/GIF 3012 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF) 3013 4.2 MESSAGE/RFC822 3014 4.2.HEADER ([RFC-5322] header of the message) 3015 4.2.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 3016 4.2.1 TEXT/PLAIN 3017 4.2.2 MULTIPART/ALTERNATIVE 3018 4.2.2.1 TEXT/PLAIN 3019 4.2.2.2 TEXT/RICHTEXT 3021 It is possible to fetch a substring of the designated text. 3022 This is done by appending an open angle bracket ("<"), the 3023 octet position of the first desired octet, a period, the 3024 maximum number of octets desired, and a close angle bracket 3025 (">") to the part specifier. If the starting octet is beyond 3026 the end of the text, an empty string is returned. 3028 Any partial fetch that attempts to read beyond the end of the 3029 text is truncated as appropriate. A partial fetch that starts 3030 at octet 0 is returned as a partial fetch, even if this 3031 truncation happened. 3033 Note: This means that BODY[]<0.2048> of a 1500-octet message 3034 will return BODY[]<0> with a literal of size 1500, not 3035 BODY[]. 3037 Note: A substring fetch of a HEADER.FIELDS or 3038 HEADER.FIELDS.NOT part specifier is calculated after 3039 subsetting the header. 3041 The \Seen flag is implicitly set; if this causes the flags to 3042 change, they SHOULD be included as part of the FETCH responses. 3044 BODY.PEEK[
]<> An alternate form of BODY[
] 3045 that does not implicitly set the \Seen flag. 3047 BODYSTRUCTURE The [MIME-IMB] body structure of the message. This is 3048 computed by the server by parsing the [MIME-IMB] header fields in 3049 the [RFC-5322] header and [MIME-IMB] headers. 3051 ENVELOPE The envelope structure of the message. This is computed by 3052 the server by parsing the [RFC-5322] header into the component 3053 parts, defaulting various fields as necessary. 3055 FLAGS The flags that are set for this message. 3057 INTERNALDATE The internal date of the message. 3059 RFC822 Functionally equivalent to BODY[], differing in the syntax of 3060 the resulting untagged FETCH data (RFC822 is returned). 3062 RFC822.HEADER Functionally equivalent to BODY.PEEK[HEADER], 3063 differing in the syntax of the resulting untagged FETCH data 3064 (RFC822.HEADER is returned). 3066 RFC822.SIZE The [RFC-5322] size of the message. 3068 RFC822.TEXT Functionally equivalent to BODY[TEXT], differing in the 3069 syntax of the resulting untagged FETCH data (RFC822.TEXT is 3070 returned). 3072 UID The unique identifier for the message. 3074 Example: C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)]) 3075 S: * 2 FETCH .... 3076 S: * 3 FETCH .... 3077 S: * 4 FETCH .... 3078 S: A654 OK FETCH completed 3080 6.4.7. STORE Command 3082 Arguments: sequence set 3083 message data item name 3084 value for message data item 3086 Responses: untagged responses: FETCH 3088 Result: OK - store completed 3089 NO - store error: can't store that data 3090 BAD - command unknown or arguments invalid 3092 The STORE command alters data associated with a message in the 3093 mailbox. Normally, STORE will return the updated value of the data 3094 with an untagged FETCH response. A suffix of ".SILENT" in the data 3095 item name prevents the untagged FETCH, and the server SHOULD assume 3096 that the client has determined the updated value itself or does not 3097 care about the updated value. 3099 Note: Regardless of whether or not the ".SILENT" suffix was used, 3100 the server SHOULD send an untagged FETCH response if a change to a 3101 message's flags from an external source is observed. The intent 3102 is that the status of the flags is determinate without a race 3103 condition. 3105 The currently defined data items that can be stored are: 3107 FLAGS Replace the flags for the message (other than 3108 \Recent) with the argument. The new value of the flags is 3109 returned as if a FETCH of those flags was done. 3111 FLAGS.SILENT Equivalent to FLAGS, but without returning 3112 a new value. 3114 +FLAGS Add the argument to the flags for the message. 3115 The new value of the flags is returned as if a FETCH of those 3116 flags was done. 3118 +FLAGS.SILENT Equivalent to +FLAGS, but without 3119 returning a new value. 3121 -FLAGS Remove the argument from the flags for the 3122 message. The new value of the flags is returned as if a FETCH of 3123 those flags was done. 3125 -FLAGS.SILENT Equivalent to -FLAGS, but without 3126 returning a new value. 3128 Example: C: A003 STORE 2:4 +FLAGS (\Deleted) 3129 S: * 2 FETCH (FLAGS (\Deleted \Seen)) 3130 S: * 3 FETCH (FLAGS (\Deleted)) 3131 S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen)) 3132 S: A003 OK STORE completed 3134 6.4.8. COPY Command 3136 Arguments: sequence set 3137 mailbox name 3139 Responses: no specific responses for this command 3141 Result: OK - copy completed 3142 NO - copy error: can't copy those messages or to that 3143 name 3144 BAD - command unknown or arguments invalid 3146 The COPY command copies the specified message(s) to the end of the 3147 specified destination mailbox. The flags and internal date of the 3148 message(s) SHOULD be preserved, and the Recent flag SHOULD be set, in 3149 the copy. 3151 If the destination mailbox does not exist, a server SHOULD return an 3152 error. It SHOULD NOT automatically create the mailbox. Unless it is 3153 certain that the destination mailbox can not be created, the server 3154 MUST send the response code "[TRYCREATE]" as the prefix of the text 3155 of the tagged NO response. This gives a hint to the client that it 3156 can attempt a CREATE command and retry the COPY if the CREATE is 3157 successful. 3159 If the COPY command is unsuccessful for any reason, server 3160 implementations MUST restore the destination mailbox to its state 3161 before the COPY attempt. 3163 On successful completion of a COPY, the server SHOULD return a 3164 COPYUID response code. 3166 In the case of a mailbox that has permissions set so that the client 3167 can COPY to the mailbox, but not SELECT or EXAMINE it, the server 3168 SHOULD NOT send an COPYUID response code as it would disclose 3169 information about the mailbox. 3171 In the case of a mailbox that has UIDNOTSTICKY status (see the 3172 UIDNOTSTICKY response code), the server MAY omit the COPYUID response 3173 code as it is not meaningful. 3175 If the server does not return the COPYUID response code, the client 3176 can discover this information by selecting the destination mailbox. 3177 The location of messages placed in the destination mailbox by COPY 3178 can be determined by using FETCH and/or SEARCH commands (e.g., for 3179 Message-ID). 3181 Example: C: A003 COPY 2:4 MEETING 3182 S: A003 OK COPY completed 3184 6.4.9. UID Command 3186 Arguments: command name 3187 command arguments 3189 Responses: untagged responses: FETCH, SEARCH 3191 Result: OK - UID command completed 3192 NO - UID command error 3193 BAD - command unknown or arguments invalid 3195 The UID command has three forms. In the first form, it takes as its 3196 arguments a COPY, FETCH, or STORE command with arguments appropriate 3197 for the associated command. However, the numbers in the sequence set 3198 argument are unique identifiers instead of message sequence numbers. 3199 Sequence set ranges are permitted, but there is no guarantee that 3200 unique identifiers will be contiguous. 3202 A non-existent unique identifier is ignored without any error message 3203 generated. Thus, it is possible for a UID FETCH command to return an 3204 OK without any data or a UID COPY or UID STORE to return an OK 3205 without performing any operations. 3207 In the second form, the UID command takes an EXPUNGE command with an 3208 extra parameter the specified a sequence set of UIDs to operate on. 3209 The UID EXPUNGE command permanently removes all messages that both 3210 have the \Deleted flag set and have a UID that is included in the 3211 specified sequence set from the currently selected mailbox. If a 3212 message either does not have the \Deleted flag set or has a UID that 3213 is not included in the specified sequence set, it is not affected. 3215 UID EXPUNGE is particularly useful for disconnected use clients. 3216 By using UID EXPUNGE instead of EXPUNGE when resynchronizing with 3217 the server, the client can ensure that it does not inadvertantly 3218 remove any messages that have been marked as \Deleted by other 3219 clients between the time that the client was last connected and 3220 the time the client resynchronizes. 3222 Example: C: A003 UID EXPUNGE 3000:3002 3223 S: * 3 EXPUNGE 3224 S: * 3 EXPUNGE 3225 S: * 3 EXPUNGE 3226 S: A003 OK UID EXPUNGE completed 3228 In the third form, the UID command takes a SEARCH command with SEARCH 3229 command arguments. The interpretation of the arguments is the same 3230 as with SEARCH; however, the numbers returned in a ESEARCH response 3231 for a UID SEARCH command are unique identifiers instead of message 3232 sequence numbers. Also, the corresponding ESEARCH response MUST 3233 include the UID indicator. For example, the command UID SEARCH 1:100 3234 UID 443:557 returns the unique identifiers corresponding to the 3235 intersection of two sequence sets, the message sequence number range 3236 1:100 and the UID range 443:557. 3238 Note: in the above example, the UID range 443:557 appears. The 3239 same comment about a non-existent unique identifier being ignored 3240 without any error message also applies here. Hence, even if 3241 neither UID 443 or 557 exist, this range is valid and would 3242 include an existing UID 495. 3244 Also note that a UID range of 559:* always includes the UID of the 3245 last message in the mailbox, even if 559 is higher than any 3246 assigned UID value. This is because the contents of a range are 3247 independent of the order of the range endpoints. Thus, any UID 3248 range with * as one of the endpoints indicates at least one 3249 message (the message with the highest numbered UID), unless the 3250 mailbox is empty. 3252 The number after the "*" in an untagged FETCH or EXPUNGE response is 3253 always a message sequence number, not a unique identifier, even for a 3254 UID command response. However, server implementations MUST 3255 implicitly include the UID message data item as part of any FETCH 3256 response caused by a UID command, regardless of whether a UID was 3257 specified as a message data item to the FETCH. 3259 Note: The rule about including the UID message data item as part of a 3260 FETCH response primarily applies to the UID FETCH and UID STORE 3261 commands, including a UID FETCH command that does not include UID as 3262 a message data item. Although it is unlikely that the other UID 3263 commands will cause an untagged FETCH, this rule applies to these 3264 commands as well. 3266 Example: C: A999 UID FETCH 4827313:4828442 FLAGS 3267 S: * 23 FETCH (FLAGS (\Seen) UID 4827313) 3268 S: * 24 FETCH (FLAGS (\Seen) UID 4827943) 3269 S: * 25 FETCH (FLAGS (\Seen) UID 4828442) 3270 S: A999 OK UID FETCH completed 3272 6.5. Client Commands - Experimental/Expansion 3274 6.5.1. X Command 3276 Arguments: implementation defined 3278 Responses: implementation defined 3280 Result: OK - command completed 3281 NO - failure 3282 BAD - command unknown or arguments invalid 3284 Any command prefixed with an X is an experimental command. Commands 3285 which are not part of this specification, a standard or standards- 3286 track revision of this specification, or an IESG-approved 3287 experimental protocol, MUST use the X prefix. 3289 Any added untagged responses issued by an experimental command MUST 3290 also be prefixed with an X. Server implementations MUST NOT send any 3291 such untagged responses, unless the client requested it by issuing 3292 the associated experimental command. 3294 Example: C: a441 CAPABILITY 3295 S: * CAPABILITY IMAP4rev2 XPIG-LATIN 3296 S: a441 OK CAPABILITY completed 3297 C: A442 XPIG-LATIN 3298 S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay 3299 S: A442 OK XPIG-LATIN ompleted-cay 3301 7. Server Responses 3303 Server responses are in three forms: status responses, server data, 3304 and command continuation request. The information contained in a 3305 server response, identified by "Contents:" in the response 3306 descriptions below, is described by function, not by syntax. The 3307 precise syntax of server responses is described in the Formal Syntax 3308 section. 3310 The client MUST be prepared to accept any response at all times. 3312 Status responses can be tagged or untagged. Tagged status responses 3313 indicate the completion result (OK, NO, or BAD status) of a client 3314 command, and have a tag matching the command. 3316 Some status responses, and all server data, are untagged. An 3317 untagged response is indicated by the token "*" instead of a tag. 3318 Untagged status responses indicate server greeting, or server status 3319 that does not indicate the completion of a command (for example, an 3320 impending system shutdown alert). For historical reasons, untagged 3321 server data responses are also called "unsolicited data", although 3322 strictly speaking, only unilateral server data is truly 3323 "unsolicited". 3325 Certain server data MUST be recorded by the client when it is 3326 received; this is noted in the description of that data. Such data 3327 conveys critical information which affects the interpretation of all 3328 subsequent commands and responses (e.g., updates reflecting the 3329 creation or destruction of messages). 3331 Other server data SHOULD be recorded for later reference; if the 3332 client does not need to record the data, or if recording the data has 3333 no obvious purpose (e.g., a SEARCH response when no SEARCH command is 3334 in progress), the data SHOULD be ignored. 3336 An example of unilateral untagged server data occurs when the IMAP 3337 connection is in the selected state. In the selected state, the 3338 server checks the mailbox for new messages as part of command 3339 execution. Normally, this is part of the execution of every command; 3340 hence, a NOOP command suffices to check for new messages. If new 3341 messages are found, the server sends untagged EXISTS and RECENT 3342 responses reflecting the new size of the mailbox. Server 3343 implementations that offer multiple simultaneous access to the same 3344 mailbox SHOULD also send appropriate unilateral untagged FETCH and 3345 EXPUNGE responses if another agent changes the state of any message 3346 flags or expunges any messages. 3348 Command continuation request responses use the token "+" instead of a 3349 tag. These responses are sent by the server to indicate acceptance 3350 of an incomplete client command and readiness for the remainder of 3351 the command. 3353 7.1. Server Responses - Status Responses 3355 Status responses are OK, NO, BAD, PREAUTH and BYE. OK, NO, and BAD 3356 can be tagged or untagged. PREAUTH and BYE are always untagged. 3358 Status responses MAY include an OPTIONAL "response code". A response 3359 code consists of data inside square brackets in the form of an atom, 3360 possibly followed by a space and arguments. The response code 3361 contains additional information or status codes for client software 3362 beyond the OK/NO/BAD condition, and are defined when there is a 3363 specific action that a client can take based upon the additional 3364 information. 3366 The currently defined response codes are: 3368 ALERT The human-readable text contains a special alert that MUST be 3369 presented to the user in a fashion that calls the user's attention 3370 to the message. 3372 ALREADYEXISTS 3374 The operation attempts to create something that already exists, 3375 such as when the CREATE or RENAME directories attempt to create 3376 a mailbox and there is already one of that name. 3378 C: o RENAME this that 3379 S: o NO [ALREADYEXISTS] Mailbox "that" already exists 3381 APPENDUID 3383 Followed by the UIDVALIDITY of the destination mailbox and the 3384 UID assigned to the appended message in the destination 3385 mailbox, indicates that the message has been appended to the 3386 destination mailbox with that UID. 3388 If the server also supports the [MULTIAPPEND] extension, and if 3389 multiple messages were appended in the APPEND command, then the 3390 second value is a UID set containing the UIDs assigned to the 3391 appended messages, in the order they were transmitted in the 3392 APPEND command. This UID set may not contain extraneous UIDs 3393 or the symbol "*". 3395 Note: the UID set form of the APPENDUID response code MUST 3396 NOT be used if only a single message was appended. In 3397 particular, a server MUST NOT send a range such as 123:123. 3398 This is because a client that does not support [MULTIAPPEND] 3399 expects only a single UID and not a UID set. 3401 UIDs are assigned in strictly ascending order in the mailbox 3402 (refer to Section 2.3.1.1); note that a range of 12:10 is 3403 exactly equivalent to 10:12 and refers to the sequence 3404 10,11,12. 3406 This response code is returned in a tagged OK response to the 3407 APPEND command. 3409 AUTHENTICATIONFAILED 3411 Authentication failed for some reason on which the server is 3412 unwilling to elaborate. Typically, this includes "unknown 3413 user" and "bad password". 3415 This is the same as not sending any response code, except that 3416 when a client sees AUTHENTICATIONFAILED, it knows that the 3417 problem wasn't, e.g., UNAVAILABLE, so there's no point in 3418 trying the same login/password again later. 3420 C: b LOGIN "fred" "foo" 3421 S: b NO [AUTHENTICATIONFAILED] Authentication failed 3423 AUTHORIZATIONFAILED Authentication succeeded in using the 3424 authentication identity, but the server cannot or will not allow 3425 the authentication identity to act as the requested authorization 3426 identity. This is only applicable when the authentication and 3427 authorization identities are different. C: c1 AUTHENTICATE PLAIN 3428 [...] 3429 S: c1 NO [AUTHORIZATIONFAILED] No such authorization-ID 3430 C: c2 AUTHENTICATE PLAIN 3431 [...] 3432 S: c2 NO [AUTHORIZATIONFAILED] Authenticator is not an admin 3434 BADCHARSET Optionally followed by a parenthesized list of charsets. 3435 A SEARCH failed because the given charset is not supported by this 3436 implementation. If the optional list of charsets is given, this 3437 lists the charsets that are supported by this implementation. 3439 CANNOT 3441 The operation violates some invariant of the server and can 3442 never succeed. 3444 C: l create "///////" 3445 S: l NO [CANNOT] Adjacent slashes are not supported 3447 CAPABILITY Followed by a list of capabilities. This can appear in 3448 the initial OK or PREAUTH response to transmit an initial 3449 capabilities list. This makes it unnecessary for a client to send 3450 a separate CAPABILITY command if it recognizes this response. 3452 CLIENTBUG 3453 The server has detected a client bug. This can accompany all 3454 of OK, NO, and BAD, depending on what the client bug is. 3456 C: k1 select "/archive/projects/experiment-iv" 3457 [...] 3458 S: k1 OK [READ-ONLY] Done 3459 C: k2 status "/archive/projects/experiment-iv" (messages) 3460 [...] 3461 S: k2 OK [CLIENTBUG] Done 3463 CLOSED 3465 The CLOSED response code has no parameters. A server return 3466 the CLOSED response code when the currently selected mailbox is 3467 closed implicitly using the SELECT/EXAMINE command on another 3468 mailbox. The CLOSED response code serves as a boundary between 3469 responses for the previously opened mailbox (which was closed) 3470 and the newly selected mailbox; all responses before the CLOSED 3471 response code relate to the mailbox that was closed, and all 3472 subsequent responses relate to the newly opened mailbox. 3474 There is no need to return the CLOSED response code on 3475 completion of the CLOSE or the UNSELECT command (or similar), 3476 whose purpose is to close the currently selected mailbox 3477 without opening a new one. 3479 The server can also return an unsolicited CLOSED response code 3480 when it wants to force the client to return to authenticated 3481 state. For example, the server can do that when the mailbox 3482 requires repairs or is deleted in another session. 3484 CONTACTADMIN 3486 The user should contact the system administrator or support 3487 desk. 3489 C: e login "fred" "foo" 3490 S: e OK [CONTACTADMIN] 3492 COPYUID 3494 Followed by the UIDVALIDITY of the destination mailbox, a UID 3495 set containing the UIDs of the message(s) in the source mailbox 3496 that were copied to the destination mailbox and containing the 3497 UIDs assigned to the copied message(s) in the destination 3498 mailbox, indicates that the message(s) have been copied to the 3499 destination mailbox with the stated UID(s). 3501 The source UID set is in the order the message(s) were copied; 3502 the destination UID set corresponds to the source UID set and 3503 is in the same order. Neither of the UID sets may contain 3504 extraneous UIDs or the symbol "*". 3506 UIDs are assigned in strictly ascending order in the mailbox 3507 (refer to Section 2.3.1.1); note that a range of 12:10 is 3508 exactly equivalent to 10:12 and refers to the sequence 3509 10,11,12. 3511 This response code is returned in a tagged OK response to the 3512 COPY command. 3514 CORRUPTION 3516 The server discovered that some relevant data (e.g., the 3517 mailbox) are corrupt. This response code does not include any 3518 information about what's corrupt, but the server can write that 3519 to its logfiles. 3521 C: i select "/archive/projects/experiment-iv" 3522 S: i NO [CORRUPTION] Cannot open mailbox 3524 EXPIRED 3526 Either authentication succeeded or the server no longer had the 3527 necessary data; either way, access is no longer permitted using 3528 that passphrase. The client or user should get a new 3529 passphrase. 3531 C: d login "fred" "foo" 3532 S: d NO [EXPIRED] That password isn't valid any more 3534 EXPUNGEISSUED 3536 Someone else has issued an EXPUNGE for the same mailbox. The 3537 client may want to issue NOOP soon. [IMAP-MULTIACCESS] 3538 discusses this subject in depth. 3540 C: h search from fred@example.com 3541 S: * SEARCH 1 2 3 5 8 13 21 42 3542 S: h OK [EXPUNGEISSUED] Search completed 3544 INUSE 3546 An operation has not been carried out because it involves 3547 sawing off a branch someone else is sitting on. Someone else 3548 may be holding an exclusive lock needed for this operation, or 3549 the operation may involve deleting a resource someone else is 3550 using, typically a mailbox. 3552 The operation may succeed if the client tries again later. 3554 C: g delete "/archive/projects/experiment-iv" 3555 S: g NO [INUSE] Mailbox in use 3557 LIMIT 3559 The operation ran up against an implementation limit of some 3560 kind, such as the number of flags on a single message or the 3561 number of flags used in a mailbox. 3563 C: m STORE 42 FLAGS f1 f2 f3 f4 f5 ... f250 3564 S: m NO [LIMIT] At most 32 flags in one mailbox supported 3566 NONEXISTENT 3568 The operation attempts to delete something that does not exist. 3569 Similar to ALREADYEXISTS. 3571 C: p RENAME this that 3572 S: p NO [NONEXISTENT] No such mailbox 3574 NOPERM 3576 The access control system (e.g., Access Control List (ACL), see 3577 [RFC4314] does not permit this user to carry out an operation, 3578 such as selecting or creating a mailbox. 3580 C: f select "/archive/projects/experiment-iv" 3581 S: f NO [NOPERM] Access denied 3583 OVERQUOTA 3585 The user would be over quota after the operation. (The user 3586 may or may not be over quota already.) 3588 Note that if the server sends OVERQUOTA but doesn't support the 3589 IMAP QUOTA extension defined by [RFC2087], then there is a 3590 quota, but the client cannot find out what the quota is. 3592 C: n1 uid copy 1:* oldmail 3593 S: n1 NO [OVERQUOTA] Sorry 3595 C: n2 uid copy 1:* oldmail 3596 S: n2 OK [OVERQUOTA] You are now over your soft quota 3598 PARSE The human-readable text represents an error in parsing the 3599 [RFC-5322] header or [MIME-IMB] headers of a message in the 3600 mailbox. 3602 PERMANENTFLAGS Followed by a parenthesized list of flags, indicates 3603 which of the known flags the client can change permanently. Any 3604 flags that are in the FLAGS untagged response, but not the 3605 PERMANENTFLAGS list, can not be set permanently. If the client 3606 attempts to STORE a flag that is not in the PERMANENTFLAGS list, 3607 the server will either ignore the change or store the state change 3608 for the remainder of the current session only. The PERMANENTFLAGS 3609 list can also include the special flag \*, which indicates that it 3610 is possible to create new keywords by attempting to store those 3611 flags in the mailbox. 3613 PRIVACYREQUIRED 3615 The operation is not permitted due to a lack of privacy. If 3616 Transport Layer Security (TLS) is not in use, the client could 3617 try STARTTLS (see Section 6.2.1) and then repeat the operation. 3619 C: d login "fred" "foo" 3620 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3622 C: d select inbox 3623 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 3625 READ-ONLY The mailbox is selected read-only, or its access while 3626 selected has changed from read-write to read-only. 3628 READ-WRITE The mailbox is selected read-write, or its access while 3629 selected has changed from read-only to read-write. 3631 SERVERBUG 3633 The server encountered a bug in itself or violated one of its 3634 own invariants. 3636 C: j select "/archive/projects/experiment-iv" 3637 S: j NO [SERVERBUG] This should not happen 3639 TRYCREATE An APPEND or COPY attempt is failing because the target 3640 mailbox does not exist (as opposed to some other reason). This is 3641 a hint to the client that the operation can succeed if the mailbox 3642 is first created by the CREATE command. 3644 UIDNEXT Followed by a decimal number, indicates the next unique 3645 identifier value. Refer to Section 2.3.1.1 for more information. 3647 UIDNOTSTICKY 3649 The selected mailbox is supported by a mail store that does not 3650 support persistent UIDs; that is, UIDVALIDITY will be different 3651 each time the mailbox is selected. Consequently, APPEND or 3652 COPY to this mailbox will not return an APPENDUID or COPYUID 3653 response code. 3655 This response code is returned in an untagged NO response to 3656 the SELECT command. 3658 Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores. 3659 This facility exists to support legacy mail stores in which 3660 it is technically infeasible to support persistent UIDs. 3661 This should be avoided when designing new mail stores. 3663 UIDVALIDITY Followed by a decimal number, indicates the unique 3664 identifier validity value. Refer to Section 2.3.1.1 for more 3665 information. 3667 UNAVAILABLE 3669 Temporary failure because a subsystem is down. For example, an 3670 IMAP server that uses a Lightweight Directory Access Protocol 3671 (LDAP) or Radius server for authentication might use this 3672 response code when the LDAP/Radius server is down. 3674 C: a LOGIN "fred" "foo" 3675 S: a NO [UNAVAILABLE] User's backend down for maintenance 3677 UNSEEN Followed by a decimal number, indicates the number of the 3678 first message without the \Seen flag set. 3680 Additional response codes defined by particular client or server 3681 implementations SHOULD be prefixed with an "X" until they are added 3682 to a revision of this protocol. Client implementations SHOULD ignore 3683 response codes that they do not recognize. 3685 7.1.1. OK Response 3687 Contents: OPTIONAL response code 3688 human-readable text 3690 The OK response indicates an information message from the server. 3691 When tagged, it indicates successful completion of the associated 3692 command. The human-readable text MAY be presented to the user as an 3693 information message. The untagged form indicates an information-only 3694 message; the nature of the information MAY be indicated by a response 3695 code. 3697 The untagged form is also used as one of three possible greetings at 3698 connection startup. It indicates that the connection is not yet 3699 authenticated and that a LOGIN or an AUTHENTICATE command is needed. 3701 Example: S: * OK IMAP4rev2 server ready 3702 C: A001 LOGIN fred blurdybloop 3703 S: * OK [ALERT] System shutdown in 10 minutes 3704 S: A001 OK LOGIN Completed 3706 7.1.2. NO Response 3708 Contents: OPTIONAL response code 3709 human-readable text 3711 The NO response indicates an operational error message from the 3712 server. When tagged, it indicates unsuccessful completion of the 3713 associated command. The untagged form indicates a warning; the 3714 command can still complete successfully. The human-readable text 3715 describes the condition. 3717 Example: C: A222 COPY 1:2 owatagusiam 3718 S: * NO Disk is 98% full, please delete unnecessary data 3719 S: A222 OK COPY completed 3720 C: A223 COPY 3:200 blurdybloop 3721 S: * NO Disk is 98% full, please delete unnecessary data 3722 S: * NO Disk is 99% full, please delete unnecessary data 3723 S: A223 NO COPY failed: disk is full 3725 7.1.3. BAD Response 3727 Contents: OPTIONAL response code 3728 human-readable text 3730 The BAD response indicates an error message from the server. When 3731 tagged, it reports a protocol-level error in the client's command; 3732 the tag indicates the command that caused the error. The untagged 3733 form indicates a protocol-level error for which the associated 3734 command can not be determined; it can also indicate an internal 3735 server failure. The human-readable text describes the condition. 3737 Example: C: ...very long command line... 3738 S: * BAD Command line too long 3739 C: ...empty line... 3740 S: * BAD Empty command line 3741 C: A443 EXPUNGE 3742 S: * BAD Disk crash, attempting salvage to a new disk! 3743 S: * OK Salvage successful, no data lost 3744 S: A443 OK Expunge completed 3746 7.1.4. PREAUTH Response 3748 Contents: OPTIONAL response code 3749 human-readable text 3751 The PREAUTH response is always untagged, and is one of three possible 3752 greetings at connection startup. It indicates that the connection 3753 has already been authenticated by external means; thus no LOGIN/ 3754 AUTHENTICATE command is needed. 3756 Example: S: * PREAUTH IMAP4rev2 server logged in as Smith 3758 7.1.5. BYE Response 3760 Contents: OPTIONAL response code 3761 human-readable text 3763 The BYE response is always untagged, and indicates that the server is 3764 about to close the connection. The human-readable text MAY be 3765 displayed to the user in a status report by the client. The BYE 3766 response is sent under one of four conditions: 3768 1. as part of a normal logout sequence. The server will close the 3769 connection after sending the tagged OK response to the LOGOUT 3770 command. 3772 2. as a panic shutdown announcement. The server closes the 3773 connection immediately. 3775 3. as an announcement of an inactivity autologout. The server 3776 closes the connection immediately. 3778 4. as one of three possible greetings at connection startup, 3779 indicating that the server is not willing to accept a connection 3780 from this client. The server closes the connection immediately. 3782 The difference between a BYE that occurs as part of a normal LOGOUT 3783 sequence (the first case) and a BYE that occurs because of a failure 3784 (the other three cases) is that the connection closes immediately in 3785 the failure case. In all cases the client SHOULD continue to read 3786 response data from the server until the connection is closed; this 3787 will ensure that any pending untagged or completion responses are 3788 read and processed. 3790 Example: S: * BYE Autologout; idle for too long 3792 7.2. Server Responses - Server and Mailbox Status 3794 These responses are always untagged. This is how server and mailbox 3795 status data are transmitted from the server to the client. Many of 3796 these responses typically result from a command with the same name. 3798 7.2.1. The ENABLED Response 3800 Contents: capability listing 3802 The ENABLED response occurs as a result of an ENABLE command. The 3803 capability listing contains a space-separated listing of capability 3804 names that the server supports and that were successfully enabled. 3805 The ENABLED response may contain no capabilities, which means that no 3806 extensions listed by the client were successfully enabled. 3808 7.2.2. CAPABILITY Response 3810 Contents: capability listing 3812 The CAPABILITY response occurs as a result of a CAPABILITY command. 3813 The capability listing contains a space-separated listing of 3814 capability names that the server supports. The capability listing 3815 MUST include the atom "IMAP4rev2". 3817 In addition, client and server implementations MUST implement the 3818 STARTTLS, LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) 3819 capabilities. See the Security Considerations section for important 3820 information. 3822 A capability name which begins with "AUTH=" indicates that the server 3823 supports that particular authentication mechanism. 3825 The LOGINDISABLED capability indicates that the LOGIN command is 3826 disabled, and that the server will respond with a tagged NO response 3827 to any attempt to use the LOGIN command even if the user name and 3828 password are valid. An IMAP client MUST NOT issue the LOGIN command 3829 if the server advertises the LOGINDISABLED capability. 3831 Other capability names indicate that the server supports an 3832 extension, revision, or amendment to the IMAP4rev2 protocol. Server 3833 responses MUST conform to this document until the client issues a 3834 command that uses the associated capability. 3836 Capability names MUST either begin with "X" or be standard or 3837 standards-track IMAP4rev2 extensions, revisions, or amendments 3838 registered with IANA. A server MUST NOT offer unregistered or non- 3839 standard capability names, unless such names are prefixed with an 3840 "X". 3842 Client implementations SHOULD NOT require any capability name other 3843 than "IMAP4rev2", and MUST ignore any unknown capability names. 3845 A server MAY send capabilities automatically, by using the CAPABILITY 3846 response code in the initial PREAUTH or OK responses, and by sending 3847 an updated CAPABILITY response code in the tagged OK response as part 3848 of a successful authentication. It is unnecessary for a client to 3849 send a separate CAPABILITY command if it recognizes these automatic 3850 capabilities. 3852 Example: S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI XPIG-LATIN 3854 7.2.3. LIST Response 3856 Contents: name attributes 3857 hierarchy delimiter 3858 name 3860 The LIST response occurs as a result of a LIST command. It returns a 3861 single name that matches the LIST specification. There can be 3862 multiple LIST responses for a single LIST command. 3864 The following base name attributes are defined: 3866 \Noinferiors It is not possible for any child levels of hierarchy to 3867 exist under this name; no child levels exist now and none can be 3868 created in the future. 3870 \Noselect It is not possible to use this name as a selectable 3871 mailbox. 3873 \HasChildren The presence of this attribute indicates that the 3874 mailbox has child mailboxes. A server SHOULD NOT set this 3875 attribute if there are child mailboxes and the user does not have 3876 permission to access any of them. In this case, \HasNoChildren 3877 SHOULD be used. In many cases, however, a server may not be able 3878 to efficiently compute whether a user has access to any child 3879 mailbox. Note that even though the \HasChildren attribute for a 3880 mailbox must be correct at the time of processing of the mailbox, 3881 a client must be prepared to deal with a situation when a mailbox 3882 is marked with the \HasChildren attribute, but no child mailbox 3883 appears in the response to the LIST command. This might happen, 3884 for example, due to children mailboxes being deleted or made 3885 inaccessible to the user (using access control) by another client 3886 before the server is able to list them. 3888 \HasNoChildren The presence of this attribute indicates that the 3889 mailbox has NO child mailboxes that are accessible to the 3890 currently authenticated user. 3892 \Marked The mailbox has been marked "interesting" by the server; the 3893 mailbox probably contains messages that have been added since the 3894 last time the mailbox was selected. 3896 \Unmarked The mailbox does not contain any additional messages since 3897 the last time the mailbox was selected. 3899 It is an error for the server to return both a \HasChildren and a 3900 \HasNoChildren attribute in the same LIST response. 3902 Note: the \HasNoChildren attribute should not be confused with the 3903 \NoInferiors attribute, which indicates that no child mailboxes 3904 exist now and none can be created in the future. 3906 If it is not feasible for the server to determine whether or not the 3907 mailbox is "interesting", the server SHOULD NOT send either \Marked 3908 or \Unmarked. The server MUST NOT send more than one of \Marked, 3909 \Unmarked, and \Noselect for a single mailbox, and MAY send none of 3910 these. 3912 In addition to the base name attributes defined above, an IMAP server 3913 MAY also include any or all of the following attributes that denote 3914 "role" (or "special-use") of a mailbox. These attributes are 3915 included along with base attributes defined above. A given mailbox 3916 may have none, one, or more than one of these attributes. In some 3917 cases, a special use is advice to a client about what to put in that 3918 mailbox. In other cases, it's advice to a client about what to 3919 expect to find there. 3921 \All This mailbox presents all messages in the user's message store. 3922 Implementations MAY omit some messages, such as, perhaps, those in 3923 \Trash and \Junk. When this special use is supported, it is 3924 almost certain to represent a virtual mailbox. 3926 \Archive This mailbox is used to archive messages. The meaning of 3927 an "archival" mailbox is server-dependent; typically, it will be 3928 used to get messages out of the inbox, or otherwise keep them out 3929 of the user's way, while still making them accessible. 3931 \Drafts This mailbox is used to hold draft messages -- typically, 3932 messages that are being composed but have not yet been sent. In 3933 some server implementations, this might be a virtual mailbox, 3934 containing messages from other mailboxes that are marked with the 3935 "\Draft" message flag. Alternatively, this might just be advice 3936 that a client put drafts here. 3938 \Flagged This mailbox presents all messages marked in some way as 3939 "important". When this special use is supported, it is likely to 3940 represent a virtual mailbox collecting messages (from other 3941 mailboxes) that are marked with the "\Flagged" message flag. 3943 \Junk This mailbox is where messages deemed to be junk mail are 3944 held. Some server implementations might put messages here 3945 automatically. Alternatively, this might just be advice to a 3946 client-side spam filter. 3948 \Sent This mailbox is used to hold copies of messages that have been 3949 sent. Some server implementations might put messages here 3950 automatically. Alternatively, this might just be advice that a 3951 client save sent messages here. 3953 \Trash This mailbox is used to hold messages that have been deleted 3954 or marked for deletion. In some server implementations, this 3955 might be a virtual mailbox, containing messages from other 3956 mailboxes that are marked with the "\Deleted" message flag. 3957 Alternatively, this might just be advice that a client that 3958 chooses not to use the IMAP "\Deleted" model should use this as 3959 its trash location. In server implementations that strictly 3960 expect the IMAP "\Deleted" model, this special use is likely not 3961 to be supported. 3963 All of special-use attributes are OPTIONAL, and any given server or 3964 message store may support any combination of the attributes, or none 3965 at all. In most cases, there will likely be at most one mailbox with 3966 a given attribute for a given user, but in some server or message 3967 store implementations it might be possible for multiple mailboxes to 3968 have the same special-use attribute. 3970 Special-use attributes are likely to be user-specific. User Adam 3971 might share his \Sent mailbox with user Barb, but that mailbox is 3972 unlikely to also serve as Barb's \Sent mailbox. 3974 The hierarchy delimiter is a character used to delimit levels of 3975 hierarchy in a mailbox name. A client can use it to create child 3976 mailboxes, and to search higher or lower levels of naming hierarchy. 3977 All children of a top-level hierarchy node MUST use the same 3978 separator character. A NIL hierarchy delimiter means that no 3979 hierarchy exists; the name is a "flat" name. 3981 The name represents an unambiguous left-to-right hierarchy, and MUST 3982 be valid for use as a reference in LIST and LSUB commands. Unless 3983 \Noselect is indicated, the name MUST also be valid as an argument 3984 for commands, such as SELECT, that accept mailbox names. 3986 Example: S: * LIST (\Noselect) "/" ~/Mail/foo 3988 7.2.4. LSUB Response 3990 Contents: name attributes 3991 hierarchy delimiter 3992 name 3994 The LSUB response occurs as a result of an LSUB command. It returns 3995 a single name that matches the LSUB specification. There can be 3996 multiple LSUB responses for a single LSUB command. The data is 3997 identical in format to the LIST response. 3999 Example: S: * LSUB () "." #news.comp.mail.misc 4001 7.2.5. NAMESPACE Response 4003 Contents: the prefix and hierarchy delimiter to the server's 4004 Personal Namespace(s), Other Users' Namespace(s), and 4005 Shared Namespace(s) 4007 The NAMESPACE response occurs as a result of a NAMESPACE command. It 4008 contains the prefix and hierarchy delimiter to the server's Personal 4009 Namespace(s), Other Users' Namespace(s), and Shared Namespace(s) that 4010 the server wishes to expose. The response will contain a NIL for any 4011 namespace class that is not available. Namespace_Response_Extensions 4012 MAY be included in the response. Namespace_Response_Extensions which 4013 are not on the IETF standards track, MUST be prefixed with an "X-". 4015 Example: S: * NAMESPACE (("" "/")) (("~" "/")) NIL 4017 7.2.6. STATUS Response 4019 Contents: name 4020 status parenthesized list 4022 The STATUS response occurs as a result of an STATUS command. It 4023 returns the mailbox name that matches the STATUS specification and 4024 the requested mailbox status information. 4026 Example: S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 4028 7.2.7. ESEARCH Response 4030 Contents: one or more search-return-data pairs 4032 The ESEARCH response occurs as a result of a SEARCH or UID SEARCH 4033 command. 4035 The ESEARCH response starts with an optional search correlator. If 4036 it is missing, then the response was not caused by a particular IMAP 4037 command, whereas if it is present, it contains the tag of the command 4038 that caused the response to be returned. 4040 The search correlator is followed by an optional UID indicator. If 4041 this indicator is present, all data in the ESEARCH response refers to 4042 UIDs, otherwise all returned data refers to message numbers. 4044 The rest of the ESEARCH response contains one or more search data 4045 pairs. Each pair starts with unique return item name, followed by a 4046 space and the corresponding data. Search data pairs may be returned 4047 in any order. Unless specified otherwise by an extension, any return 4048 item name SHOULD appear only once in an ESEARCH response. 4050 [[TBD: describe the most common search data pairs returned.]] 4052 Example: S: * ESEARCH UID COUNT 5 ALL 4:19,21,28 4054 Example: S: * ESEARCH (TAG "a567") UID COUNT 5 ALL 4:19,21,28 4056 Example: S: * ESEARCH COUNT 5 ALL 1:17,21 4058 7.2.8. FLAGS Response 4060 Contents: flag parenthesized list 4062 The FLAGS response occurs as a result of a SELECT or EXAMINE command. 4063 The flag parenthesized list identifies the flags (at a minimum, the 4064 system-defined flags) that are applicable for this mailbox. Flags 4065 other than the system flags can also exist, depending on server 4066 implementation. 4068 The update from the FLAGS response MUST be recorded by the client. 4070 Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4072 7.3. Server Responses - Mailbox Size 4074 These responses are always untagged. This is how changes in the size 4075 of the mailbox are transmitted from the server to the client. 4076 Immediately following the "*" token is a number that represents a 4077 message count. 4079 7.3.1. EXISTS Response 4081 Contents: none 4083 The EXISTS response reports the number of messages in the mailbox. 4084 This response occurs as a result of a SELECT or EXAMINE command, and 4085 if the size of the mailbox changes (e.g., new messages). 4087 The update from the EXISTS response MUST be recorded by the client. 4089 Example: S: * 23 EXISTS 4091 7.3.2. RECENT Response 4093 Contents: none 4095 The RECENT response reports the number of messages with the \Recent 4096 flag set. This response occurs as a result of a SELECT or EXAMINE 4097 command, and if the size of the mailbox changes (e.g., new messages). 4099 Note: It is not guaranteed that the message sequence numbers of 4100 recent messages will be a contiguous range of the highest n 4101 messages in the mailbox (where n is the value reported by the 4102 RECENT response). Examples of situations in which this is not the 4103 case are: multiple clients having the same mailbox open (the first 4104 session to be notified will see it as recent, others will probably 4105 see it as non-recent), and when the mailbox is re-ordered by a 4106 non-IMAP agent. 4108 The only reliable way to identify recent messages is to look at 4109 message flags to see which have the \Recent flag set, or to do a 4110 SEARCH RECENT. 4112 The update from the RECENT response MUST be recorded by the client. 4114 Example: S: * 5 RECENT 4116 7.4. Server Responses - Message Status 4118 These responses are always untagged. This is how message data are 4119 transmitted from the server to the client, often as a result of a 4120 command with the same name. Immediately following the "*" token is a 4121 number that represents a message sequence number. 4123 7.4.1. EXPUNGE Response 4125 Contents: none 4127 The EXPUNGE response reports that the specified message sequence 4128 number has been permanently removed from the mailbox. The message 4129 sequence number for each successive message in the mailbox is 4130 immediately decremented by 1, and this decrement is reflected in 4131 message sequence numbers in subsequent responses (including other 4132 untagged EXPUNGE responses). 4134 The EXPUNGE response also decrements the number of messages in the 4135 mailbox; it is not necessary to send an EXISTS response with the new 4136 value. 4138 As a result of the immediate decrement rule, message sequence numbers 4139 that appear in a set of successive EXPUNGE responses depend upon 4140 whether the messages are removed starting from lower numbers to 4141 higher numbers, or from higher numbers to lower numbers. For 4142 example, if the last 5 messages in a 9-message mailbox are expunged, 4143 a "lower to higher" server will send five untagged EXPUNGE responses 4144 for message sequence number 5, whereas a "higher to lower server" 4145 will send successive untagged EXPUNGE responses for message sequence 4146 numbers 9, 8, 7, 6, and 5. 4148 An EXPUNGE response MUST NOT be sent when no command is in progress, 4149 nor while responding to a FETCH, STORE, or SEARCH command. This rule 4150 is necessary to prevent a loss of synchronization of message sequence 4151 numbers between client and server. A command is not "in progress" 4152 until the complete command has been received; in particular, a 4153 command is not "in progress" during the negotiation of command 4154 continuation. 4156 Note: UID FETCH, UID STORE, and UID SEARCH are different commands 4157 from FETCH, STORE, and SEARCH. An EXPUNGE response MAY be sent 4158 during a UID command. 4160 The update from the EXPUNGE response MUST be recorded by the client. 4162 Example: S: * 44 EXPUNGE 4164 7.4.2. FETCH Response 4166 Contents: message data 4168 The FETCH response returns data about a message to the client. The 4169 data are pairs of data item names and their values in parentheses. 4170 This response occurs as the result of a FETCH or STORE command, as 4171 well as by unilateral server decision (e.g., flag updates). 4173 The current data items are: 4175 BODY A form of BODYSTRUCTURE without extension data. 4177 BODY[
]<> 4179 A string expressing the body contents of the specified section. 4180 The string SHOULD be interpreted by the client according to the 4181 content transfer encoding, body type, and subtype. 4183 If the origin octet is specified, this string is a substring of 4184 the entire body contents, starting at that origin octet. This 4185 means that BODY[]<0> MAY be truncated, but BODY[] is NEVER 4186 truncated. 4188 Note: The origin octet facility MUST NOT be used by a server 4189 in a FETCH response unless the client specifically requested 4190 it by means of a FETCH of a BODY[
]<> data 4191 item. 4193 8-bit textual data is permitted if a [CHARSET] identifier is 4194 part of the body parameter parenthesized list for this section. 4195 Note that headers (part specifiers HEADER or MIME, or the 4196 header portion of a MESSAGE/RFC822 or MESSAGE/GLOBAL part), MAY 4197 be in UTF-8. Note also that the [RFC-5322] delimiting blank 4198 line between the header and the body is not affected by header 4199 line subsetting; the blank line is always included as part of 4200 header data, except in the case of a message which has no body 4201 and no blank line. 4203 Non-textual data such as binary data MUST be transfer encoded 4204 into a textual form, such as BASE64, prior to being sent to the 4205 client. To derive the original binary data, the client MUST 4206 decode the transfer encoded string. 4208 BODYSTRUCTURE 4210 A parenthesized list that describes the [MIME-IMB] body 4211 structure of a message. This is computed by the server by 4212 parsing the [MIME-IMB] header fields, defaulting various fields 4213 as necessary. 4215 For example, a simple text message of 48 lines and 2279 octets 4216 can have a body structure of: ("TEXT" "PLAIN" ("CHARSET" "US- 4217 ASCII") NIL NIL "7BIT" 2279 48) 4219 Multiple parts are indicated by parenthesis nesting. Instead 4220 of a body type as the first element of the parenthesized list, 4221 there is a sequence of one or more nested body structures. The 4222 second element of the parenthesized list is the multipart 4223 subtype (mixed, digest, parallel, alternative, etc.). 4225 For example, a two part message consisting of a text and a 4226 BASE64-encoded text attachment can have a body structure of: 4227 (("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1152 4228 23)("TEXT" "PLAIN" ("CHARSET" "US-ASCII" "NAME" "cc.diff") 4229 "<960723163407.20117h@cac.washington.edu>" "Compiler diff" 4230 "BASE64" 4554 73) "MIXED") 4232 Extension data follows the multipart subtype. Extension data 4233 is never returned with the BODY fetch, but can be returned with 4234 a BODYSTRUCTURE fetch. Extension data, if present, MUST be in 4235 the defined order. The extension data of a multipart body part 4236 are in the following order: 4238 body parameter parenthesized list A parenthesized list of 4239 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4240 "bar" is the value of "foo", and "rag" is the value of 4241 "baz"] as defined in [MIME-IMB]. 4243 body disposition A parenthesized list, consisting of a 4244 disposition type string, followed by a parenthesized list of 4245 disposition attribute/value pairs as defined in 4246 [DISPOSITION]. 4248 body language A string or parenthesized list giving the body 4249 language value as defined in [LANGUAGE-TAGS]. 4251 body location A string giving the body content URI as defined 4252 in [LOCATION]. 4254 Any following extension data are not yet defined in this 4255 version of the protocol. Such extension data can consist of 4256 zero or more NILs, strings, numbers, or potentially nested 4257 parenthesized lists of such data. Client implementations that 4258 do a BODYSTRUCTURE fetch MUST be prepared to accept such 4259 extension data. Server implementations MUST NOT send such 4260 extension data until it has been defined by a revision of this 4261 protocol. 4263 The basic fields of a non-multipart body part are in the 4264 following order: 4266 body type A string giving the content media type name as 4267 defined in [MIME-IMB]. 4269 body subtype A string giving the content subtype name as 4270 defined in [MIME-IMB]. 4272 body parameter parenthesized list A parenthesized list of 4273 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 4274 "bar" is the value of "foo" and "rag" is the value of "baz"] 4275 as defined in [MIME-IMB]. 4277 body id A string giving the content id as defined in 4278 [MIME-IMB]. 4280 body description A string giving the content description as 4281 defined in [MIME-IMB]. 4283 body encoding A string giving the content transfer encoding as 4284 defined in [MIME-IMB]. 4286 body size A number giving the size of the body in octets. 4287 Note that this size is the size in its transfer encoding and 4288 not the resulting size after any decoding. 4290 A body type of type MESSAGE and subtype RFC822 contains, 4291 immediately after the basic fields, the envelope structure, 4292 body structure, and size in text lines of the encapsulated 4293 message. 4295 A body type of type TEXT contains, immediately after the basic 4296 fields, the size of the body in text lines. Note that this 4297 size is the size in its content transfer encoding and not the 4298 resulting size after any decoding. 4300 Extension data follows the basic fields and the type-specific 4301 fields listed above. Extension data is never returned with the 4302 BODY fetch, but can be returned with a BODYSTRUCTURE fetch. 4303 Extension data, if present, MUST be in the defined order. 4305 The extension data of a non-multipart body part are in the 4306 following order: 4308 body MD5 A string giving the body MD5 value as defined in 4309 [MD5]. 4311 body disposition A parenthesized list with the same content 4312 and function as the body disposition for a multipart body 4313 part. 4315 body language A string or parenthesized list giving the body 4316 language value as defined in [LANGUAGE-TAGS]. 4318 body location A string giving the body content URI as defined 4319 in [LOCATION]. 4321 Any following extension data are not yet defined in this 4322 version of the protocol, and would be as described above under 4323 multipart extension data. 4325 ENVELOPE 4327 A parenthesized list that describes the envelope structure of a 4328 message. This is computed by the server by parsing the 4329 [RFC-5322] header into the component parts, defaulting various 4330 fields as necessary. 4332 The fields of the envelope structure are in the following 4333 order: date, subject, from, sender, reply-to, to, cc, bcc, in- 4334 reply-to, and message-id. The date, subject, in-reply-to, and 4335 message-id fields are strings. The from, sender, reply-to, to, 4336 cc, and bcc fields are parenthesized lists of address 4337 structures. 4339 An address structure is a parenthesized list that describes an 4340 electronic mail address. The fields of an address structure 4341 are in the following order: personal name, [SMTP] at-domain- 4342 list (source route), mailbox name, and host name. 4344 [RFC-5322] group syntax is indicated by a special form of 4345 address structure in which the host name field is NIL. If the 4346 mailbox name field is also NIL, this is an end of group marker 4347 (semi-colon in RFC 822 syntax). If the mailbox name field is 4348 non-NIL, this is a start of group marker, and the mailbox name 4349 field holds the group name phrase. 4351 If the Date, Subject, In-Reply-To, and Message-ID header lines 4352 are absent in the [RFC-5322] header, the corresponding member 4353 of the envelope is NIL; if these header lines are present but 4354 empty the corresponding member of the envelope is the empty 4355 string. 4357 Note: some servers may return a NIL envelope member in the 4358 "present but empty" case. Clients SHOULD treat NIL and 4359 empty string as identical. 4361 Note: [RFC-5322] requires that all messages have a valid 4362 Date header. Therefore, the date member in the envelope can 4363 not be NIL or the empty string. 4365 Note: [RFC-5322] requires that the In-Reply-To and Message- 4366 ID headers, if present, have non-empty content. Therefore, 4367 the in-reply-to and message-id members in the envelope can 4368 not be the empty string. 4370 If the From, To, Cc, and Bcc header lines are absent in the 4371 [RFC-5322] header, or are present but empty, the corresponding 4372 member of the envelope is NIL. 4374 If the Sender or Reply-To lines are absent in the [RFC-5322] 4375 header, or are present but empty, the server sets the 4376 corresponding member of the envelope to be the same value as 4377 the from member (the client is not expected to know to do 4378 this). 4380 Note: [RFC-5322] requires that all messages have a valid 4381 From header. Therefore, the from, sender, and reply-to 4382 members in the envelope can not be NIL. 4384 FLAGS A parenthesized list of flags that are set for this message. 4386 INTERNALDATE A string representing the internal date of the message. 4388 RFC822 Equivalent to BODY[]. 4390 RFC822.HEADER Equivalent to BODY[HEADER]. Note that this did not 4391 result in \Seen being set, because RFC822.HEADER response data 4392 occurs as a result of a FETCH of RFC822.HEADER. BODY[HEADER] 4393 response data occurs as a result of a FETCH of BODY[HEADER] (which 4394 sets \Seen) or BODY.PEEK[HEADER] (which does not set \Seen). 4396 RFC822.SIZE A number expressing the [RFC-5322] size of the message. 4398 RFC822.TEXT Equivalent to BODY[TEXT]. 4400 UID A number expressing the unique identifier of the message. 4402 Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827) 4404 7.5. Server Responses - Command Continuation Request 4406 The command continuation request response is indicated by a "+" token 4407 instead of a tag. This form of response indicates that the server is 4408 ready to accept the continuation of a command from the client. The 4409 remainder of this response is a line of text. 4411 This response is used in the AUTHENTICATE command to transmit server 4412 data to the client, and request additional client data. This 4413 response is also used if an argument to any command is a 4414 synchronizing literal. 4416 The client is not permitted to send the octets of the synchronizing 4417 literal unless the server indicates that it is expected. This 4418 permits the server to process commands and reject errors on a line- 4419 by-line basis. The remainder of the command, including the CRLF that 4420 terminates a command, follows the octets of the literal. If there 4421 are any additional command arguments, the literal octets are followed 4422 by a space and those arguments. 4424 Example: C: A001 LOGIN {11} 4425 S: + Ready for additional command text 4426 C: FRED FOOBAR {7} 4427 S: + Ready for additional command text 4428 C: fat man 4429 S: A001 OK LOGIN completed 4430 C: A044 BLURDYBLOOP {102856} 4431 S: A044 BAD No such command as "BLURDYBLOOP" 4433 8. Sample IMAP4rev2 connection 4435 The following is a transcript of an IMAP4rev2 connection. A long 4436 line in this sample is broken for editorial clarity. 4438 S: * OK IMAP4rev2 Service Ready 4439 C: a001 login mrc secret 4440 S: a001 OK LOGIN completed 4441 C: a002 select inbox 4442 S: * 18 EXISTS 4443 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 4444 S: * 2 RECENT 4445 S: * OK [UNSEEN 17] Message 17 is the first unseen message 4446 S: * OK [UIDVALIDITY 3857529045] UIDs valid 4447 S: a002 OK [READ-WRITE] SELECT completed 4448 C: a003 fetch 12 full 4449 S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" 4450 RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" 4451 "IMAP4rev2 WG mtg summary and minutes" 4452 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4453 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4454 (("Terry Gray" NIL "gray" "cac.washington.edu")) 4455 ((NIL NIL "imap" "cac.washington.edu")) 4456 ((NIL NIL "minutes" "CNRI.Reston.VA.US") 4457 ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL 4458 "") 4459 BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 4460 92)) 4461 S: a003 OK FETCH completed 4462 C: a004 fetch 12 body[header] 4463 S: * 12 FETCH (BODY[HEADER] {342} 4464 S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT) 4465 S: From: Terry Gray 4466 S: Subject: IMAP4rev2 WG mtg summary and minutes 4467 S: To: imap@cac.washington.edu 4468 S: cc: minutes@CNRI.Reston.VA.US, John Klensin 4469 S: Message-Id: 4470 S: MIME-Version: 1.0 4471 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 4472 S: 4473 S: ) 4474 S: a004 OK FETCH completed 4475 C: a005 store 12 +flags \deleted 4476 S: * 12 FETCH (FLAGS (\Seen \Deleted)) 4477 S: a005 OK +FLAGS completed 4478 C: a006 logout 4479 S: * BYE IMAP4rev2 server terminating connection 4480 S: a006 OK LOGOUT completed 4481 9. Formal Syntax 4483 The following syntax specification uses the Augmented Backus-Naur 4484 Form (ABNF) notation as specified in [ABNF]. 4486 In the case of alternative or optional rules in which a later rule 4487 overlaps an earlier rule, the rule which is listed earlier MUST take 4488 priority. For example, "\Seen" when parsed as a flag is the \Seen 4489 flag name and not a flag-extension, even though "\Seen" can be parsed 4490 as a flag-extension. Some, but not all, instances of this rule are 4491 noted below. 4493 Note: [ABNF] rules MUST be followed strictly; in particular: 4495 (1) Except as noted otherwise, all alphabetic characters are case- 4496 insensitive. The use of upper or lower case characters to define 4497 token strings is for editorial clarity only. Implementations MUST 4498 accept these strings in a case-insensitive fashion. 4500 (2) In all cases, SP refers to exactly one space. It is NOT 4501 permitted to substitute TAB, insert additional spaces, or 4502 otherwise treat SP as being equivalent to LWSP. 4504 (3) The ASCII NUL character, %x00, MUST NOT be used at any time. 4506 address = "(" addr-name SP addr-adl SP addr-mailbox SP 4507 addr-host ")" 4509 addr-adl = nstring 4510 ; Holds route from [RFC-5322] route-addr if 4511 ; non-NIL 4513 addr-host = nstring 4514 ; NIL indicates [RFC-5322] group syntax. 4515 ; Otherwise, holds [RFC-5322] domain name 4517 addr-mailbox = nstring 4518 ; NIL indicates end of [RFC-5322] group; if 4519 ; non-NIL and addr-host is NIL, holds 4520 ; [RFC-5322] group name. 4521 ; Otherwise, holds [RFC-5322] local-part 4522 ; after removing [RFC-5322] quoting 4524 addr-name = nstring 4525 ; If non-NIL, holds phrase from [RFC-5322] 4526 ; mailbox after removing [RFC-5322] quoting 4528 append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP 4529 literal 4531 append-uid = uniqueid 4533 astring = 1*ASTRING-CHAR / string 4535 ASTRING-CHAR = ATOM-CHAR / resp-specials 4537 atom = 1*ATOM-CHAR 4539 ATOM-CHAR = 4541 atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / 4542 quoted-specials / resp-specials 4544 authenticate = "AUTHENTICATE" SP auth-type [SP initial-resp] 4545 *(CRLF base64) 4547 auth-type = atom 4548 ; Defined by [SASL] 4550 base64 = *(4base64-char) [base64-terminal] 4552 base64-char = ALPHA / DIGIT / "+" / "/" 4553 ; Case-sensitive 4555 base64-terminal = (2base64-char "==") / (3base64-char "=") 4557 body = "(" (body-type-1part / body-type-mpart) ")" 4559 body-extension = nstring / number / 4560 "(" body-extension *(SP body-extension) ")" 4561 ; Future expansion. Client implementations 4562 ; MUST accept body-extension fields. Server 4563 ; implementations MUST NOT generate 4564 ; body-extension fields except as defined by 4565 ; future standard or standards-track 4566 ; revisions of this specification. 4568 body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang 4569 [SP body-fld-loc *(SP body-extension)]]] 4570 ; MUST NOT be returned on non-extensible 4571 ; "BODY" fetch 4573 body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang 4574 [SP body-fld-loc *(SP body-extension)]]] 4575 ; MUST NOT be returned on non-extensible 4576 ; "BODY" fetch 4578 body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP 4579 body-fld-enc SP body-fld-octets 4581 body-fld-desc = nstring 4583 body-fld-dsp = "(" string SP body-fld-param ")" / nil 4585 body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ 4586 "QUOTED-PRINTABLE") DQUOTE) / string 4588 body-fld-id = nstring 4590 body-fld-lang = nstring / "(" string *(SP string) ")" 4592 body-fld-loc = nstring 4594 body-fld-lines = number 4596 body-fld-md5 = nstring 4598 body-fld-octets = number 4600 body-fld-param = "(" string SP string *(SP string SP string) ")" / nil 4602 body-type-1part = (body-type-basic / body-type-msg / body-type-text) 4603 [SP body-ext-1part] 4605 body-type-basic = media-basic SP body-fields 4606 ; MESSAGE subtype MUST NOT be "RFC822" or "GLOBAL" 4608 body-type-mpart = 1*body SP media-subtype 4609 [SP body-ext-mpart] 4610 ; MULTIPART body part 4612 body-type-msg = media-message SP body-fields SP envelope 4613 SP body SP body-fld-lines 4615 body-type-text = media-text SP body-fields SP body-fld-lines 4617 capability = ("AUTH=" auth-type) / atom 4618 ; New capabilities MUST begin with "X" or be 4619 ; registered with IANA as standard or 4620 ; standards-track 4622 capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev2" 4623 *(SP capability) 4624 ; Servers MUST implement the STARTTLS, AUTH=PLAIN, 4625 ; and LOGINDISABLED capabilities 4626 ; Servers which offer RFC 1730 compatibility MUST 4627 ; list "IMAP4" as the first capability. 4629 CHAR8 = %x01-ff 4630 ; any OCTET except NUL, %x00 4632 charset = atom / quoted 4634 command = tag SP (command-any / command-auth / command-nonauth / 4635 command-select) CRLF 4636 ; Modal based on state 4638 command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / enable / x-command 4639 ; Valid in all states 4641 command-auth = append / create / delete / examine / list / lsub / 4642 Namespace-Command / 4643 rename / select / status / subscribe / unsubscribe / 4644 idle 4645 ; Valid only in Authenticated or Selected state 4647 command-nonauth = login / authenticate / "STARTTLS" 4648 ; Valid only when in Not Authenticated state 4650 command-select = "CHECK" / "CLOSE" / "UNSELECT" / "EXPUNGE" / copy / 4651 fetch / store / search / uid 4652 ; Valid only when in Selected state 4654 continue-req = "+" SP (resp-text / base64) CRLF 4656 copy = "COPY" SP sequence-set SP mailbox 4658 create = "CREATE" SP mailbox 4659 ; Use of INBOX gives a NO error 4661 date = date-text / DQUOTE date-text DQUOTE 4663 date-day = 1*2DIGIT 4664 ; Day of month 4666 date-day-fixed = (SP DIGIT) / 2DIGIT 4667 ; Fixed-format version of date-day 4669 date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / 4670 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" 4672 date-text = date-day "-" date-month "-" date-year 4673 date-year = 4DIGIT 4675 date-time = DQUOTE date-day-fixed "-" date-month "-" date-year 4676 SP time SP zone DQUOTE 4678 delete = "DELETE" SP mailbox 4679 ; Use of INBOX gives a NO error 4681 digit-nz = %x31-39 4682 ; 1-9 4684 enable = "ENABLE" 1*(SP capability) 4686 enable-data = "ENABLED" *(SP capability) 4688 envelope = "(" env-date SP env-subject SP env-from SP 4689 env-sender SP env-reply-to SP env-to SP env-cc SP 4690 env-bcc SP env-in-reply-to SP env-message-id ")" 4692 env-bcc = "(" 1*address ")" / nil 4694 env-cc = "(" 1*address ")" / nil 4696 env-date = nstring 4698 env-from = "(" 1*address ")" / nil 4700 env-in-reply-to = nstring 4702 env-message-id = nstring 4704 env-reply-to = "(" 1*address ")" / nil 4706 env-sender = "(" 1*address ")" / nil 4708 env-subject = nstring 4710 env-to = "(" 1*address ")" / nil 4712 esearch-response = "ESEARCH" [search-correlator] [SP "UID"] 4713 *(SP search-return-data) 4714 ; ESEARCH response replaces SEARCH response 4715 ; from IMAP4rev1. 4717 examine = "EXAMINE" SP mailbox 4719 fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" / 4720 fetch-att / "(" fetch-att *(SP fetch-att) ")") 4722 fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" / 4723 "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] / 4724 "BODY" ["STRUCTURE"] / "UID" / 4725 "BODY" section [partial] / 4726 "BODY.PEEK" section [partial] 4728 flag = "\Answered" / "\Flagged" / "\Deleted" / 4729 "\Seen" / "\Draft" / flag-keyword / flag-extension 4730 ; Does not include "\Recent" 4732 flag-extension = "\" atom 4733 ; Future expansion. Client implementations 4734 ; MUST accept flag-extension flags. Server 4735 ; implementations MUST NOT generate 4736 ; flag-extension flags except as defined by 4737 ; future standard or standards-track 4738 ; revisions of this specification. 4740 flag-fetch = flag / "\Recent" 4742 flag-keyword = "$MDNSent" / "$Forwarded" / atom 4744 flag-list = "(" [flag *(SP flag)] ")" 4746 flag-perm = flag / "\*" 4748 greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF 4750 header-fld-name = astring 4752 header-list = "(" header-fld-name *(SP header-fld-name) ")" 4754 idle = "IDLE" CRLF "DONE" 4756 initial-resp = (base64 / "=") 4757 ; "initial response" defined in 4758 ; Section 5.1 of [RFC4422] 4760 list = "LIST" SP mailbox SP list-mailbox 4762 list-mailbox = 1*list-char / string 4764 list-char = ATOM-CHAR / list-wildcards / resp-specials 4766 list-wildcards = "%" / "*" 4768 literal = "{" number ["+"] "}" CRLF *CHAR8 4769 ; Number represents the number of CHAR8s. 4771 ; A non-synchronizing literal is distinguished 4772 ; from a synchronizing literal by presence of the "+" 4773 ; before the closing "}". 4774 ; Non synchronizing literals are not allowed when sent 4775 ; from server to the client. 4777 login = "LOGIN" SP userid SP password 4779 lsub = "LSUB" SP mailbox SP list-mailbox 4781 mailbox = "INBOX" / astring 4782 ; INBOX is case-insensitive. All case variants of 4783 ; INBOX (e.g., "iNbOx") MUST be interpreted as INBOX 4784 ; not as an astring. An astring which consists of 4785 ; the case-insensitive sequence "I" "N" "B" "O" "X" 4786 ; is considered to be INBOX and not an astring. 4787 ; Refer to section 5.1 for further 4788 ; semantic details of mailbox names. 4790 mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list / 4791 "LSUB" SP mailbox-list / esearch-response / 4792 "STATUS" SP mailbox SP "(" [status-att-list] ")" / 4793 number SP "EXISTS" / number SP "RECENT" / 4794 Namespace-Response 4796 mailbox-list = "(" [mbx-list-flags] ")" SP 4797 (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox 4799 mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag 4800 *(SP mbx-list-oflag) / 4801 mbx-list-oflag *(SP mbx-list-oflag) 4803 mbx-list-oflag = "\Noinferiors" / flag-extension 4804 ; Other flags; multiple possible per LIST response 4806 mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked" 4807 ; Selectability flags; only one per LIST response 4809 media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / 4810 "MESSAGE" / "VIDEO" / "FONT") DQUOTE) / string) SP 4811 media-subtype 4812 ; Defined in [MIME-IMT]. 4813 ; FONT defined in RFC YYYY. 4815 media-message = DQUOTE "MESSAGE" DQUOTE SP DQUOTE ("RFC822" / "GLOBAL") DQUOTE 4816 ; Defined in [MIME-IMT] 4818 media-subtype = string 4819 ; Defined in [MIME-IMT] 4821 media-text = DQUOTE "TEXT" DQUOTE SP media-subtype 4822 ; Defined in [MIME-IMT] 4824 message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) 4826 msg-att = "(" (msg-att-dynamic / msg-att-static) 4827 *(SP (msg-att-dynamic / msg-att-static)) ")" 4829 msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")" 4830 ; MAY change for a message 4832 msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time / 4833 "RFC822" [".HEADER" / ".TEXT"] SP nstring / 4834 "RFC822.SIZE" SP number / 4835 "BODY" ["STRUCTURE"] SP body / 4836 "BODY" section ["<" number ">"] SP nstring / 4837 "UID" SP uniqueid 4838 ; MUST NOT change for a message 4840 Namespace = nil / "(" 1*Namespace-Descr ")" 4842 Namespace-Command = "NAMESPACE" 4844 Namespace-Descr = "(" string SP 4845 (DQUOTE QUOTED-CHAR DQUOTE / nil) 4846 *(Namespace-Response-Extension) ")" 4848 Namespace-Response-Extension = SP string SP 4849 "(" string *(SP string) ")" 4851 Namespace-Response = "NAMESPACE" SP Namespace 4852 SP Namespace SP Namespace 4853 ; The first Namespace is the Personal Namespace(s) 4854 ; The second Namespace is the Other Users' Namespace(s) 4855 ; The third Namespace is the Shared Namespace(s) 4857 nil = "NIL" 4859 nstring = string / nil 4861 number = 1*DIGIT 4862 ; Unsigned 32-bit integer 4863 ; (0 <= n < 4,294,967,296) 4865 number64 = 1*DIGIT 4866 ; Unsigned 63-bit integer 4867 ; (0 <= n <= 9,223,372,036,854,775,807) 4869 nz-number = digit-nz *DIGIT 4870 ; Non-zero unsigned 32-bit integer 4871 ; (0 < n < 4,294,967,296) 4873 password = astring 4875 partial-range = number ["." nz-number] 4876 ; Copied from RFC 5092 (IMAP URL) 4878 partial = "<" number "." nz-number ">" 4879 ; Partial FETCH request. 0-based offset of 4880 ; the first octet, followed by the number of octets 4881 ; in the fragment. 4883 quoted = DQUOTE *QUOTED-CHAR DQUOTE 4885 QUOTED-CHAR = / 4886 "\" quoted-specials / UTF8-2 / UTF8-3 / UTF8-4 4888 quoted-specials = DQUOTE / "\" 4890 rename = "RENAME" SP mailbox SP mailbox 4891 ; Use of INBOX as a destination gives a NO error 4893 response = *(continue-req / response-data) response-done 4895 response-data = "*" SP (resp-cond-state / resp-cond-bye / 4896 mailbox-data / message-data / capability-data / 4897 enable-data) CRLF 4899 response-done = response-tagged / response-fatal 4901 response-fatal = "*" SP resp-cond-bye CRLF 4902 ; Server closes connection immediately 4904 response-tagged = tag SP resp-cond-state CRLF 4906 resp-code-apnd = "APPENDUID" SP nz-number SP append-uid 4908 resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set 4910 resp-cond-auth = ("OK" / "PREAUTH") SP resp-text 4911 ; Authentication condition 4913 resp-cond-bye = "BYE" SP resp-text 4914 resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text 4915 ; Status condition 4917 resp-specials = "]" 4919 ;; ////Can we make "text" optional? Will this have any bad side effects? 4920 resp-text = ["[" resp-text-code "]" SP] text 4922 resp-text-code = "ALERT" / 4923 "BADCHARSET" [SP "(" charset *(SP charset) ")" ] / 4924 capability-data / "PARSE" / 4925 "PERMANENTFLAGS" SP "(" 4926 [flag-perm *(SP flag-perm)] ")" / 4927 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / 4928 "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number / 4929 "UNSEEN" SP nz-number / 4930 resp-code-apnd / resp-code-copy / "UIDNOTSTICKY" / 4931 "UNAVAILABLE" / "AUTHENTICATIONFAILED" / 4932 "AUTHORIZATIONFAILED" / "EXPIRED" / 4933 "PRIVACYREQUIRED" / "CONTACTADMIN" / "NOPERM" / 4934 "INUSE" / "EXPUNGEISSUED" / "CORRUPTION" / 4935 "SERVERBUG" / "CLIENTBUG" / "CANNOT" / 4936 "LIMIT" / "OVERQUOTA" / "ALREADYEXISTS" / 4937 "NONEXISTENT" / 4938 "CLOSED" / 4939 atom [SP 1*] 4941 search = "SEARCH" [search-return-opts] 4942 SP search-program 4944 search-correlator = SP "(" "TAG" SP tag-string ")" 4946 search-key = "ALL" / "ANSWERED" / "BCC" SP astring / 4947 "BEFORE" SP date / "BODY" SP astring / 4948 "CC" SP astring / "DELETED" / "FLAGGED" / 4949 "FROM" SP astring / "KEYWORD" SP flag-keyword / 4950 "NEW" / "OLD" / "ON" SP date / "RECENT" / "SEEN" / 4951 "SINCE" SP date / "SUBJECT" SP astring / 4952 "TEXT" SP astring / "TO" SP astring / 4953 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" / 4954 "UNKEYWORD" SP flag-keyword / "UNSEEN" / 4955 ; Above this line were in [IMAP2] 4956 "DRAFT" / "HEADER" SP header-fld-name SP astring / 4957 "LARGER" SP number / "NOT" SP search-key / 4958 "OR" SP search-key SP search-key / 4959 "SENTBEFORE" SP date / "SENTON" SP date / 4960 "SENTSINCE" SP date / "SMALLER" SP number / 4961 "UID" SP sequence-set / "UNDRAFT" / sequence-set / 4962 "(" search-key *(SP search-key) ")" 4964 search-modifier-name = tagged-ext-label 4966 search-mod-params = tagged-ext-val 4967 ; This non-terminal shows recommended syntax 4968 ; for future extensions. 4970 search-program = ["CHARSET" SP charset SP] 4971 search-key *(SP search-key) 4972 ; CHARSET argument to SEARCH MUST be 4973 ; registered with IANA. 4975 search-ret-data-ext = search-modifier-name SP search-return-value 4976 ; Note that not every SEARCH return option 4977 ; is required to have the corresponding 4978 ; ESEARCH return data. 4980 search-return-data = "MIN" SP nz-number / 4981 "MAX" SP nz-number / 4982 "ALL" SP sequence-set / 4983 "COUNT" SP number / 4984 search-ret-data-ext 4985 ; All return data items conform to search-ret-data-ext 4986 ; syntax 4988 search-return-opts = SP "RETURN" SP "(" [search-return-opt 4989 *(SP search-return-opt)] ")" 4991 search-return-opt = "MIN" / "MAX" / "ALL" / "COUNT" / 4992 search-ret-opt-ext 4993 ; conforms to generic search-ret-opt-ext 4994 ; syntax 4996 search-ret-opt-ext = search-modifier-name [SP search-mod-params] 4998 search-return-value = tagged-ext-val 4999 ; Data for the returned search option. 5000 ; A single "nz-number"/"number"/"number64" value 5001 ; can be returned as an atom (i.e., without 5002 ; quoting). A sequence-set can be returned 5003 ; as an atom as well. 5005 section = "[" [section-spec] "]" 5007 section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list / 5008 "TEXT" 5009 ; top-level or MESSAGE/RFC822 or MESSAGE/GLOBAL part 5011 section-part = nz-number *("." nz-number) 5012 ; body part reference. 5013 ; Allows for accessing nested body parts. 5015 section-spec = section-msgtext / (section-part ["." section-text]) 5017 section-text = section-msgtext / "MIME" 5018 ; text other than actual body part (headers, etc.) 5020 select = "SELECT" SP mailbox 5022 seq-number = nz-number / "*" 5023 ; message sequence number (COPY, FETCH, STORE 5024 ; commands) or unique identifier (UID COPY, 5025 ; UID FETCH, UID STORE commands). 5026 ; * represents the largest number in use. In 5027 ; the case of message sequence numbers, it is 5028 ; the number of messages in a non-empty mailbox. 5029 ; In the case of unique identifiers, it is the 5030 ; unique identifier of the last message in the 5031 ; mailbox or, if the mailbox is empty, the 5032 ; mailbox's current UIDNEXT value. 5033 ; The server should respond with a tagged BAD 5034 ; response to a command that uses a message 5035 ; sequence number greater than the number of 5036 ; messages in the selected mailbox. This 5037 ; includes "*" if the selected mailbox is empty. 5039 seq-range = seq-number ":" seq-number 5040 ; two seq-number values and all values between 5041 ; these two regardless of order. 5042 ; Example: 2:4 and 4:2 are equivalent and indicate 5043 ; values 2, 3, and 4. 5044 ; Example: a unique identifier sequence range of 5045 ; 3291:* includes the UID of the last message in 5046 ; the mailbox, even if that value is less than 3291. 5048 sequence-set = (seq-number / seq-range) ["," sequence-set] 5049 ; set of seq-number values, regardless of order. 5050 ; Servers MAY coalesce overlaps and/or execute the 5051 ; sequence in any order. 5052 ; Example: a message sequence number set of 5053 ; 2,4:7,9,12:* for a mailbox with 15 messages is 5054 ; equivalent to 2,4,5,6,7,9,12,13,14,15 5055 ; Example: a message sequence number set of *:4,5:7 5056 ; for a mailbox with 10 messages is equivalent to 5057 ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and 5058 ; overlap coalesced to be 4,5,6,7,8,9,10. 5060 status = "STATUS" SP mailbox SP 5061 "(" status-att *(SP status-att) ")" 5063 status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" / 5064 "UNSEEN" / "SIZE" 5066 status-att-val = ("MESSAGES" SP number) / ("RECENT" SP number) / 5067 ("UIDNEXT" SP nz-number) / ("UIDVALIDITY" SP nz-number) / 5068 ("UNSEEN" SP number) / ("SIZE" SP number64) 5069 ; Extensions to the STATUS responses 5070 ; should extend this production. 5071 ; Extensions should use the generic 5072 ; syntax defined by tagged-ext. 5074 status-att-list = status-att-val *(SP status-att-val) 5076 store = "STORE" SP sequence-set SP store-att-flags 5078 store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP 5079 (flag-list / (flag *(SP flag))) 5081 string = quoted / literal 5083 subscribe = "SUBSCRIBE" SP mailbox 5085 tag = 1* 5087 tagged-ext-label = tagged-label-fchar *tagged-label-char 5088 ;; Is a valid RFC 3501 "atom". 5090 tagged-label-fchar = ALPHA / "-" / "_" / "." 5092 tagged-label-char = tagged-label-fchar / DIGIT / ":" 5094 tagged-ext-comp = astring / 5095 tagged-ext-comp *(SP tagged-ext-comp) / 5096 "(" tagged-ext-comp ")" 5097 ;; Extensions that follow this general 5098 ;; syntax should use nstring instead of 5099 ;; astring when appropriate in the context 5100 ;; of the extension. 5101 ;; Note that a message set or a "number" 5102 ;; can always be represented as an "atom". 5103 ;; An URL should be represented as 5104 ;; a "quoted" string. 5106 tagged-ext-simple = sequence-set / number / number64 5107 tagged-ext-val = tagged-ext-simple / 5108 "(" [tagged-ext-comp] ")" 5110 text = 1*TEXT-CHAR 5112 TEXT-CHAR = 5114 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 5115 ; Hours minutes seconds 5117 uid = "UID" SP (copy / fetch / search / store / uid-expunge) 5118 ; Unique identifiers used instead of message 5119 ; sequence numbers 5121 uid-expunge = "EXPUNGE" SP sequence-set 5122 ; Unique identifiers used instead of message 5123 ; sequence numbers 5125 uid-set = (uniqueid / uid-range) *("," uid-set) 5127 uid-range = (uniqueid ":" uniqueid) 5128 ; two uniqueid values and all values 5129 ; between these two regards of order. 5130 ; Example: 2:4 and 4:2 are equivalent. 5132 uniqueid = nz-number 5133 ; Strictly ascending 5135 unsubscribe = "UNSUBSCRIBE" SP mailbox 5137 userid = astring 5139 UTF8-2 = 5141 UTF8-3 = 5143 UTF8-4 = 5145 x-command = "X" atom 5147 zone = ("+" / "-") 4DIGIT 5148 ; Signed four-digit value of hhmm representing 5149 ; hours and minutes east of Greenwich (that is, 5150 ; the amount that the given time differs from 5151 ; Universal Time). Subtracting the timezone 5152 ; from the given time will give the UT form. 5153 ; The Universal Time zone is "+0000". 5155 10. Author's Note 5157 This document is a revision or rewrite of earlier documents, and 5158 supercedes the protocol specification in those documents: RFC 2060, 5159 RFC 1730, unpublished IMAP2bis.TXT document, RFC 1176, and RFC 1064. 5161 11. Security Considerations 5163 IMAP4rev2 protocol transactions, including electronic mail data, are 5164 sent in the clear over the network unless protection from snooping is 5165 negotiated. This can be accomplished either by the use of IMAPS 5166 service, STARTTLS command, negotiated privacy protection in the 5167 AUTHENTICATE command, or some other protection mechanism. 5169 11.1. STARTTLS Security Considerations 5171 IMAP client and server implementations MUST comply with relevant TLS 5172 recommendations from [RFC8314]. Additionally, when using TLS 1.2, 5173 IMAP implementations MUST implement 5174 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite, and SHOULD 5175 implement the TLS_RSA_WITH_AES_128_CBC_SHA [TLS] cipher suite. This 5176 is important as it assures that any two compliant implementations can 5177 be configured to interoperate. Other TLS cipher suites recommended 5178 in RFC 7525 are RECOMMENDED: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 5179 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 and 5180 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384. All other cipher suites are 5181 OPTIONAL. Note that this is a change from section 2.1 of [IMAP-TLS]. 5183 During the [TLS] negotiation, the client MUST check its understanding 5184 of the server hostname against the server's identity as presented in 5185 the server Certificate message, in order to prevent man-in-the-middle 5186 attacks. This procedure is described in [RFC7817]. 5188 Both the client and server MUST check the result of the STARTTLS 5189 command and subsequent [TLS] negotiation to see whether acceptable 5190 authentication and/or privacy was achieved. 5192 11.2. COPYUID and APPENDUID response codes 5194 The COPYUID and APPENDUID response codes return information about the 5195 mailbox, which may be considered sensitive if the mailbox has 5196 permissions set that permit the client to COPY or APPEND to the 5197 mailbox, but not SELECT or EXAMINE it. 5199 Consequently, these response codes SHOULD NOT be issued if the client 5200 does not have access to SELECT or EXAMINE the mailbox. 5202 11.3. Other Security Considerations 5204 A server error message for an AUTHENTICATE command which fails due to 5205 invalid credentials SHOULD NOT detail why the credentials are 5206 invalid. 5208 Use of the LOGIN command sends passwords in the clear. This can be 5209 avoided by using the AUTHENTICATE command with a [SASL] mechanism 5210 that does not use plaintext passwords, by first negotiating 5211 encryption via STARTTLS or some other protection mechanism. 5213 A server implementation MUST implement a configuration that, at the 5214 time of authentication, requires: 5215 (1) The STARTTLS command has been negotiated. 5216 OR 5217 (2) Some other mechanism that protects the session from password 5218 snooping has been provided. 5219 OR 5220 (3) The following measures are in place: 5221 (a) The LOGINDISABLED capability is advertised, and [SASL] mechanisms 5222 (such as PLAIN) using plaintext passwords are NOT advertised in the 5223 CAPABILITY list. 5224 AND 5225 (b) The LOGIN command returns an error even if the password is 5226 correct. 5227 AND 5228 (c) The AUTHENTICATE command returns an error with all [SASL] 5229 mechanisms that use plaintext passwords, even if the password is 5230 correct. 5232 A server error message for a failing LOGIN command SHOULD NOT specify 5233 that the user name, as opposed to the password, is invalid. 5235 A server SHOULD have mechanisms in place to limit or delay failed 5236 AUTHENTICATE/LOGIN attempts. 5238 Additional security considerations are discussed in the section 5239 discussing the AUTHENTICATE and LOGIN commands. 5241 12. IANA Considerations 5243 IANA is requested to update "Service Names and Transport Protocol 5244 Port Numbers" registry as follows: 5246 1. Registration for TCP "imap" port 143 should be updated to point 5247 to this document and RFC 3501. 5249 2. Registration for TCP "imaps" port 993 should be updated to point 5250 to this document and RFC 3501. 5252 3. Both UDP port 143 and UDP port 993 should be marked as "Reserved" 5253 in the registry. 5255 Additional IANA actions are specified in subsection of this section. 5257 12.1. Updates to IMAP4 Capabilities registry 5259 IMAP4 capabilities are registered by publishing a standards track or 5260 IESG approved informational or experimental RFC. The registry is 5261 currently located at: http://www.iana.org/assignments/ 5262 imap4-capabilities 5264 As this specification revises the STARTTLS and LOGINDISABLED 5265 extensions previously defined in [IMAP-TLS], IANA is requested to 5266 update registry entries for these 2 extensions to point to this 5267 document. 5269 12.2. GSSAPI/SASL service name 5271 GSSAPI/Kerberos/SASL service names are registered by publishing a 5272 standards track or IESG approved experimental RFC. The registry is 5273 currently located at: http://www.iana.org/assignments/gssapi-service- 5274 names 5276 IANA is requested to update the "imap" service name previously 5277 registered in RFC 3501, to point to this document. 5279 13. References 5281 13.1. Normative References 5283 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 5284 Specifications: ABNF", STD 68, RFC 5234, January 2008, 5285 . 5287 [ANONYMOUS] 5288 Zeilenga, K., "Anonymous Simple Authentication and 5289 Security Layer (SASL) Mechanism", RFC 4505, June 2006, 5290 . 5292 [CHARSET] Freed, N. and J. Postel, "IANA Charset Registration 5293 Procedures", BCP 19, RFC 2978, October 2000, 5294 . 5296 [DIGEST-MD5] 5297 Leach, P. and C. Newman, "Using Digest Authentication as a 5298 SASL Mechanism", RFC 2831, May 2000, 5299 . 5301 [DISPOSITION] 5302 Troost, R., Dorner, S., and K. Moore, Ed., "Communicating 5303 Presentation Information in Internet Messages: The 5304 Content-Disposition Header Field", RFC 2183, August 1997, 5305 . 5307 [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 5308 Security Layer (SASL) Mechanism", RFC 4616, August 2006, 5309 . 5311 [KEYWORDS] 5312 Bradner, S., "Key words for use in RFCs to Indicate 5313 Requirement Levels", BCP 14, RFC 2119, March 1997, 5314 . 5316 [LANGUAGE-TAGS] 5317 Alvestrand, H., "Content Language Headers", RFC 3282, May 5318 2002, . 5320 [LOCATION] 5321 Palme, J., Hopmann, A., and N. Shelness, "MIME 5322 Encapsulation of Aggregate Documents, such as HTML 5323 (MHTML)", RFC 2557, March 1999, 5324 . 5326 [MD5] Myers, J. and M. Rose, "The Content-MD5 Header Field", 5327 RFC 1864, October 1995, 5328 . 5330 [MIME-HDRS] 5331 Moore, K., "MIME (Multipurpose Internet Mail Extensions) 5332 Part Three: Message Header Extensions for Non-ASCII Text", 5333 RFC 2047, November 1996, 5334 . 5336 [MIME-IMB] 5337 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5338 Extensions (MIME) Part One: Format of Internet Message 5339 Bodies", RFC 2045, November 1996, 5340 . 5342 [MIME-IMT] 5343 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 5344 Extensions (MIME) Part Two: Media Types", RFC 2046, 5345 November 1996, . 5347 [RFC-5322] 5348 Resnick, P., Ed., "Internet Message Format", RFC 5322, 5349 October 2008, . 5351 [SASL] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 5352 Authentication and Security Layer (SASL)", RFC 4422, June 5353 2006, . 5355 [TLS] Dierks, T. and E. Rescorla, "The Transport Layer Security 5356 (TLS) Protocol Version 1.2", RFC 5246, August 2008, 5357 . 5359 [UTF-7] Goldsmith, D. and M. Davis, "UTF-7 A Mail-Safe 5360 Transformation Format of Unicode", RFC 2152, May 1997, 5361 . 5363 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 5364 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 5365 2003, . 5367 [MULTIAPPEND] 5368 Crispin, M., "Internet Message Access Protocol (IMAP) - 5369 MULTIAPPEND Extension", RFC 3502, March 2003, 5370 . 5372 [IMAP-IMPLEMENTATION] 5373 Leiba, B., "IMAP4 Implementation Recommendations", 5374 RFC 2683, September 1999, 5375 . 5377 [IMAP-MULTIACCESS] 5378 Gahrns, M., "IMAP4 Multi-Accessed Mailbox Practice", 5379 RFC 2180, July 1997, 5380 . 5382 [NET-UNICODE] 5383 Klensin, J. and M. Padlipsky, "Unicode Format for Network 5384 Interchange", RFC 5198, DOI 10.17487/RFC5198, March 2008, 5385 . 5387 [I18N-HDRS] 5388 Yang, A., Steele, S., and N. Freed, "Internationalized 5389 Email Headers", RFC 6532, DOI 10.17487/RFC6532, February 5390 2012, . 5392 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 5393 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 5394 . 5396 [RFC7817] Melnikov, A., "Updated Transport Layer Security (TLS) 5397 Server Identity Check Procedure for Email-Related 5398 Protocols", RFC 7817, DOI 10.17487/RFC7817, March 2016, 5399 . 5401 [RFC7888] Melnikov, A., Ed., "IMAP4 Non-synchronizing Literals", 5402 RFC 7888, DOI 10.17487/RFC7888, May 2016, 5403 . 5405 [RFC8314] Moore, K. and C. Newman, "Cleartext Considered Obsolete: 5406 Use of Transport Layer Security (TLS) for Email Submission 5407 and Access", RFC 8314, DOI 10.17487/RFC8314, January 2018, 5408 . 5410 13.2. Informative References (related protocols) 5412 [IMAP-DISC] 5413 Melnikov, A., Ed., "Synchronization Operations for 5414 Disconnected IMAP4 Clients", RFC 4549, June 2006, 5415 . 5417 [IMAP-I18N] 5418 Newman, C., Gulbrandsen, A., and A. Melnikov, "Internet 5419 Message Access Protocol Internationalization", RFC 5255, 5420 DOI 10.17487/RFC5255, June 2008, 5421 . 5423 [IMAP-MODEL] 5424 Crispin, M., "Distributed Electronic Mail Models in 5425 IMAP4", RFC 1733, December 1994, 5426 . 5428 [IMAP-UTF-8] 5429 Resnick, P., Ed., Newman, C., Ed., and S. Shen, Ed., "IMAP 5430 Support for UTF-8", RFC 6855, DOI 10.17487/RFC6855, March 5431 2013, . 5433 [ACAP] Newman, C. and J. G. Myers, "ACAP -- Application 5434 Configuration Access Protocol", RFC 2244, November 1997, 5435 . 5437 [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 5438 October 2008, . 5440 [RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", 5441 RFC 4314, December 2005, 5442 . 5444 [RFC2087] Myers, J., "IMAP4 QUOTA extension", RFC 2087, January 5445 1997, . 5447 [IMAP-URL] 5448 Melnikov, A., Ed. and C. Newman, "IMAP URL Scheme", 5449 RFC 5092, DOI 10.17487/RFC5092, November 2007, 5450 . 5452 13.3. Informative References (historical aspects of IMAP and related 5453 protocols) 5455 [IMAP-COMPAT] 5456 Crispin, M., "IMAP4 Compatibility with IMAP2bis", 5457 RFC 2061, December 1996, 5458 . 5460 [IMAP-HISTORICAL] 5461 Crispin, M., "IMAP4 Compatibility with IMAP2 and 5462 IMAP2bis", RFC 1732, December 1994, 5463 . 5465 [IMAP-OBSOLETE] 5466 Crispin, M., "Internet Message Access Protocol - Obsolete 5467 Syntax", RFC 2062, December 1996, 5468 . 5470 [IMAP2] Crispin, M., "Interactive Mail Access Protocol: Version 5471 2", RFC 1176, August 1990, 5472 . 5474 [RFC-822] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 5475 TEXT MESSAGES", STD 11, RFC 822, August 1982, 5476 . 5478 [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, 5479 RFC 821, August 1982, 5480 . 5482 [IMAP-TLS] 5483 Newman, C., "Using TLS with IMAP, POP3 and ACAP", 5484 RFC 2595, June 1999, 5485 . 5487 Appendix A. Backward compatibility with IMAP4rev1 5489 An implementation that wants to remain compatible with IMAP4rev1 can 5490 advertise both IMAP4rev1 and IMAP4rev2 in its CAPABILITY response/ 5491 response code. While some IMAP4rev1 responses were removed in 5492 IMAP4rev2, their presence will not break IMAP4rev2-only clients. 5494 If both IMAP4rev1 and IMAP4rev2 are advertised, an IMAP client that 5495 wants to use IMAP4rev2 MUST issue an "ENABLE IMAP4rev2" command. 5497 Servers advertising both IMAP4rev1 and IMAP4rev2 SHOULD NOT generate 5498 UTF-8 quoted strings unless the client has issued "ENABLE IMAP4rev2". 5499 Consider implementation of mechanisms described or referenced in 5500 [IMAP-UTF-8] to achieve this goal. 5502 Servers advertising both IMAP4rev1 and IMAP4rev2, and clients 5503 intending to be compatible with IMAP4rev1 servers MUST be compatible 5504 with the international mailbox naming convention described in the 5505 following subsection. 5507 A.1. Mailbox International Naming Convention 5509 By convention, international mailbox names in IMAP4rev2 are specified 5510 using a modified version of the UTF-7 encoding described in [UTF-7]. 5511 Modified UTF-7 may also be usable in servers that implement an 5512 earlier version of this protocol. 5514 In modified UTF-7, printable US-ASCII characters, except for "&", 5515 represent themselves; that is, characters with octet values 0x20-0x25 5516 and 0x27-0x7e. The character "&" (0x26) is represented by the two- 5517 octet sequence "&-". 5519 All other characters (octet values 0x00-0x1f and 0x7f-0xff) are 5520 represented in modified BASE64, with a further modification from 5521 [UTF-7] that "," is used instead of "/". Modified BASE64 MUST NOT be 5522 used to represent any printing US-ASCII character which can represent 5523 itself. Only characters inside the modified BASE64 alphabet are 5524 permitted in modified BASE64 text. 5526 "&" is used to shift to modified BASE64 and "-" to shift back to US- 5527 ASCII. There is no implicit shift from BASE64 to US-ASCII, and null 5528 shifts ("-&" while in BASE64; note that "&-" while in US-ASCII means 5529 "&") are not permitted. However, all names start in US-ASCII, and 5530 MUST end in US-ASCII; that is, a name that ends with a non-ASCII 5531 ISO-10646 character MUST end with a "-"). 5533 The purpose of these modifications is to correct the following 5534 problems with UTF-7: 5536 1. UTF-7 uses the "+" character for shifting; this conflicts with 5537 the common use of "+" in mailbox names, in particular USENET 5538 newsgroup names. 5540 2. UTF-7's encoding is BASE64 which uses the "/" character; this 5541 conflicts with the use of "/" as a popular hierarchy delimiter. 5543 3. UTF-7 prohibits the unencoded usage of "\"; this conflicts with 5544 the use of "\" as a popular hierarchy delimiter. 5546 4. UTF-7 prohibits the unencoded usage of "~"; this conflicts with 5547 the use of "~" in some servers as a home directory indicator. 5549 5. UTF-7 permits multiple alternate forms to represent the same 5550 string; in particular, printable US-ASCII characters can be 5551 represented in encoded form. 5553 Although modified UTF-7 is a convention, it establishes certain 5554 requirements on server handling of any mailbox name with an embedded 5555 "&" character. In particular, server implementations MUST preserve 5556 the exact form of the modified BASE64 portion of a modified UTF-7 5557 name and treat that text as case-sensitive, even if names are 5558 otherwise case-insensitive or case-folded. 5560 Server implementations SHOULD verify that any mailbox name with an 5561 embedded "&" character, used as an argument to CREATE, is: in the 5562 correctly modified UTF-7 syntax, has no superfluous shifts, and has 5563 no encoding in modified BASE64 of any printing US-ASCII character 5564 which can represent itself. However, client implementations MUST NOT 5565 depend upon the server doing this, and SHOULD NOT attempt to create a 5566 mailbox name with an embedded "&" character unless it complies with 5567 the modified UTF-7 syntax. 5569 Server implementations which export a mail store that does not follow 5570 the modified UTF-7 convention MUST convert to modified UTF-7 any 5571 mailbox name that contains either non-ASCII characters or the "&" 5572 character. 5574 For example, here is a mailbox name which mixes English, Chinese, 5575 and Japanese text: ~peter/mail/&U,BTFw-/&ZeVnLIqe- 5576 For example, the string "&Jjo!" is not a valid mailbox name 5577 because it does not contain a shift to US-ASCII before the "!". 5578 The correct form is "&Jjo-!". The string "&U,BTFw-&ZeVnLIqe-" is 5579 not permitted because it contains a superfluous shift. The 5580 correct form is "&U,BTF2XlZyyKng-". 5582 Appendix B. Changes from RFC 3501 / IMAP4rev1 5584 The following is the plan for remaining changes. The plan might 5585 change over time. 5587 1. Fold in the following extensions/RFC: RFC 5530 (IMAP Response 5588 Codes, done), UIDPLUS (done), ENABLE (done), ESEARCH (done), 5589 SPECIAL-USE (list of new mailbox attributes is done), LITERAL- 5590 (done), NAMESPACE (done), SASL-IR (done). 5592 2. Add CLOSED response code (from CONDSTORE) - done 5594 3. Add support for $MDNSent and $Forwarded IMAP keywords - done. 5595 Add more examples showing their use? 5597 4. Require all unsolicited updates to include UID (?) 5599 5. Update recommendations on TLS ciphers to match UTA WG work (as 5600 per RFC 8314, RFC 7525 and RFC 7817) - done. 5602 6. Possibly fold in the following extensions/RFC: Base LIST- 5603 EXTENDED syntax plus deprecate LSUB (replace it with LIST 5604 \Subscribed) minus the requirement to support multiple list 5605 patterns, STATUS-in-LIST, Unique mailstore IDs for messages 5606 (OBJECTID extension, RFC 8474), IDLE (done), SEARCHRES, BINARY 5607 (possibly only the FETCH changes and make APPEND related ones 5608 optional?). 5610 7. Add STATUS SIZE (total mailbox size) - done Add STATUS DELETED 5611 (number of messages with \Deleted flag set)? 5613 8. Deprecate features: RECENT response on SELECT/EXAMINE, \Recent 5614 flag, RECENT STATUS item. UNSEEN response code on SELECT/ 5615 EXAMINE. SEARCH response (use ESEARCH instead). 5617 9. Drop UTF-7, all mailboxes are always in UTF-8 - done. 5619 10. Revise IANA registration of IMAP extensions and advice on use of 5620 "X-" convention. 5622 The following changes since RFC 3501 were done so far: 5624 1. Folded in IMAP UNSELECT (RFC 3691), UIDPLUS (RFC 4315), ESEARCH 5625 (RFC 4731), ENABLE (RFC 5161), IDLE (RFC 2177) and SASL-IR (RFC 5626 4959) extensions. Also folded RFC 5530. 5628 2. Added CLOSED response code from RFC 7162. 5630 3. Updated to use modern TLS-related recommendations as per RFC 5631 8314, RFC 7817, RFC 7525. 5633 4. For future extensibility extended ABNF for tagged-ext-simple to 5634 allow for bare number64. 5636 5. Added SHOULD level requirement on IMAP servers to support 5637 $MDNSent and $Forwarded keywords. 5639 6. Added STATUS SIZE. 5641 7. Mailbox names and message headers now allow for UTF-8. Support 5642 for Modified UTF-7 in mailbox names is not required, unless 5643 compatibility with IMAP4rev1 is desired. 5645 Appendix C. Acknowledgement 5647 Earlier versions of this document were edited by Mark Crispin. 5648 Sadly, he is no longer available to help with this work. Editor of 5649 this revisions is hoping that Mark would have approved. 5651 Chris Newman has contributed text on I18N and use of UTF-8 in 5652 messages and mailbox names. 5654 Thank you to Tony Hansen for helping with the index generation. 5656 This document incorporate text from RFC 4315, RFC 4466, RFC 4731, RFC 5657 5161, RFC 6154 so work done by authors/editors of these documents is 5658 appreciated. 5660 Index 5662 $ 5663 $Forwarded (predefined flag) 12 5664 $MDNSent (predefined flag) 12 5666 + 5667 +FLAGS 67 5668 +FLAGS.SILENT 67 5670 - 5671 -FLAGS 68 5672 -FLAGS.SILENT 68 5674 A 5675 ALERT (response code) 73 5676 ALL (fetch item) 64 5677 ALL (search key) 60 5678 ALL (search result option) 59 5679 ALREADYEXISTS (response code) 73 5680 ANSWERED (search key) 60 5681 APPEND (command) 51 5682 APPENDUID (response code) 73 5683 AUTHENTICATE (command) 27 5684 AUTHENTICATIONFAILED (response code) 74 5685 AUTHORIZATIONFAILED (response code) 74 5687 B 5688 BAD (response) 80 5689 BADCHARSET (response code) 74 5690 BCC (search key) 60 5691 BEFORE (search key) 60 5692 BODY (fetch item) 64 5693 BODY (fetch result) 90 5694 BODY (search key) 60 5695 BODY.PEEK[
]<> (fetch item) 66 5696 BODYSTRUCTURE (fetch item) 66 5697 BODYSTRUCTURE (fetch result) 90 5698 BODY[
]<> (fetch result) 90 5699 BODY[
]<> (fetch item) 64 5700 BYE (response) 81 5701 Body Structure (message attribute) 13 5703 C 5704 CANNOT (response code) 74 5705 CAPABILITY (command) 24 5706 CAPABILITY (response code) 74 5707 CAPABILITY (response) 82 5708 CC (search key) 60 5709 CHECK (command) 56 5710 CLIENTBUG (response code) 74 5711 CLOSE (command) 56 5712 CLOSED (response code) 75 5713 CONTACTADMIN (response code) 75 5714 COPY (command) 68 5715 COPYUID (response code) 75 5716 CORRUPTION (response code) 76 5717 COUNT (search result option) 59 5718 CREATE (command) 36 5720 D 5721 DELETE (command) 37 5722 DELETED (search key) 60 5723 DRAFT (search key) 60 5725 E 5726 ENABLE (command) 31 5727 ENVELOPE (fetch item) 66 5728 ENVELOPE (fetch result) 93 5729 ESEARCH (response) 87 5730 EXAMINE (command) 35 5731 EXPIRED (response code) 76 5732 EXPUNGE (command) 57 5733 EXPUNGE (response) 89 5734 EXPUNGEISSUED (response code) 76 5735 Envelope Structure (message attribute) 13 5737 F 5738 FAST (fetch item) 64 5739 FETCH (command) 63 5740 FETCH (response) 90 5741 FLAGGED (search key) 60 5742 FLAGS (fetch item) 66 5743 FLAGS (fetch result) 94 5744 FLAGS (response) 87 5745 FLAGS (store command data item) 67 5746 FLAGS.SILENT (store command data item) 67 5747 FROM (search key) 61 5748 FULL (fetch item) 64 5749 Flags (message attribute) 11 5751 H 5752 HEADER (part specifier) 64 5753 HEADER (search key) 61 5754 HEADER.FIELDS (part specifier) 64 5755 HEADER.FIELDS.NOT (part specifier) 64 5757 I 5758 IDLE (command) 54 5759 INTERNALDATE (fetch item) 66 5760 INTERNALDATE (fetch result) 94 5761 INUSE (response code) 76 5762 Internal Date (message attribute) 13 5764 K 5765 KEYWORD (search key) 61 5766 Keyword (type of flag) 12 5768 L 5769 LARGER (search key) 61 5770 LIMIT (response code) 77 5771 LIST (command) 41 5772 LIST (response) 83 5773 LOGOUT (command) 25 5774 LSUB (command) 44 5775 LSUB (response) 86 5777 M 5778 MAX (search result option) 59 5779 MAY (specification requirement term) 5 5780 MESSAGES (status item) 50 5781 MIME (part specifier) 65 5782 MIN (search result option) 58 5783 MUST (specification requirement term) 5 5784 MUST NOT (specification requirement term) 5 5785 Message Sequence Number (message attribute) 11 5787 N 5788 NAMESPACE (command) 45 5789 NAMESPACE (response) 86 5790 NEW (search key) 61 5791 NO (response) 80 5792 NONEXISTENT (response code) 77 5793 NOOP (command) 25 5794 NOPERM (response code) 77 5795 NOT (search key) 61 5797 O 5798 OK (response) 79 5799 OLD (search key) 61 5800 ON (search key) 61 5801 OPTIONAL (specification requirement term) 5 5802 OR (search key) 61 5803 OVERQUOTA (response code) 77 5805 P 5806 PARSE (response code) 78 5807 PERMANENTFLAGS (response code) 78 5808 PREAUTH (response) 81 5809 PRIVACYREQUIRED (response code) 78 5810 Permanent Flag (class of flag) 12 5811 Predefined keywords 12 5813 R 5814 READ-ONLY (response code) 78 5815 READ-WRITE (response code) 78 5816 RECENT (search key) 61 5817 RECENT (status item) 50 5818 RECOMMENDED (specification requirement term) 5 5819 RENAME (command) 38 5820 REQUIRED (specification requirement term) 5 5821 RFC822 (fetch item) 66 5822 RFC822 (fetch result) 94 5823 RFC822.HEADER (fetch item) 66 5824 RFC822.HEADER (fetch result) 94 5825 RFC822.SIZE (fetch item) 66 5826 RFC822.SIZE (fetch result) 94 5827 RFC822.TEXT (fetch item) 66 5828 RFC822.TEXT (fetch result) 94 5830 S 5831 SEARCH (command) 58 5832 SEEN (search key) 61 5833 SELECT (command) 33 5834 SENTBEFORE (search key) 61 5835 SENTON (search key) 61 5836 SENTSINCE (search key) 61 5837 SERVERBUG (response code) 78 5838 SHOULD (specification requirement term) 5 5839 SHOULD NOT (specification requirement term) 5 5840 SINCE (search key) 61 5841 SIZE (status item) 51 5842 SMALLER (search key) 62 5843 STARTTLS (command) 26 5844 STATUS (command) 49 5845 STATUS (response) 86 5846 STORE (command) 67 5847 SUBJECT (search key) 62 5848 SUBSCRIBE (command) 40 5849 Session Flag (class of flag) 12 5850 System Flag (type of flag) 11 5852 T 5853 TEXT (part specifier) 64 5854 TEXT (search key) 62 5855 TO (search key) 62 5856 TRYCREATE (response code) 78 5858 U 5859 UID (command) 69 5860 UID (fetch item) 67 5861 UID (fetch result) 94 5862 UID (search key) 62 5863 UIDNEXT (response code) 79 5864 UIDNEXT (status item) 50 5865 UIDNOTSTICKY (response code) 79 5866 UIDVALIDITY (response code) 79 5867 UIDVALIDITY (status item) 50 5868 UNANSWERED (search key) 62 5869 UNAVAILABLE (response code) 79 5870 UNDELETED (search key) 62 5871 UNDRAFT (search key) 62 5872 UNFLAGGED (search key) 62 5873 UNKEYWORD (search key) 62 5874 UNSEEN (response code) 79 5875 UNSEEN (search key) 62 5876 UNSEEN (status item) 51 5877 UNSELECT (command) 57 5878 UNSUBSCRIBE (command) 41 5879 Unique Identifier (UID) (message attribute) 9 5881 X 5882 X (command) 71 5884 [ 5885 [RFC-5322] Size (message attribute) 13 5887 \ 5888 \All (mailbox name attribute) 84 5889 \Answered (system flag) 11 5890 \Archive (mailbox name attribute) 84 5891 \Deleted (system flag) 11 5892 \Draft (system flag) 12 5893 \Drafts (mailbox name attribute) 85 5894 \Flagged (mailbox name attribute) 85 5895 \Flagged (system flag) 11 5896 \HasChildren (mailbox name attribute) 83 5897 \HasNoChildren (mailbox name attribute) 84 5898 \Junk (mailbox name attribute) 85 5899 \Marked (mailbox name attribute) 84 5900 \Noinferiors (mailbox name attribute) 83 5901 \Noselect (mailbox name attribute) 83 5902 \Recent (system flag) 12 5903 \Seen (system flag) 11 5904 \Sent (mailbox name attribute) 85 5905 \Trash (mailbox name attribute) 85 5906 \Unmarked (mailbox name attribute) 84 5908 Authors' Addresses 5910 Alexey Melnikov (editor) 5911 Isode Ltd 5912 14 Castle Mews 5913 Hampton, Middlesex TW12 2NP 5914 UK 5916 Email: Alexey.Melnikov@isode.com 5918 Barry Leiba (editor) 5919 Huawei Technologies 5921 Phone: +1 646 827 0648 5922 Email: barryleiba@computer.org 5923 URI: http://internetmessagingtechnology.org/