idnits 2.17.1 draft-ietf-extra-imap4rev2-21.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 3 instances of too long lines in the document, the longest one being 2 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 (November 23, 2020) is 1250 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 7079, but not defined == Missing Reference: 'IMAP-OBSOLETE' is mentioned on line 7074, but not defined == Missing Reference: 'IMAP-COMPAT' is mentioned on line 7064, but not defined == Missing Reference: 'IMAP-HISTORICAL' is mentioned on line 7069, but not defined == Missing Reference: 'RFC-822' is mentioned on line 7083, but not defined ** Obsolete undefined reference: RFC 822 (Obsoleted by RFC 2822) == Missing Reference: 'IMAP-MODEL' is mentioned on line 7013, but not defined == Missing Reference: 'IMAP-DISC' is mentioned on line 7002, but not defined == Missing Reference: 'RFC3503' is mentioned on line 6975, but not defined == Missing Reference: 'IMAP-KEYWORDS-REG' is mentioned on line 7042, but not defined == Missing Reference: 'SMTP' is mentioned on line 7023, but not defined == Missing Reference: 'RFC7888' is mentioned on line 6998, but not defined -- Looks like a reference, but probably isn't: '1' on line 894 == Missing Reference: 'IMAP-URL' is mentioned on line 7037, but not defined == Missing Reference: 'TLS' is mentioned on line 1202, but not defined == Missing Reference: 'UIDVALIDITY 3857529045' is mentioned on line 5773, but not defined == Missing Reference: 'UIDNEXT 4392' is mentioned on line 1738, but not defined == Missing Reference: 'RFC2193' is mentioned on line 6985, but not defined == Missing Reference: 'RFC3348' is mentioned on line 7358, but not defined ** Obsolete undefined reference: RFC 3348 (Obsoleted by RFC 5258) == Missing Reference: 'RFC4314' is mentioned on line 7030, but not defined == Missing Reference: 'RFC3501' is mentioned on line 7060, but not defined ** Obsolete undefined reference: RFC 3501 (Obsoleted by RFC 9051) == Missing Reference: 'UIDNEXT 2' is mentioned on line 3268, but not defined == Missing Reference: 'UIDVALIDITY 1' is mentioned on line 3340, but not defined == Missing Reference: 'CHARSET-REG' is mentioned on line 7052, but not defined == Missing Reference: 'IMAP-I18N' is mentioned on line 7007, but not defined == Missing Reference: 'HEADER' is mentioned on line 5791, but not defined == Missing Reference: 'BADCHARSET UTF-8' is mentioned on line 3920, but not defined == Missing Reference: 'UID' is mentioned on line 4348, but not defined == Missing Reference: 'RFC2087' is mentioned on line 7034, but not defined ** Obsolete undefined reference: RFC 2087 (Obsoleted by RFC 9208) == Missing Reference: 'IMAP-MAILBOX-NAME-ATTRS-REG' is mentioned on line 7047, but not defined == Missing Reference: 'READ-WRITE' is mentioned on line 5775, but not defined == Missing Reference: 'RFC4422' is mentioned on line 6122, but not defined == Missing Reference: 'IMAP4' is mentioned on line 6207, but not defined == Missing Reference: 'Namespace-Response-Extensions' is mentioned on line 6277, but not defined == Missing Reference: 'IMAP-TLS' is mentioned on line 7087, but not defined == Missing Reference: 'RFCXXXX' is mentioned on line 6815, but not defined == Missing Reference: 'RFC5465' is mentioned on line 6994, but not defined == Missing Reference: 'RFC5256' is mentioned on line 6980, but not defined == Missing Reference: 'IMAP-UTF-8' is mentioned on line 7105, but not defined == Missing Reference: 'RFC3516' is mentioned on line 7201, but not defined ** 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: 9 errors (**), 0 flaws (~~), 40 warnings (==), 4 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 Futurewei Technologies 6 Expires: May 27, 2021 November 23, 2020 8 Internet Message Access Protocol (IMAP) - Version 4rev2 9 draft-ietf-extra-imap4rev2-21 11 Abstract 13 The Internet Message Access Protocol, Version 4rev2 (IMAP4rev2) 14 allows a client to access and manipulate electronic mail messages on 15 a server. IMAP4rev2 permits manipulation of mailboxes (remote 16 message folders) in a way that is functionally equivalent to local 17 folders. IMAP4rev2 also provides the capability for an offline 18 client to resynchronize with the server. 20 IMAP4rev2 includes operations for creating, deleting, and renaming 21 mailboxes, checking for new messages, permanently removing messages, 22 setting and clearing flags, RFC 5322, RFC 2045 and RFC 2231 parsing, 23 searching, and selective fetching of message attributes, texts, and 24 portions thereof. Messages in IMAP4rev2 are accessed by the use of 25 numbers. These numbers are either message sequence numbers or unique 26 identifiers. 28 IMAP4rev2 does not specify a means of posting mail; this function is 29 handled by a mail submission protocol such as the one specified in 30 RFC 6409. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on May 27, 2021. 49 Copyright Notice 51 Copyright (c) 2020 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (https://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 This document may contain material from IETF Documents or IETF 65 Contributions published or made publicly available before November 66 10, 2008. The person(s) controlling the copyright in some of this 67 material may not have granted the IETF Trust the right to allow 68 modifications of such material outside the IETF Standards Process. 69 Without obtaining an adequate license from the person(s) controlling 70 the copyright in such materials, this document may not be modified 71 outside the IETF Standards Process, and derivative works of it may 72 not be created outside the IETF Standards Process, except to format 73 it for publication as an RFC or to translate it into languages other 74 than English. 76 Table of Contents 78 1. How to Read This Document . . . . . . . . . . . . . . . . . . 5 79 1.1. Organization of This Document . . . . . . . . . . . . . . 5 80 1.2. Conventions Used in This Document . . . . . . . . . . . . 5 81 1.3. Special Notes to Implementors . . . . . . . . . . . . . . 6 82 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 7 83 2.1. Link Level . . . . . . . . . . . . . . . . . . . . . . . 7 84 2.2. Commands and Responses . . . . . . . . . . . . . . . . . 7 85 2.2.1. Client Protocol Sender and Server Protocol Receiver . 7 86 2.2.2. Server Protocol Sender and Client Protocol Receiver . 8 87 2.3. Message Attributes . . . . . . . . . . . . . . . . . . . 9 88 2.3.1. Message Numbers . . . . . . . . . . . . . . . . . . . 9 89 2.3.2. Flags Message Attribute . . . . . . . . . . . . . . . 11 90 2.3.3. Internal Date Message Attribute . . . . . . . . . . . 13 91 2.3.4. [RFC-5322] Size Message Attribute . . . . . . . . . . 14 92 2.3.5. Envelope Structure Message Attribute . . . . . . . . 14 93 2.3.6. Body Structure Message Attribute . . . . . . . . . . 14 94 2.4. Message Texts . . . . . . . . . . . . . . . . . . . . . . 14 95 3. State and Flow Diagram . . . . . . . . . . . . . . . . . . . 14 96 3.1. Not Authenticated State . . . . . . . . . . . . . . . . . 14 97 3.2. Authenticated State . . . . . . . . . . . . . . . . . . . 15 98 3.3. Selected State . . . . . . . . . . . . . . . . . . . . . 15 99 3.4. Logout State . . . . . . . . . . . . . . . . . . . . . . 15 100 4. Data Formats . . . . . . . . . . . . . . . . . . . . . . . . 17 101 4.1. Atom . . . . . . . . . . . . . . . . . . . . . . . . . . 17 102 4.1.1. Sequence set and UID set . . . . . . . . . . . . . . 17 103 4.2. Number . . . . . . . . . . . . . . . . . . . . . . . . . 17 104 4.3. String . . . . . . . . . . . . . . . . . . . . . . . . . 17 105 4.3.1. 8-bit and Binary Strings . . . . . . . . . . . . . . 18 106 4.4. Parenthesized List . . . . . . . . . . . . . . . . . . . 19 107 4.5. NIL . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 108 5. Operational Considerations . . . . . . . . . . . . . . . . . 20 109 5.1. Mailbox Naming . . . . . . . . . . . . . . . . . . . . . 20 110 5.1.1. Mailbox Hierarchy Naming . . . . . . . . . . . . . . 21 111 5.1.2. Namespaces . . . . . . . . . . . . . . . . . . . . . 21 112 5.2. Mailbox Size and Message Status Updates . . . . . . . . . 23 113 5.3. Response when no Command in Progress . . . . . . . . . . 23 114 5.4. Autologout Timer . . . . . . . . . . . . . . . . . . . . 23 115 5.5. Multiple Commands in Progress (Command Pipelining) . . . 23 116 6. Client Commands . . . . . . . . . . . . . . . . . . . . . . . 25 117 6.1. Client Commands - Any State . . . . . . . . . . . . . . . 25 118 6.1.1. CAPABILITY Command . . . . . . . . . . . . . . . . . 25 119 6.1.2. NOOP Command . . . . . . . . . . . . . . . . . . . . 26 120 6.1.3. LOGOUT Command . . . . . . . . . . . . . . . . . . . 27 121 6.2. Client Commands - Not Authenticated State . . . . . . . . 27 122 6.2.1. STARTTLS Command . . . . . . . . . . . . . . . . . . 28 123 6.2.2. AUTHENTICATE Command . . . . . . . . . . . . . . . . 29 124 6.2.3. LOGIN Command . . . . . . . . . . . . . . . . . . . . 32 125 6.3. Client Commands - Authenticated State . . . . . . . . . . 33 126 6.3.1. ENABLE Command . . . . . . . . . . . . . . . . . . . 33 127 6.3.2. SELECT Command . . . . . . . . . . . . . . . . . . . 35 128 6.3.3. EXAMINE Command . . . . . . . . . . . . . . . . . . . 37 129 6.3.4. CREATE Command . . . . . . . . . . . . . . . . . . . 38 130 6.3.5. DELETE Command . . . . . . . . . . . . . . . . . . . 39 131 6.3.6. RENAME Command . . . . . . . . . . . . . . . . . . . 41 132 6.3.7. SUBSCRIBE Command . . . . . . . . . . . . . . . . . . 43 133 6.3.8. UNSUBSCRIBE Command . . . . . . . . . . . . . . . . . 44 134 6.3.9. LIST Command . . . . . . . . . . . . . . . . . . . . 44 135 6.3.10. NAMESPACE Command . . . . . . . . . . . . . . . . . . 62 136 6.3.11. STATUS Command . . . . . . . . . . . . . . . . . . . 67 137 6.3.12. APPEND Command . . . . . . . . . . . . . . . . . . . 68 138 6.3.13. IDLE Command . . . . . . . . . . . . . . . . . . . . 71 139 6.4. Client Commands - Selected State . . . . . . . . . . . . 73 140 6.4.1. CLOSE Command . . . . . . . . . . . . . . . . . . . . 74 141 6.4.2. UNSELECT Command . . . . . . . . . . . . . . . . . . 74 142 6.4.3. EXPUNGE Command . . . . . . . . . . . . . . . . . . . 75 143 6.4.4. SEARCH Command . . . . . . . . . . . . . . . . . . . 75 144 6.4.5. FETCH Command . . . . . . . . . . . . . . . . . . . . 87 145 6.4.6. STORE Command . . . . . . . . . . . . . . . . . . . . 92 146 6.4.7. COPY Command . . . . . . . . . . . . . . . . . . . . 93 147 6.4.8. MOVE Command . . . . . . . . . . . . . . . . . . . . 94 148 6.4.9. UID Command . . . . . . . . . . . . . . . . . . . . . 96 149 6.5. Client Commands - Experimental/Expansion . . . . . . . . 97 150 6.5.1. X Command . . . . . . . . . . . . . . . . . . . 97 151 7. Server Responses . . . . . . . . . . . . . . . . . . . . . . 98 152 7.1. Server Responses - Status Responses . . . . . . . . . . . 99 153 7.1.1. OK Response . . . . . . . . . . . . . . . . . . . . . 107 154 7.1.2. NO Response . . . . . . . . . . . . . . . . . . . . . 108 155 7.1.3. BAD Response . . . . . . . . . . . . . . . . . . . . 108 156 7.1.4. PREAUTH Response . . . . . . . . . . . . . . . . . . 108 157 7.1.5. BYE Response . . . . . . . . . . . . . . . . . . . . 109 158 7.2. Server Responses - Server and Mailbox Status . . . . . . 109 159 7.2.1. The ENABLED Response . . . . . . . . . . . . . . . . 110 160 7.2.2. CAPABILITY Response . . . . . . . . . . . . . . . . . 110 161 7.2.3. LIST Response . . . . . . . . . . . . . . . . . . . . 111 162 7.2.4. NAMESPACE Response . . . . . . . . . . . . . . . . . 115 163 7.2.5. STATUS Response . . . . . . . . . . . . . . . . . . . 115 164 7.2.6. ESEARCH Response . . . . . . . . . . . . . . . . . . 115 165 7.2.7. FLAGS Response . . . . . . . . . . . . . . . . . . . 116 166 7.3. Server Responses - Mailbox Size . . . . . . . . . . . . . 116 167 7.3.1. EXISTS Response . . . . . . . . . . . . . . . . . . . 116 168 7.4. Server Responses - Message Status . . . . . . . . . . . . 117 169 7.4.1. EXPUNGE Response . . . . . . . . . . . . . . . . . . 117 170 7.4.2. FETCH Response . . . . . . . . . . . . . . . . . . . 118 171 7.5. Server Responses - Command Continuation Request . . . . . 124 172 8. Sample IMAP4rev2 connection . . . . . . . . . . . . . . . . . 124 173 9. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 125 174 10. Author's Note . . . . . . . . . . . . . . . . . . . . . . . . 143 175 11. Security Considerations . . . . . . . . . . . . . . . . . . . 143 176 11.1. STARTTLS Security Considerations . . . . . . . . . . . . 143 177 11.2. COPYUID and APPENDUID response codes . . . . . . . . . . 144 178 11.3. LIST command and Other Users' namespace . . . . . . . . 144 179 11.4. Other Security Considerations . . . . . . . . . . . . . 145 180 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 145 181 12.1. Updates to IMAP4 Capabilities registry . . . . . . . . . 146 182 12.2. GSSAPI/SASL service name . . . . . . . . . . . . . . . . 146 183 12.3. LIST Selection Options, LIST Return Options, LIST 184 extended data items . . . . . . . . . . . . . . . . . . 146 185 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 147 186 13.1. Normative References . . . . . . . . . . . . . . . . . . 147 187 13.2. Informative References (related protocols) . . . . . . . 150 188 13.3. Informative References (historical aspects of IMAP and 189 related protocols) . . . . . . . . . . . . . . . . . . . 152 190 Appendix A. Backward compatibility with IMAP4rev1 . . . . . . . 152 191 A.1. Mailbox International Naming Convention for compatibility 192 with IMAP4rev1 . . . . . . . . . . . . . . . . . . . . . 153 194 Appendix B. Backward compatibility with BINARY extension . . . . 155 195 Appendix C. Backward compatibility with LIST-EXTENDED extension 155 196 Appendix D. 63 bit body part and message sizes . . . . . . . . . 155 197 Appendix E. Changes from RFC 3501 / IMAP4rev1 . . . . . . . . . 155 198 Appendix F. Other Recommended IMAP Extensions . . . . . . . . . 157 199 Appendix G. Acknowledgement . . . . . . . . . . . . . . . . . . 157 200 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 201 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 163 203 1. How to Read This Document 205 1.1. Organization of This Document 207 This document is written from the point of view of the implementor of 208 an IMAP4rev2 client or server. Beyond the protocol overview in 209 section 2, it is not optimized for someone trying to understand the 210 operation of the protocol. The material in sections 3 through 5 211 provides the general context and definitions with which IMAP4rev2 212 operates. 214 Sections 6, 7, and 9 describe the IMAP commands, responses, and 215 syntax, respectively. The relationships among these are such that it 216 is almost impossible to understand any of them separately. In 217 particular, do not attempt to deduce command syntax from the command 218 section alone; instead refer to the Formal Syntax section. 220 1.2. Conventions Used in This Document 222 "Conventions" are basic principles or procedures. Document 223 conventions are noted in this section. 225 In examples, "C:" and "S:" indicate lines sent by the client and 226 server respectively. 228 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 229 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 230 "OPTIONAL" in this document are to be interpreted as described in BCP 231 14 [RFC2119] [RFC8174] when, and only when, they appear in all 232 capitals, as shown here. 234 The word "can" (not "may") is used to refer to a possible 235 circumstance or situation, as opposed to an optional facility of the 236 protocol. 238 "User" is used to refer to a human user, whereas "client" refers to 239 the software being run by the user. 241 "Connection" refers to the entire sequence of client/server 242 interaction from the initial establishment of the network connection 243 until its termination. 245 "Session" refers to the sequence of client/server interaction from 246 the time that a mailbox is selected (SELECT or EXAMINE command) until 247 the time that selection ends (SELECT or EXAMINE of another mailbox, 248 CLOSE command, UNSELECT command, or connection termination). 250 Characters are 8-bit UTF-8 (of which 7-bit US-ASCII is a subset) 251 unless otherwise specified. Other character sets are indicated using 252 a "CHARSET", as described in [MIME-IMT] and defined in [CHARSET]. 253 CHARSETs have important additional semantics in addition to defining 254 character set; refer to these documents for more detail. 256 There are several protocol conventions in IMAP. These refer to 257 aspects of the specification which are not strictly part of the IMAP 258 protocol, but reflect generally-accepted practice. Implementations 259 need to be aware of these conventions, and avoid conflicts whether or 260 not they implement the convention. For example, "&" may not be used 261 as a hierarchy delimiter since it conflicts with the Mailbox 262 International Naming Convention, and other uses of "&" in mailbox 263 names are impacted as well. 265 1.3. Special Notes to Implementors 267 Implementors of the IMAP protocol are strongly encouraged to read the 268 IMAP implementation recommendations document [IMAP-IMPLEMENTATION] in 269 conjunction with this document, to help understand the intricacies of 270 this protocol and how best to build an interoperable product. 272 IMAP4rev2 is designed to be upwards compatible from the IMAP4rev1, 273 the [IMAP2] and unpublished IMAP2bis protocols. IMAP4rev2 is largely 274 compatible with the IMAP4rev1 protocol described in RFC 3501 and the 275 IMAP4 protocol described in RFC 1730; the exception being in certain 276 facilities added in RFC 1730 and RFC 3501 that proved problematic and 277 were subsequently removed or replaced by better alternatives. In the 278 course of the evolution of IMAP4rev2, some aspects in the earlier 279 protocols have become obsolete. Obsolete commands, responses, and 280 data formats which an IMAP4rev2 implementation can encounter when 281 used with an earlier implementation are described in Appendix E, 282 Appendix A and [IMAP-OBSOLETE]. IMAP4rev2 supports 63bit body part 283 and message sizes. IMAP4rev2 compatibility with BINARY and LIST- 284 EXTENDED IMAP extensions are described in Appendix B and Appendix C 285 respectively. 287 Other compatibility issues with IMAP2bis, the most common variant of 288 the earlier protocol, are discussed in [IMAP-COMPAT]. A full 289 discussion of compatibility issues with rare (and presumed extinct) 290 variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is 291 primarily of historical interest. 293 IMAP was originally developed for the older [RFC-822] standard, and 294 as a consequence several fetch items in IMAP incorporate "RFC822" in 295 their name. In all cases, "RFC822" should be interpreted as a 296 reference to the updated [RFC-5322] standard. 298 2. Protocol Overview 300 2.1. Link Level 302 The IMAP4rev2 protocol assumes a reliable data stream such as that 303 provided by TCP. When TCP is used, an IMAP4rev2 server listens on 304 port 143 or port 993 (IMAP-over-TLS). 306 2.2. Commands and Responses 308 An IMAP4rev2 connection consists of the establishment of a client/ 309 server network connection, an initial greeting from the server, and 310 client/server interactions. These client/server interactions consist 311 of a client command, server data, and a server completion result 312 response. 314 All interactions transmitted by client and server are in the form of 315 lines, that is, strings that end with a CRLF. The protocol receiver 316 of an IMAP4rev2 client or server is either reading a line, or is 317 reading a sequence of octets with a known count followed by a line. 319 2.2.1. Client Protocol Sender and Server Protocol Receiver 321 The client command begins an operation. Each client command is 322 prefixed with an identifier (typically a short alphanumeric string, 323 e.g., A0001, A0002, etc.) called a "tag". A different tag is 324 generated by the client for each command. (More formally: the client 325 SHOULD generate a unique tag for every command, but a server MUST 326 accept tag reuse.) 328 Clients MUST follow the syntax outlined in this specification 329 strictly. It is a syntax error to send a command with missing or 330 extraneous spaces or arguments. 332 There are two cases in which a line from the client does not 333 represent a complete command. In one case, a command argument is 334 quoted with an octet count (see the description of literal in String 335 under Data Formats); in the other case, the command arguments require 336 server feedback (see the AUTHENTICATE command). In either case, the 337 server sends a command continuation request response if it is ready 338 for the octets (if appropriate) and the remainder of the command. 339 This response is prefixed with the token "+". 341 Note: If instead, the server detected an error in the command, it 342 sends a BAD completion response with a tag matching the command 343 (as described below) to reject the command and prevent the client 344 from sending any more of the command. 346 It is also possible for the server to send a completion response 347 for some other command (if multiple commands are in progress), or 348 untagged data. In either case, the command continuation request 349 is still pending; the client takes the appropriate action for the 350 response, and reads another response from the server. In all 351 cases, the client MUST send a complete command (including 352 receiving all command continuation request responses and command 353 continuations for the command) before initiating a new command. 355 The protocol receiver of an IMAP4rev2 server reads a command line 356 from the client, parses the command and its arguments, and transmits 357 server data and a server command completion result response. 359 2.2.2. Server Protocol Sender and Client Protocol Receiver 361 Data transmitted by the server to the client and status responses 362 that do not indicate command completion are prefixed with the token 363 "*", and are called untagged responses. 365 Server data MAY be sent as a result of a client command, or MAY be 366 sent unilaterally by the server. There is no syntactic difference 367 between server data that resulted from a specific command and server 368 data that were sent unilaterally. 370 The server completion result response indicates the success or 371 failure of the operation. It is tagged with the same tag as the 372 client command which began the operation. Thus, if more than one 373 command is in progress, the tag in a server completion response 374 identifies the command to which the response applies. There are 375 three possible server completion responses: OK (indicating success), 376 NO (indicating failure), or BAD (indicating a protocol error such as 377 unrecognized command or command syntax error). 379 Servers SHOULD enforce the syntax outlined in this specification 380 strictly. Any client command with a protocol syntax error, including 381 (but not limited to) missing or extraneous spaces or arguments, 382 SHOULD be rejected, and the client given a BAD server completion 383 response. 385 The protocol receiver of an IMAP4rev2 client reads a response line 386 from the server. It then takes action on the response based upon the 387 first token of the response, which can be a tag, a "*", or a "+". 389 A client MUST be prepared to accept any server response at all times. 390 This includes server data that was not requested. Server data SHOULD 391 be recorded, so that the client can reference its recorded copy 392 rather than sending a command to the server to request the data. In 393 the case of certain server data, the data MUST be recorded. 395 This topic is discussed in greater detail in the Server Responses 396 section. 398 2.3. Message Attributes 400 In addition to message text, each message has several attributes 401 associated with it. These attributes can be retrieved individually 402 or in conjunction with other attributes or message texts. 404 2.3.1. Message Numbers 406 Messages in IMAP4rev2 are accessed by one of two numbers; the unique 407 identifier or the message sequence number. 409 2.3.1.1. Unique Identifier (UID) Message Attribute 411 An unsigned non-zero 32-bit value assigned to each message, which 412 when used with the unique identifier validity value (see below) forms 413 a 64-bit value that MUST NOT refer to any other message in the 414 mailbox or any subsequent mailbox with the same name forever. Unique 415 identifiers are assigned in a strictly ascending fashion in the 416 mailbox; as each message is added to the mailbox it is assigned a 417 higher UID than the message(s) which were added previously. Unlike 418 message sequence numbers, unique identifiers are not necessarily 419 contiguous. 421 The unique identifier of a message MUST NOT change during the 422 session, and SHOULD NOT change between sessions. Any change of 423 unique identifiers between sessions MUST be detectable using the 424 UIDVALIDITY mechanism discussed below. Persistent unique identifiers 425 are required for a client to resynchronize its state from a previous 426 session with the server (e.g., disconnected or offline access clients 427 [IMAP-MODEL]); this is discussed further in [IMAP-DISC]. 429 Associated with every mailbox are two 32-bit unsigned non-zero values 430 which aid in unique identifier handling: the next unique identifier 431 value (UIDNEXT) and the unique identifier validity value 432 (UIDVALIDITY). 434 The next unique identifier value is the predicted value that will be 435 assigned to a new message in the mailbox. Unless the unique 436 identifier validity also changes (see below), the next unique 437 identifier value MUST have the following two characteristics. First, 438 the next unique identifier value MUST NOT change unless new messages 439 are added to the mailbox; and second, the next unique identifier 440 value MUST change whenever new messages are added to the mailbox, 441 even if those new messages are subsequently expunged. 443 Note: The next unique identifier value is intended to provide a 444 means for a client to determine whether any messages have been 445 delivered to the mailbox since the previous time it checked this 446 value. It is not intended to provide any guarantee that any 447 message will have this unique identifier. A client can only 448 assume, at the time that it obtains the next unique identifier 449 value, that messages arriving after that time will have a UID 450 greater than or equal to that value. 452 The unique identifier validity value is sent in a UIDVALIDITY 453 response code in an OK untagged response at mailbox selection time. 454 If unique identifiers from an earlier session fail to persist in this 455 session, the unique identifier validity value MUST be greater than 456 the one used in the earlier session. A good UIDVALIDITY value to use 457 is a 32-bit representation of the current date/time when the value is 458 assigned: this ensures that the value is unique and always increases. 459 Another possible alternative is a global counter that gets 460 incremented every time a mailbox is created. 462 Note: Ideally, unique identifiers SHOULD persist at all times. 463 Although this specification recognizes that failure to persist can 464 be unavoidable in certain server environments, it STRONGLY 465 ENCOURAGES message store implementation techniques that avoid this 466 problem. For example: 468 1. Unique identifiers MUST be strictly ascending in the mailbox 469 at all times. If the physical message store is re-ordered by 470 a non-IMAP agent, this requires that the unique identifiers in 471 the mailbox be regenerated, since the former unique 472 identifiers are no longer strictly ascending as a result of 473 the re-ordering. 475 2. If the message store has no mechanism to store unique 476 identifiers, it must regenerate unique identifiers at each 477 session, and each session must have a unique UIDVALIDITY 478 value. 480 3. If the mailbox is deleted/renamed and a new mailbox with the 481 same name is created at a later date, the server must either 482 keep track of unique identifiers from the previous instance of 483 the mailbox, or it must assign a new UIDVALIDITY value to the 484 new instance of the mailbox. 486 4. The combination of mailbox name, UIDVALIDITY, and UID must 487 refer to a single immutable (or expunged) message on that 488 server forever. In particular, the internal date, [RFC-5322] 489 size, envelope, body structure, and message texts (all 490 BODY[...] fetch data items) must never change. This does not 491 include message numbers, nor does it include attributes that 492 can be set by a STORE command (e.g., FLAGS). When a message 493 is expunged, its UID MUST NOT be reused under the same 494 UIDVALIDITY value. 496 2.3.1.2. Message Sequence Number Message Attribute 498 A relative position from 1 to the number of messages in the mailbox. 499 This position MUST be ordered by ascending unique identifier. As 500 each new message is added, it is assigned a message sequence number 501 that is 1 higher than the number of messages in the mailbox before 502 that new message was added. 504 Message sequence numbers can be reassigned during the session. For 505 example, when a message is permanently removed (expunged) from the 506 mailbox, the message sequence number for all subsequent messages is 507 decremented. The number of messages in the mailbox is also 508 decremented. Similarly, a new message can be assigned a message 509 sequence number that was once held by some other message prior to an 510 expunge. 512 In addition to accessing messages by relative position in the 513 mailbox, message sequence numbers can be used in mathematical 514 calculations. For example, if an untagged "11 EXISTS" is received, 515 and previously an untagged "8 EXISTS" was received, three new 516 messages have arrived with message sequence numbers of 9, 10, and 11. 517 Another example, if message 287 in a 523 message mailbox has UID 518 12345, there are exactly 286 messages which have lesser UIDs and 236 519 messages which have greater UIDs. 521 2.3.2. Flags Message Attribute 523 A list of zero or more named tokens associated with the message. A 524 flag is set by its addition to this list, and is cleared by its 525 removal. There are two types of flags in IMAP4rev2. A flag of 526 either type can be permanent or session-only. 528 A system flag is a flag name that is pre-defined in this 529 specification and begin with "\". Certain system flags (\Deleted and 530 \Seen) have special semantics described elsewhere in this document. 531 The currently-defined system flags are: 533 \Seen Message has been read 535 \Answered Message has been answered 537 \Flagged Message is "flagged" for urgent/special attention 539 \Deleted Message is "deleted" for removal by later EXPUNGE 541 \Draft Message has not completed composition (marked as a draft). 543 \Recent This flag was in used in IMAP4rev1 and is now deprecated. 545 A keyword is defined by the server implementation. Keywords do not 546 begin with "\". Servers MAY permit the client to define new keywords 547 in the mailbox (see the description of the PERMANENTFLAGS response 548 code for more information). Some keywords that start with "$" are 549 also defined in this specification. 551 This document defines several keywords that were not originally 552 defined in RFC 3501, but which were found to be useful by client 553 implementations. These keywords SHOULD be supported (i.e. allowed in 554 SEARCH, allowed and preserved in APPEND, COPY, MOVE commands) by 555 server implementations: 557 $Forwarded Message has been forwarded to another email address, 558 embedded within or attached to a new message. An email client 559 sets this keyword when it successfully forwards the message to 560 another email address. Typical usage of this keyword is to show a 561 different (or additional) icon for a message that has been 562 forwarded. Once set, the flag SHOULD NOT be cleared. 564 $MDNSent Message Disposition Notification [RFC8098] was generated 565 and sent for this message. See [RFC3503] for more details on how 566 this keyword is used. 568 $Junk The user (or a delivery agent on behalf of the user) may 569 choose to mark a message as definitely containing junk ($Junk; see 570 also the related keyword $NotJunk). The $Junk keyword can be used 571 to mark (and potentially move/delete messages later), group or 572 hide undesirable messages. See [IMAP-KEYWORDS-REG] for more 573 information. 575 $NotJunk The user (or a delivery agent on behalf of the user) may 576 choose to mark a message as definitely not containing junk 577 ($NotJunk; see also the related keyword $Junk). The $NotJunk 578 keyword can be used to mark, group or show messages that the user 579 wants to see. See [IMAP-KEYWORDS-REG] for more information. 581 $Phishing The $Phishing keyword can be used by a delivery agent to 582 mark a message as highly likely to be a phishing email. An email 583 that's determined to be a phishing email by the delivery agent 584 should also be considered a junk email and have the appropriate 585 junk filtering applied, including setting the $Junk flag and 586 placing in the \Junk special-use mailbox (see Section 7.2.3) if 587 available. 588 If both the $Phishing flag and the $Junk flag are set, the user 589 agent should display an additional warning message to the user. 590 User agents should not use the term "phishing" in their warning 591 message as most users do not understand this term. Phrasing of 592 the form "this message may be trying to steal your personal 593 information" is recommended. Additionally the user agent may 594 display a warning when clicking on any hyperlinks within the 595 message. 596 The requirement for both $Phishing and $Junk to be set before a 597 user agent displays a warning is for better backwards 598 compatibility with existing clients that understand the $Junk flag 599 but not the $Phishing flag. This so that when an unextended 600 client removes the $Junk flag, an extended client will also show 601 the correct state. See [IMAP-KEYWORDS-REG] for more information. 603 $Junk and $NotJunk are mutually exclusive. If more than one of them 604 is set for a message, the client MUST treat this as if none of them 605 is set and SHOULD unset both of them on the IMAP server. 607 Other registered keywords can be found in the "IMAP and JMAP 608 Keywords" registry [IMAP-KEYWORDS-REG]. New keywords SHOULD be 609 registered in this registry using the procedure specified in 610 [RFC5788]. 612 A flag can be permanent or session-only on a per-flag basis. 613 Permanent flags are those which the client can add or remove from the 614 message flags permanently; that is, concurrent and subsequent 615 sessions will see any change in permanent flags. Changes to session 616 flags are valid only in that session. 618 2.3.3. Internal Date Message Attribute 620 The internal date and time of the message on the server. This is not 621 the date and time in the [RFC-5322] header, but rather a date and 622 time which reflects when the message was received. In the case of 623 messages delivered via [SMTP], this SHOULD be the date and time of 624 final delivery of the message as defined by [SMTP]. In the case of 625 messages delivered by the IMAP4rev2 COPY or MOVE command, this SHOULD 626 be the internal date and time of the source message. In the case of 627 messages delivered by the IMAP4rev2 APPEND command, this SHOULD be 628 the date and time as specified in the APPEND command description. 629 All other cases are implementation defined. 631 2.3.4. [RFC-5322] Size Message Attribute 633 The number of octets in the message, as expressed in [RFC-5322] 634 format. 636 2.3.5. Envelope Structure Message Attribute 638 A parsed representation of the [RFC-5322] header of the message. 639 Note that the IMAP Envelope structure is not the same as an [SMTP] 640 envelope. 642 2.3.6. Body Structure Message Attribute 644 A parsed representation of the [MIME-IMB] body structure information 645 of the message. 647 2.4. Message Texts 649 In addition to being able to fetch the full [RFC-5322] text of a 650 message, IMAP4rev2 permits the fetching of portions of the full 651 message text. Specifically, it is possible to fetch the [RFC-5322] 652 message header, [RFC-5322] message body, a [MIME-IMB] body part, or a 653 [MIME-IMB] header. 655 3. State and Flow Diagram 657 Once the connection between client and server is established, an 658 IMAP4rev2 connection is in one of four states. The initial state is 659 identified in the server greeting. Most commands are only valid in 660 certain states. It is a protocol error for the client to attempt a 661 command while the connection is in an inappropriate state, and the 662 server will respond with a BAD or NO (depending upon server 663 implementation) command completion result. 665 3.1. Not Authenticated State 667 In the not authenticated state, the client MUST supply authentication 668 credentials before most commands will be permitted. This state is 669 entered when a connection starts unless the connection has been pre- 670 authenticated. 672 3.2. Authenticated State 674 In the authenticated state, the client is authenticated and MUST 675 select a mailbox to access before commands that affect messages will 676 be permitted. This state is entered when a pre-authenticated 677 connection starts, when acceptable authentication credentials have 678 been provided, after an error in selecting a mailbox, or after a 679 successful CLOSE command. 681 3.3. Selected State 683 In a selected state, a mailbox has been selected to access. This 684 state is entered when a mailbox has been successfully selected. 686 3.4. Logout State 688 In the logout state, the connection is being terminated. This state 689 can be entered as a result of a client request (via the LOGOUT 690 command) or by unilateral action on the part of either the client or 691 server. 693 If the client requests the logout state, the server MUST send an 694 untagged BYE response and a tagged OK response to the LOGOUT command 695 before the server closes the connection; and the client MUST read the 696 tagged OK response to the LOGOUT command before the client closes the 697 connection. 699 A server SHOULD NOT unilaterally close the connection without sending 700 an untagged BYE response that contains the reason for having done so. 701 A client SHOULD NOT unilaterally close the connection, and instead 702 SHOULD issue a LOGOUT command. If the server detects that the client 703 has unilaterally closed the connection, the server MAY omit the 704 untagged BYE response and simply close its connection. 706 +----------------------+ 707 |connection established| 708 +----------------------+ 709 || 710 \/ 711 +--------------------------------------+ 712 | server greeting | 713 +--------------------------------------+ 714 || (1) || (2) || (3) 715 \/ || || 716 +-----------------+ || || 717 |Not Authenticated| || || 718 +-----------------+ || || 719 || (7) || (4) || || 720 || \/ \/ || 721 || +----------------+ || 722 || | Authenticated |<=++ || 723 || +----------------+ || || 724 || || (7) || (5) || (6) || 725 || || \/ || || 726 || || +--------+ || || 727 || || |Selected|==++ || 728 || || +--------+ || 729 || || || (7) || 730 \/ \/ \/ \/ 731 +--------------------------------------+ 732 | Logout | 733 +--------------------------------------+ 734 || 735 \/ 736 +-------------------------------+ 737 |both sides close the connection| 738 +-------------------------------+ 740 (1) connection without pre-authentication (OK greeting) 741 (2) pre-authenticated connection (PREAUTH greeting) 742 (3) rejected connection (BYE greeting) 743 (4) successful LOGIN or AUTHENTICATE command 744 (5) successful SELECT or EXAMINE command 745 (6) CLOSE command, unsolicited CLOSED response code or 746 failed SELECT or EXAMINE command 747 (7) LOGOUT command, server shutdown, or connection closed 749 4. Data Formats 751 IMAP4rev2 uses textual commands and responses. Data in IMAP4rev2 can 752 be in one of several forms: atom, number, string, parenthesized list, 753 or NIL. Note that a particular data item may take more than one 754 form; for example, a data item defined as using "astring" syntax may 755 be either an atom or a string. 757 4.1. Atom 759 An atom consists of one or more non-special characters. 761 4.1.1. Sequence set and UID set 763 A set of messages can be referenced by a sequence set containing 764 either message sequence numbers or unique identifiers. See Section 9 765 for details. Sequence sets can contain ranges (e.g. "5:50"), an 766 enumeration of specific message/UID numbers, a special symbol "*", or 767 a combination of the above. 769 A "UID set" is similar to the sequence set of unique identifiers; 770 however, the "*" value for a sequence number is not permitted. 772 4.2. Number 774 A number consists of one or more digit characters, and represents a 775 numeric value. 777 4.3. String 779 A string is in one of three forms: synchonizing literal, non- 780 synchronizing literal or quoted string. The synchronizing literal 781 form is the general form of string. The non-synchronizing literal 782 form is also the general form, but has length limitation. The quoted 783 string form is an alternative that avoids the overhead of processing 784 a literal at the cost of limitations of characters which may be used. 786 When the distinction between synchronizing and non-synchronizing 787 literals is not important, this document just uses the term 788 "literal". 790 A synchronizing literal is a sequence of zero or more octets 791 (including CR and LF), prefix-quoted with an octet count in the form 792 of an open brace ("{"), the number of octets, close brace ("}"), and 793 CRLF. In the case of synchronizing literals transmitted from server 794 to client, the CRLF is immediately followed by the octet data. In 795 the case of synchronizing literals transmitted from client to server, 796 the client MUST wait to receive a command continuation request 797 (described later in this document) before sending the octet data (and 798 the remainder of the command). 800 The non-synchronizing literal is an alternate form of synchronizing 801 literal, and it may appear in communication from client to server 802 instead of the synchonizing form of literal. The non-synchronizing 803 literal form MUST NOT be sent from server to client. The non- 804 synchronizing literal is distinguished from the synchronizing literal 805 by having a plus ("+") between the octet count and the closing brace 806 ("}"). The server does not generate a command continuation request 807 in response to a non-synchronizing literal, and clients are not 808 required to wait before sending the octets of a non- synchronizing 809 literal. Non-synchronizing literals MUST NOT be larger than 4096 810 octets. Any literal larger than 4096 bytes MUST be sent as a 811 synchronizing literal. (Non-synchronizing literals defined in this 812 document are the same as non-synchronizing literals defined by the 813 LITERAL- extension from [RFC7888]. See that document for details on 814 how to handle invalid non-synchronizing literals longer than 4096 815 octets and for interaction with other IMAP extensions.) 817 A quoted string is a sequence of zero or more Unicode characters, 818 excluding CR and LF, encoded in UTF-8, with double quote (<">) 819 characters at each end. 821 The empty string is represented as "" (a quoted string with zero 822 characters between double quotes), as {0} followed by CRLF (a 823 synchronizing literal with an octet count of 0) or as {0+} followed 824 by CRLF (a non-synchronizing literal with an octet count of 0). 826 Note: Even if the octet count is 0, a client transmitting a 827 synchronizing literal MUST wait to receive a command continuation 828 request. 830 4.3.1. 8-bit and Binary Strings 832 8-bit textual and binary mail is supported through the use of a 833 [MIME-IMB] content transfer encoding. IMAP4rev2 implementations MAY 834 transmit 8-bit or multi-octet characters in literals, but SHOULD do 835 so only when the [CHARSET] is identified. 837 IMAP4rev2 is compatible with [I18N-HDRS]. As a result, the 838 identified charset for header-field values with 8-bit content is 839 UTF-8 [UTF-8]. IMAP4rev2 implementations MUST accept and MAY 840 transmit [UTF-8] text in quoted-strings as long as the string does 841 not contain NUL, CR, or LF. This differs from IMAP4rev1 842 implementations. 844 Although a BINARY content transfer encoding is defined, unencoded 845 binary strings are not permitted, unless returned in a in 846 response to BINARY.PEEK[]<> or 847 BINARY[]<> FETCH data item. A "binary 848 string" is any string with NUL characters. A string with an 849 excessive amount of CTL characters MAY also be considered to be 850 binary. Unless returned in response to BINARY.PEEK[...]/BINARY[...] 851 FETCH, client and server implementations MUST encode binary data into 852 a textual form, such as BASE64, before transmitting the data. 854 4.4. Parenthesized List 856 Data structures are represented as a "parenthesized list"; a sequence 857 of data items, delimited by space, and bounded at each end by 858 parentheses. A parenthesized list can contain other parenthesized 859 lists, using multiple levels of parentheses to indicate nesting. 861 The empty list is represented as () -- a parenthesized list with no 862 members. 864 4.5. NIL 866 The special form "NIL" represents the non-existence of a particular 867 data item that is represented as a string or parenthesized list, as 868 distinct from the empty string "" or the empty parenthesized list (). 870 Note: NIL is never used for any data item which takes the form of 871 an atom. For example, a mailbox name of "NIL" is a mailbox named 872 NIL as opposed to a non-existent mailbox name. This is because 873 mailbox uses "astring" syntax which is an atom or a string. 874 Conversely, an addr-name of NIL is a non-existent personal name, 875 because addr-name uses "nstring" syntax which is NIL or a string, 876 but never an atom. 878 Examples: 880 The following LIST response: 882 * LIST () "/" NIL 884 is equivalent to: 885 * LIST () "/" "NIL" 887 as LIST response ABNF is using astring for mailbox name. 889 However, the following response 891 * FETCH 1 (BODY[1] NIL) 893 is not equivalent to: 894 * FETCH 1 (BODY[1] "NIL") 895 The former means absence of the body part, while the latter 896 means that it contains literal sequence of characters "NIL". 898 5. Operational Considerations 900 The following rules are listed here to ensure that all IMAP4rev2 901 implementations interoperate properly. 903 5.1. Mailbox Naming 905 In IMAP4rev2, Mailbox names are encoded in Net-Unicode [NET-UNICODE] 906 (this differs from IMAP4rev1). Client implementations MAY attempt to 907 create Net-Unicode mailbox names, and MUST interpret any 8-bit 908 mailbox names returned by LIST as [NET-UNICODE]. Server 909 implementations MUST prohibit the creation of 8-bit mailbox names 910 that do not comply with Net-Unicode. However, servers MAY accept a 911 de-normalized UTF-8 mailbox name and convert it to Unicode 912 normalization form "NFC" (as per Net-Unicode requirements) prior to 913 mailbox creation. Servers that choose to accept such de-normalized 914 UTF-8 mailbox names MUST accept them in all IMAP commands that have a 915 mailbox name parameter. In particular SELECT must open the 916 same mailbox that was successfully created with CREATE , even 917 if is a de-normalized UTF-8 mailbox name. 919 The case-insensitive mailbox name INBOX is a special name reserved to 920 mean "the primary mailbox for this user on this server". (Note that 921 this special name may not exist on some servers for some users, for 922 example if the user has no access to personal namespace.) The 923 interpretation of all other names is implementation-dependent. 925 In particular, this specification takes no position on case 926 sensitivity in non-INBOX mailbox names. Some server implementations 927 are fully case-sensitive in ASCII range; others preserve case of a 928 newly-created name but otherwise are case-insensitive; and yet others 929 coerce names to a particular case. Client implementations must be 930 able to interact with any of these. 932 There are certain client considerations when creating a new mailbox 933 name: 935 1. Any character which is one of the atom-specials (see the Formal 936 Syntax) will require that the mailbox name be represented as a 937 quoted string or literal. 939 2. CTL and other non-graphic characters are difficult to represent 940 in a user interface and are best avoided. Servers MAY refuse to 941 create mailbox names containing Unicode CTL characters. 943 3. Although the list-wildcard characters ("%" and "*") are valid in 944 a mailbox name, it is difficult to use such mailbox names with 945 the LIST command due to the conflict with wildcard 946 interpretation. 948 4. Usually, a character (determined by the server implementation) is 949 reserved to delimit levels of hierarchy. 951 5. Two characters, "#" and "&", have meanings by convention, and 952 should be avoided except when used in that convention. See 953 Section 5.1.2.1 and Appendix A.1 respectively. 955 5.1.1. Mailbox Hierarchy Naming 957 If it is desired to export hierarchical mailbox names, mailbox names 958 MUST be left-to-right hierarchical using a single character to 959 separate levels of hierarchy. The same hierarchy separator character 960 is used for all levels of hierarchy within a single name. 962 5.1.2. Namespaces 964 Personal Namespace: A namespace that the server considers within the 965 personal scope of the authenticated user on a particular connection. 966 Typically, only the authenticated user has access to mailboxes in 967 their Personal Namespace. It is the part of the namespace that 968 belongs to the user that is allocated for mailboxes. If an INBOX 969 exists for a user, it MUST appear within the user's personal 970 namespace. In the typical case, there SHOULD be only one Personal 971 Namespace on a server. 973 Other Users' Namespace: A namespace that consists of mailboxes from 974 the Personal Namespaces of other users. To access mailboxes in the 975 Other Users' Namespace, the currently authenticated user MUST be 976 explicitly granted access rights. For example, it is common for a 977 manager to grant to their secretary access rights to their mailbox. 978 In the typical case, there SHOULD be only one Other Users' Namespace 979 on a server. 981 Shared Namespace: A namespace that consists of mailboxes that are 982 intended to be shared amongst users and do not exist within a user's 983 Personal Namespace. 985 The namespaces a server uses MAY differ on a per-user basis. 987 5.1.2.1. Historic Mailbox Namespace Naming Convention 989 By convention, the first hierarchical element of any mailbox name 990 which begins with "#" identifies the "namespace" of the remainder of 991 the name. This makes it possible to disambiguate between different 992 types of mailbox stores, each of which have their own namespaces. 994 For example, implementations which offer access to USENET 995 newsgroups MAY use the "#news" namespace to partition the USENET 996 newsgroup namespace from that of other mailboxes. Thus, the 997 comp.mail.misc newsgroup would have a mailbox name of 998 "#news.comp.mail.misc", and the name "comp.mail.misc" can refer to 999 a different object (e.g., a user's private mailbox). 1001 Namespaces that include the "#" character are not IMAP URL [IMAP-URL] 1002 friendly requiring the "#" character to be represented as %23 when 1003 within URLs. As such, server implementers MAY instead consider using 1004 namespace prefixes that do not contain the "#" character. 1006 5.1.2.2. Common namespace models 1008 Previous version of this protocol does not define a default server 1009 namespace. Two common namespace models have evolved: 1011 The "Personal Mailbox" model, in which the default namespace that is 1012 presented consists of only the user's personal mailboxes. To access 1013 shared mailboxes, the user must use an escape mechanism to reach 1014 another namespace. 1016 The "Complete Hierarchy" model, in which the default namespace that 1017 is presented includes the user's personal mailboxes along with any 1018 other mailboxes they have access to. 1020 5.2. Mailbox Size and Message Status Updates 1022 At any time, a server can send data that the client did not request. 1023 Sometimes, such behavior is REQUIRED. For example, agents other than 1024 the server MAY add messages to the mailbox (e.g., new message 1025 delivery), change the flags of the messages in the mailbox (e.g., 1026 simultaneous access to the same mailbox by multiple agents), or even 1027 remove messages from the mailbox. A server MUST send mailbox size 1028 updates automatically if a mailbox size change is observed during the 1029 processing of a command. A server SHOULD send message flag updates 1030 automatically, without requiring the client to request such updates 1031 explicitly. 1033 Special rules exist for server notification of a client about the 1034 removal of messages to prevent synchronization errors; see the 1035 description of the EXPUNGE response for more detail. In particular, 1036 it is NOT permitted to send an EXISTS response that would reduce the 1037 number of messages in the mailbox; only the EXPUNGE response can do 1038 this. 1040 Regardless of what implementation decisions a client makes on 1041 remembering data from the server, a client implementation MUST record 1042 mailbox size updates. It MUST NOT assume that any command after the 1043 initial mailbox selection will return the size of the mailbox. 1045 5.3. Response when no Command in Progress 1047 Server implementations are permitted to send an untagged response 1048 (except for EXPUNGE) while there is no command in progress. Server 1049 implementations that send such responses MUST deal with flow control 1050 considerations. Specifically, they MUST either (1) verify that the 1051 size of the data does not exceed the underlying transport's available 1052 window size, or (2) use non-blocking writes. 1054 5.4. Autologout Timer 1056 If a server has an inactivity autologout timer that applies to 1057 sessions after authentication, the duration of that timer MUST be at 1058 least 30 minutes. The receipt of ANY command from the client during 1059 that interval SHOULD suffice to reset the autologout timer. 1061 5.5. Multiple Commands in Progress (Command Pipelining) 1063 The client MAY send another command without waiting for the 1064 completion result response of a command, subject to ambiguity rules 1065 (see below) and flow control constraints on the underlying data 1066 stream. Similarly, a server MAY begin processing another command 1067 before processing the current command to completion, subject to 1068 ambiguity rules. However, any command continuation request responses 1069 and command continuations MUST be negotiated before any subsequent 1070 command is initiated. 1072 The exception is if an ambiguity would result because of a command 1073 that would affect the results of other commands. If the server 1074 detects a possible ambiguity, it MUST execute commands to completion 1075 in the order given by the client. 1077 The most obvious example of ambiguity is when a command would affect 1078 the results of another command, e.g., a FETCH of a message's flags 1079 and a STORE of that same message's flags. 1081 A non-obvious ambiguity occurs with commands that permit an untagged 1082 EXPUNGE response (commands other than FETCH, STORE, and SEARCH), 1083 since an untagged EXPUNGE response can invalidate sequence numbers in 1084 a subsequent command. This is not a problem for FETCH, STORE, or 1085 SEARCH commands because servers are prohibited from sending EXPUNGE 1086 responses while any of those commands are in progress. Therefore, if 1087 the client sends any command other than FETCH, STORE, or SEARCH, it 1088 MUST wait for the completion result response before sending a command 1089 with message sequence numbers. 1091 Note: EXPUNGE responses are permitted while UID FETCH, UID STORE, 1092 and UID SEARCH are in progress. If the client sends a UID 1093 command, it MUST wait for a completion result response before 1094 sending a command which uses message sequence numbers (this may 1095 include UID SEARCH). Any message sequence numbers in an argument 1096 to UID SEARCH are associated with messages prior to the effect of 1097 any untagged EXPUNGE returned by the UID SEARCH. 1099 For example, the following non-waiting command sequences are invalid: 1101 FETCH + NOOP + STORE 1103 STORE + COPY + FETCH 1105 COPY + COPY 1107 The following are examples of valid non-waiting command sequences: 1109 FETCH + STORE + SEARCH + NOOP 1111 STORE + COPY + EXPUNGE 1113 UID SEARCH + UID SEARCH may be valid or invalid as a non-waiting 1114 command sequence, depending upon whether or not the second UID 1115 SEARCH contains message sequence numbers. 1117 Use of SEARCH result variable (see Section 6.4.4.1) creates direct 1118 dependency between two commands. See Section 6.4.4.2 for more 1119 considerations about pipelining such dependent commands. 1121 6. Client Commands 1123 IMAP4rev2 commands are described in this section. Commands are 1124 organized by the state in which the command is permitted. Commands 1125 which are permitted in multiple states are listed in the minimum 1126 permitted state (for example, commands valid in authenticated and 1127 selected state are listed in the authenticated state commands). 1129 Command arguments, identified by "Arguments:" in the command 1130 descriptions below, are described by function, not by syntax. The 1131 precise syntax of command arguments is described in the Formal Syntax 1132 (Section 9). 1134 Some commands cause specific server responses to be returned; these 1135 are identified by "Responses:" in the command descriptions below. 1136 See the response descriptions in the Responses section for 1137 information on these responses, and the Formal Syntax section for the 1138 precise syntax of these responses. It is possible for server data to 1139 be transmitted as a result of any command. Thus, commands that do 1140 not specifically require server data specify "no specific responses 1141 for this command" instead of "none". 1143 The "Result:" in the command description refers to the possible 1144 tagged status responses to a command, and any special interpretation 1145 of these status responses. 1147 The state of a connection is only changed by successful commands 1148 which are documented as changing state. A rejected command (BAD 1149 response) never changes the state of the connection or of the 1150 selected mailbox. A failed command (NO response) generally does not 1151 change the state of the connection or of the selected mailbox; the 1152 exception being the SELECT and EXAMINE commands. 1154 6.1. Client Commands - Any State 1156 The following commands are valid in any state: CAPABILITY, NOOP, and 1157 LOGOUT. 1159 6.1.1. CAPABILITY Command 1161 Arguments: none 1163 Responses: REQUIRED untagged response: CAPABILITY 1164 Result: OK - capability completed 1165 BAD - command unknown or arguments invalid 1167 The CAPABILITY command requests a listing of capabilities that the 1168 server supports. The server MUST send a single untagged CAPABILITY 1169 response with "IMAP4rev2" as one of the listed capabilities before 1170 the (tagged) OK response. 1172 A capability name which begins with "AUTH=" indicates that the server 1173 supports that particular authentication mechanism. All such names 1174 are, by definition, part of this specification. For example, the 1175 authorization capability for an experimental "blurdybloop" 1176 authenticator would be "AUTH=XBLURDYBLOOP" and not 1177 "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP". 1179 Other capability names refer to extensions, revisions, or amendments 1180 to this specification. See the documentation of the CAPABILITY 1181 response for additional information. No capabilities, beyond the 1182 base IMAP4rev2 set defined in this specification, are enabled without 1183 explicit client action to invoke the capability. 1185 Client and server implementations MUST implement the STARTTLS, 1186 LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) capabilities. 1187 See the Security Considerations section for important information. 1189 Unless specified otherwise, all registered extensions to IMAP4rev1 1190 are also valid extensions to IMAP4rev2. 1192 See the section entitled "Client Commands - Experimental/Expansion" 1193 for information about the form of site or implementation-specific 1194 capabilities. 1196 Example: C: abcd CAPABILITY 1197 S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI 1198 LOGINDISABLED 1199 S: abcd OK CAPABILITY completed 1200 C: efgh STARTTLS 1201 S: efgh OK STARTLS completed 1202 1203 C: ijkl CAPABILITY 1204 S: * CAPABILITY IMAP4rev2 AUTH=GSSAPI AUTH=PLAIN 1205 S: ijkl OK CAPABILITY completed 1207 6.1.2. NOOP Command 1209 Arguments: none 1211 Responses: no specific responses for this command (but see below) 1212 Result: OK - noop completed 1213 BAD - command unknown or arguments invalid 1215 The NOOP command always succeeds. It does nothing. 1217 Since any command can return a status update as untagged data, the 1218 NOOP command can be used as a periodic poll for new messages or 1219 message status updates during a period of inactivity (the IDLE 1220 command Section 6.3.13 should be used instead of NOOP if real-time 1221 updates to mailbox state are desirable). The NOOP command can also 1222 be used to reset any inactivity autologout timer on the server. 1224 Example: C: a002 NOOP 1225 S: a002 OK NOOP completed 1226 . . . 1227 C: a047 NOOP 1228 S: * 22 EXPUNGE 1229 S: * 23 EXISTS 1230 S: * 14 FETCH (UID 1305 FLAGS (\Seen \Deleted)) 1231 S: a047 OK NOOP completed 1233 6.1.3. LOGOUT Command 1235 Arguments: none 1237 Responses: REQUIRED untagged response: BYE 1239 Result: OK - logout completed 1240 BAD - command unknown or arguments invalid 1242 The LOGOUT command informs the server that the client is done with 1243 the connection. The server MUST send a BYE untagged response before 1244 the (tagged) OK response, and then close the network connection. 1246 Example: C: A023 LOGOUT 1247 S: * BYE IMAP4rev2 Server logging out 1248 S: A023 OK LOGOUT completed 1249 (Server and client then close the connection) 1251 6.2. Client Commands - Not Authenticated State 1253 In the not authenticated state, the AUTHENTICATE or LOGIN command 1254 establishes authentication and enters the authenticated state. The 1255 AUTHENTICATE command provides a general mechanism for a variety of 1256 authentication techniques, privacy protection, and integrity 1257 checking; whereas the LOGIN command uses a traditional user name and 1258 plaintext password pair and has no means of establishing privacy 1259 protection or integrity checking. 1261 The STARTTLS command is an alternate form of establishing session 1262 privacy protection and integrity checking, but does not by itself 1263 establish authentication or enter the authenticated state. 1265 Server implementations MAY allow access to certain mailboxes without 1266 establishing authentication. This can be done by means of the 1267 ANONYMOUS [SASL] authenticator described in [ANONYMOUS]. An older 1268 convention is a LOGIN command using the userid "anonymous"; in this 1269 case, a password is required although the server may choose to accept 1270 any password. The restrictions placed on anonymous users are 1271 implementation-dependent. 1273 Once authenticated (including as anonymous), it is not possible to 1274 re-enter not authenticated state. 1276 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1277 the following commands are valid in the not authenticated state: 1278 STARTTLS, AUTHENTICATE and LOGIN. See the Security Considerations 1279 section for important information about these commands. 1281 6.2.1. STARTTLS Command 1283 Arguments: none 1285 Responses: no specific response for this command 1287 Result: OK - starttls completed, begin TLS negotiation 1288 BAD - STARTTLS received after a successful TLS 1289 negotiation or arguments invalid 1291 A TLS [TLS-1.3] negotiation begins immediately after the CRLF at the 1292 end of the tagged OK response from the server. Once a client issues 1293 a STARTTLS command, it MUST NOT issue further commands until a server 1294 response is seen and the TLS negotiation is complete. 1296 The server remains in the non-authenticated state, even if client 1297 credentials are supplied during the TLS negotiation. This does not 1298 preclude an authentication mechanism such as EXTERNAL (defined in 1299 [SASL]) from using client identity determined by the TLS negotiation. 1301 Once TLS has been started, the client MUST discard cached information 1302 about server capabilities and SHOULD re-issue the CAPABILITY command. 1303 This is necessary to protect against man-in- the-middle attacks which 1304 alter the capabilities list prior to STARTTLS. The server MAY 1305 advertise different capabilities, and in particular SHOULD NOT 1306 advertise the STARTTLS capability, after a successful STARTTLS 1307 command. 1309 Example: C: a001 CAPABILITY 1310 S: * CAPABILITY IMAP4rev2 STARTTLS LOGINDISABLED 1311 S: a001 OK CAPABILITY completed 1312 C: a002 STARTTLS 1313 S: a002 OK Begin TLS negotiation now 1314 1315 C: a003 CAPABILITY 1316 S: * CAPABILITY IMAP4rev2 AUTH=PLAIN 1317 S: a003 OK CAPABILITY completed 1318 C: a004 LOGIN joe password 1319 S: a004 OK LOGIN completed 1321 6.2.2. AUTHENTICATE Command 1323 Arguments: SASL authentication mechanism name 1324 OPTIONAL initial response 1326 Responses: continuation data can be requested 1328 Result: OK - authenticate completed, now in authenticated state 1329 NO - authenticate failure: unsupported authentication 1330 mechanism, credentials rejected 1331 BAD - command unknown or arguments invalid, 1332 authentication exchange cancelled 1334 The AUTHENTICATE command indicates a [SASL] authentication mechanism 1335 to the server. If the server supports the requested authentication 1336 mechanism, it performs an authentication protocol exchange to 1337 authenticate and identify the client. It MAY also negotiate an 1338 OPTIONAL security layer for subsequent protocol interactions. If the 1339 requested authentication mechanism is not supported, the server 1340 SHOULD reject the AUTHENTICATE command by sending a tagged NO 1341 response. 1343 The AUTHENTICATE command supports the optional "initial response" 1344 feature defined in Section 5.1 of [SASL]. The client doesn't need to 1345 use it. If a SASL mechanism supports "initial response", but it is 1346 not specified by the client, the server handles this as specified in 1347 Section 3 of [SASL]. 1349 The service name specified by this protocol's profile of [SASL] is 1350 "imap". 1352 The authentication protocol exchange consists of a series of server 1353 challenges and client responses that are specific to the 1354 authentication mechanism. A server challenge consists of a command 1355 continuation request response with the "+" token followed by a BASE64 1356 encoded (see Section 4 of [RFC4648]) string. The client response 1357 consists of a single line consisting of a BASE64 encoded string. If 1358 the client wishes to cancel an authentication exchange, it issues a 1359 line consisting of a single "*". If the server receives such a 1360 response, or if it receives an invalid BASE64 string (e.g. 1361 characters outside the BASE64 alphabet, or non-terminal "="), it MUST 1362 reject the AUTHENTICATE command by sending a tagged BAD response. 1364 As with any other client response, this initial response MUST be 1365 encoded as BASE64. It also MUST be transmitted outside of a quoted 1366 string or literal. To send a zero-length initial response, the 1367 client MUST send a single pad character ("="). This indicates that 1368 the response is present, but is a zero-length string. 1370 When decoding the BASE64 data in the initial response, decoding 1371 errors MUST be treated as in any normal SASL client response, i.e. 1372 with a tagged BAD response. In particular, the server should check 1373 for any characters not explicitly allowed by the BASE64 alphabet, as 1374 well as any sequence of BASE64 characters that contains the pad 1375 character ('=') anywhere other than the end of the string (e.g., 1376 "=AAA" and "AAA=BBB" are not allowed). 1378 If the client uses an initial response with a SASL mechanism that 1379 does not support an initial response, the server MUST reject the 1380 command with a tagged BAD response. 1382 If a security layer is negotiated through the [SASL] authentication 1383 exchange, it takes effect immediately following the CRLF that 1384 concludes the authentication exchange for the client, and the CRLF of 1385 the tagged OK response for the server. 1387 While client and server implementations MUST implement the 1388 AUTHENTICATE command itself, it is not required to implement any 1389 authentication mechanisms other than the PLAIN mechanism described in 1390 [PLAIN]. Also, an authentication mechanism is not required to 1391 support any security layers. 1393 Note: a server implementation MUST implement a configuration in 1394 which it does NOT permit any plaintext password mechanisms, unless 1395 either the STARTTLS command has been negotiated or some other 1396 mechanism that protects the session from password snooping has 1397 been provided. Server sites SHOULD NOT use any configuration 1398 which permits a plaintext password mechanism without such a 1399 protection mechanism against password snooping. Client and server 1400 implementations SHOULD implement additional [SASL] mechanisms that 1401 do not use plaintext passwords, such the GSSAPI mechanism 1402 described in [SASL] and/or the SCRAM-SHA-256/SCRAM-SHA-256-PLUS 1403 [SCRAM-SHA-256] mechanisms. 1405 Servers and clients can support multiple authentication mechanisms. 1406 The server SHOULD list its supported authentication mechanisms in the 1407 response to the CAPABILITY command so that the client knows which 1408 authentication mechanisms to use. 1410 A server MAY include a CAPABILITY response code in the tagged OK 1411 response of a successful AUTHENTICATE command in order to send 1412 capabilities automatically. It is unnecessary for a client to send a 1413 separate CAPABILITY command if it recognizes these automatic 1414 capabilities. This should only be done if a security layer was not 1415 negotiated by the AUTHENTICATE command, because the tagged OK 1416 response as part of an AUTHENTICATE command is not protected by 1417 encryption/integrity checking. [SASL] requires the client to re- 1418 issue a CAPABILITY command in this case. The server MAY advertise 1419 different capabilities after a successful AUTHENTICATE command. 1421 If an AUTHENTICATE command fails with a NO response, the client MAY 1422 try another authentication mechanism by issuing another AUTHENTICATE 1423 command. It MAY also attempt to authenticate by using the LOGIN 1424 command (see Section 6.2.3 for more detail). In other words, the 1425 client MAY request authentication types in decreasing order of 1426 preference, with the LOGIN command as a last resort. 1428 The authorization identity passed from the client to the server 1429 during the authentication exchange is interpreted by the server as 1430 the user name whose privileges the client is requesting. 1432 Example: S: * OK IMAP4rev2 Server 1433 C: A001 AUTHENTICATE GSSAPI 1434 S: + 1435 C: YIIB+wYJKoZIhvcSAQICAQBuggHqMIIB5qADAgEFoQMCAQ6iBw 1436 MFACAAAACjggEmYYIBIjCCAR6gAwIBBaESGxB1Lndhc2hpbmd0 1437 b24uZWR1oi0wK6ADAgEDoSQwIhsEaW1hcBsac2hpdmFtcy5jYW 1438 Mud2FzaGluZ3Rvbi5lZHWjgdMwgdCgAwIBAaEDAgEDooHDBIHA 1439 cS1GSa5b+fXnPZNmXB9SjL8Ollj2SKyb+3S0iXMljen/jNkpJX 1440 AleKTz6BQPzj8duz8EtoOuNfKgweViyn/9B9bccy1uuAE2HI0y 1441 C/PHXNNU9ZrBziJ8Lm0tTNc98kUpjXnHZhsMcz5Mx2GR6dGknb 1442 I0iaGcRerMUsWOuBmKKKRmVMMdR9T3EZdpqsBd7jZCNMWotjhi 1443 vd5zovQlFqQ2Wjc2+y46vKP/iXxWIuQJuDiisyXF0Y8+5GTpAL 1444 pHDc1/pIGmMIGjoAMCAQGigZsEgZg2on5mSuxoDHEA1w9bcW9n 1445 FdFxDKpdrQhVGVRDIzcCMCTzvUboqb5KjY1NJKJsfjRQiBYBdE 1446 NKfzK+g5DlV8nrw81uOcP8NOQCLR5XkoMHC0Dr/80ziQzbNqhx 1447 O6652Npft0LQwJvenwDI13YxpwOdMXzkWZN/XrEqOWp6GCgXTB 1448 vCyLWLlWnbaUkZdEYbKHBPjd8t/1x5Yg== 1449 S: + YGgGCSqGSIb3EgECAgIAb1kwV6ADAgEFoQMCAQ+iSzBJoAMC 1450 AQGiQgRAtHTEuOP2BXb9sBYFR4SJlDZxmg39IxmRBOhXRKdDA0 1451 uHTCOT9Bq3OsUTXUlk0CsFLoa8j+gvGDlgHuqzWHPSQg== 1452 C: 1453 S: + YDMGCSqGSIb3EgECAgIBAAD/////6jcyG4GE3KkTzBeBiVHe 1454 ceP2CWY0SR0fAQAgAAQEBAQ= 1455 C: YDMGCSqGSIb3EgECAgIBAAD/////3LQBHXTpFfZgrejpLlLImP 1456 wkhbfa2QteAQAgAG1yYwE= 1457 S: A001 OK GSSAPI authentication successful 1459 Note: The line breaks within server challenges and client responses 1460 are for editorial clarity and are not in real authenticators. 1462 6.2.3. LOGIN Command 1464 Arguments: user name 1465 password 1467 Responses: no specific responses for this command 1469 Result: OK - login completed, now in authenticated state 1470 NO - login failure: user name or password rejected 1471 BAD - command unknown or arguments invalid 1473 The LOGIN command identifies the client to the server and carries the 1474 plaintext password authenticating this user. 1476 A server MAY include a CAPABILITY response code in the tagged OK 1477 response to a successful LOGIN command in order to send capabilities 1478 automatically. It is unnecessary for a client to send a separate 1479 CAPABILITY command if it recognizes these automatic capabilities. 1481 Example: C: a001 LOGIN SMITH SESAME 1482 S: a001 OK LOGIN completed 1484 Note: Use of the LOGIN command over an insecure network (such as the 1485 Internet) is a security risk, because anyone monitoring network 1486 traffic can obtain plaintext passwords. The LOGIN command SHOULD NOT 1487 be used except as a last resort, and it is recommended that client 1488 implementations have a means to disable any automatic use of the 1489 LOGIN command. 1491 Unless either the client is accessing IMAP service on IMAPS port 1492 [RFC8314], the STARTTLS command has been negotiated or some other 1493 mechanism that protects the session from password snooping has been 1494 provided, a server implementation MUST implement a configuration in 1495 which it advertises the LOGINDISABLED capability and does NOT permit 1496 the LOGIN command. Server sites SHOULD NOT use any configuration 1497 which permits the LOGIN command without such a protection mechanism 1498 against password snooping. A client implementation MUST NOT send a 1499 LOGIN command if the LOGINDISABLED capability is advertised. 1501 6.3. Client Commands - Authenticated State 1503 In the authenticated state, commands that manipulate mailboxes as 1504 atomic entities are permitted. Of these commands, the SELECT and 1505 EXAMINE commands will select a mailbox for access and enter the 1506 selected state. 1508 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 1509 the following commands are valid in the authenticated state: ENABLE, 1510 SELECT, EXAMINE, NAMESPACE, CREATE, DELETE, RENAME, SUBSCRIBE, 1511 UNSUBSCRIBE, LIST, STATUS, APPEND and IDLE. 1513 6.3.1. ENABLE Command 1515 Arguments: capability names 1517 Responses: no specific responses for this command 1519 Result: OK - Relevant capabilities enabled 1520 BAD - No arguments, or syntax error in an argument 1522 Several IMAP extensions allow the server to return unsolicited 1523 responses specific to these extensions in certain circumstances. 1524 However, servers cannot send those unsolicited responses (with the 1525 exception of response codes (see Section 7.1) included in tagged or 1526 untagged OK/NO/BAD responses, which can always be sent) until they 1527 know that the clients support such extensions and thus won't choke on 1528 the extension response data. 1530 The ENABLE command provides an explicit indication from the client 1531 that it supports particular extensions. It is designed such that the 1532 client can send a simple constant string with the extensions it 1533 supports, and the server will enable the shared subset that both 1534 support. 1536 The ENABLE command takes a list of capability names, and requests the 1537 server to enable the named extensions. Once enabled using ENABLE, 1538 each extension remains active until the IMAP connection is closed. 1539 For each argument, the server does the following: 1541 o If the argument is not an extension known to the server, the 1542 server MUST ignore the argument. 1544 o If the argument is an extension known to the server, and it is not 1545 specifically permitted to be enabled using ENABLE, the server MUST 1546 ignore the argument. (Note that knowing about an extension 1547 doesn't necessarily imply supporting that extension.) 1549 o If the argument is an extension that is supported by the server 1550 and that needs to be enabled, the server MUST enable the extension 1551 for the duration of the connection. Note that once an extension 1552 is enabled, there is no way to disable it. 1554 If the ENABLE command is successful, the server MUST send an untagged 1555 ENABLED response Section 7.2.1. 1557 Clients SHOULD only include extensions that need to be enabled by the 1558 server. For example, a client can enable IMAP4rev2 specific 1559 behaviour when both IMAP4rev1 and IMAP4rev2 are advertised in the 1560 CAPABILITY response. Future RFCs may add to this list. 1562 The ENABLE command is only valid in the authenticated state, before 1563 any mailbox is selected. Clients MUST NOT issue ENABLE once they 1564 SELECT/EXAMINE a mailbox; however, server implementations don't have 1565 to check that no mailbox is selected or was previously selected 1566 during the duration of a connection. 1568 The ENABLE command can be issued multiple times in a session. It is 1569 additive; i.e., "ENABLE a b", followed by "ENABLE c" is the same as a 1570 single command "ENABLE a b c". When multiple ENABLE commands are 1571 issued, each corresponding ENABLED response SHOULD only contain 1572 extensions enabled by the corresponding ENABLE command, i.e. for the 1573 above example, the ENABLED response to "ENABLE c" should not contain 1574 "a" or "b". 1576 There are no limitations on pipelining ENABLE. For example, it is 1577 possible to send ENABLE and then immediately SELECT, or a LOGIN 1578 immediately followed by ENABLE. 1580 The server MUST NOT change the CAPABILITY list as a result of 1581 executing ENABLE; i.e., a CAPABILITY command issued right after an 1582 ENABLE command MUST list the same capabilities as a CAPABILITY 1583 command issued before the ENABLE command. This is demonstrated in 1584 the following example: 1586 C: t1 CAPABILITY 1587 S: * CAPABILITY IMAP4rev2 ID LITERAL+ X-GOOD-IDEA 1588 S: t1 OK foo 1589 C: t2 ENABLE CONDSTORE X-GOOD-IDEA 1590 S: * ENABLED X-GOOD-IDEA 1591 S: t2 OK foo 1592 C: t3 CAPABILITY 1593 S: * CAPABILITY IMAP4rev2 ID LITERAL+ X-GOOD-IDEA 1594 S: t3 OK foo again 1596 In the following example, the client enables CONDSTORE: 1598 C: a1 ENABLE CONDSTORE 1599 S: * ENABLED CONDSTORE 1600 S: a1 OK Conditional Store enabled 1602 6.3.1.1. Note to Designers of Extensions That May Use the ENABLE 1603 Command 1605 Designers of IMAP extensions are discouraged from creating extensions 1606 that require ENABLE unless there is no good alternative design. 1607 Specifically, extensions that cause potentially incompatible behavior 1608 changes to deployed server responses (and thus benefit from ENABLE) 1609 have a higher complexity cost than extensions that do not. 1611 6.3.2. SELECT Command 1613 Arguments: mailbox name 1615 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1616 REQUIRED OK untagged responses: PERMANENTFLAGS, 1617 UIDNEXT, UIDVALIDITY 1618 REQUIRED untagged response: LIST 1620 Result: OK - select completed, now in selected state 1621 NO - select failure, now in authenticated state: no 1622 such mailbox, can't access mailbox 1623 BAD - command unknown or arguments invalid 1625 The SELECT command selects a mailbox so that messages in the mailbox 1626 can be accessed. Before returning an OK to the client, the server 1627 MUST send the following untagged data to the client. (The order of 1628 individual responses is not important.) Note that earlier versions 1629 of this protocol (e.g. IMAP2bis) only required the FLAGS and EXISTS 1630 untagged data; consequently, client implementations SHOULD implement 1631 default behavior for missing data as discussed with the individual 1632 item. 1634 FLAGS Defined flags in the mailbox. See the description of the 1635 FLAGS response for more detail. 1637 EXISTS The number of messages in the mailbox. See the 1638 description of the EXISTS response for more detail. 1640 LIST The server MUST return a LIST response with the mailbox name. 1641 If the server allows de-normalized UTF-8 mailbox names (see 1642 Section 5.1) and the supplied mailbox name differs from the 1643 normalized version, the server MUST return LIST with the OLDNAME 1644 extended data item. See Section 6.3.9.7 for more details. 1646 OK [PERMANENTFLAGS ()] A list of message flags that 1647 the client can change permanently. If this is missing, the client 1648 should assume that all flags can be changed permanently. 1650 OK [UIDNEXT ] The next unique identifier value. Refer to 1651 Section 2.3.1.1 for more information. 1653 OK [UIDVALIDITY ] The unique identifier validity value. Refer to 1654 Section 2.3.1.1 for more information. 1656 Only one mailbox can be selected at a time in a connection; 1657 simultaneous access to multiple mailboxes requires multiple 1658 connections. The SELECT command automatically deselects any 1659 currently selected mailbox before attempting the new selection. 1660 Consequently, if a mailbox is selected and a SELECT command that 1661 fails is attempted, no mailbox is selected. When deselecting a 1662 selected mailbox, the server MUST return an untagged OK response with 1663 the "[CLOSED]" response code when the currently selected mailbox is 1664 closed (see Paragraph 10). 1666 If the client is permitted to modify the mailbox, the server SHOULD 1667 prefix the text of the tagged OK response with the "[READ-WRITE]" 1668 response code. 1670 If the client is not permitted to modify the mailbox but is permitted 1671 read access, the mailbox is selected as read-only, and the server 1672 MUST prefix the text of the tagged OK response to SELECT with the 1673 "[READ-ONLY]" response code. Read-only access through SELECT differs 1674 from the EXAMINE command in that certain read-only mailboxes MAY 1675 permit the change of permanent state on a per-user (as opposed to 1676 global) basis. Netnews messages marked in a server-based .newsrc 1677 file are an example of such per-user permanent state that can be 1678 modified with read-only mailboxes. 1680 Example: C: A142 SELECT INBOX 1681 S: * 172 EXISTS 1682 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1683 S: * OK [UIDNEXT 4392] Predicted next UID 1684 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1685 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited 1686 S: * LIST () "/" INBOX 1687 S: A142 OK [READ-WRITE] SELECT completed 1689 Example: C: A142 SELECT INBOX 1690 S: * 172 EXISTS 1691 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1692 S: * OK [UIDNEXT 4392] Predicted next UID 1693 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1694 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited 1695 S: A142 OK [READ-WRITE] SELECT completed 1696 [...some time later...] 1697 C: A143 SELECT Drafts 1698 S: * OK [CLOSED] Previous mailbox is now closed 1699 S: * 5 EXISTS 1700 S: * OK [UIDVALIDITY 9877410381] UIDs valid 1701 S: * OK [UIDNEXT 102] Predicted next UID 1702 S: * LIST () "/" Drafts 1703 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1704 S: * OK [PERMANENTFLAGS (\Deleted \Seen \Answered 1705 \Flagged \Draft \*)] System flags and keywords allowed 1706 S: A143 OK [READ-WRITE] SELECT completed 1708 Note that IMAP4rev1 compliant servers can also send the untagged 1709 RECENT response which was deprecated in IMAP4rev2. E.g. "* 0 1710 RECENT". Pure IMAP4rev2 clients are advised to ignore the untagged 1711 RECENT response. 1713 6.3.3. EXAMINE Command 1715 Arguments: mailbox name 1717 Responses: REQUIRED untagged responses: FLAGS, EXISTS 1718 REQUIRED OK untagged responses: PERMANENTFLAGS, 1719 UIDNEXT, UIDVALIDITY 1720 REQUIRED untagged response: LIST 1722 Result: OK - examine completed, now in selected state 1723 NO - examine failure, now in authenticated state: no 1724 such mailbox, can't access mailbox BAD - command unknown 1725 or arguments invalid 1727 The EXAMINE command is identical to SELECT and returns the same 1728 output; however, the selected mailbox is identified as read-only. No 1729 changes to the permanent state of the mailbox, including per-user 1730 state, are permitted. 1732 The text of the tagged OK response to the EXAMINE command MUST begin 1733 with the "[READ-ONLY]" response code. 1735 Example: C: A932 EXAMINE blurdybloop 1736 S: * 17 EXISTS 1737 S: * OK [UIDVALIDITY 3857529045] UIDs valid 1738 S: * OK [UIDNEXT 4392] Predicted next UID 1739 S: * LIST () "/" blurdybloop 1740 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 1741 S: * OK [PERMANENTFLAGS ()] No permanent flags permitted 1742 S: A932 OK [READ-ONLY] EXAMINE completed 1744 6.3.4. CREATE Command 1746 Arguments: mailbox name 1748 Responses: OPTIONAL untagged response: LIST 1750 Result: OK - create completed 1751 NO - create failure: can't create mailbox with that name 1752 BAD - command unknown or arguments invalid 1754 The CREATE command creates a mailbox with the given name. An OK 1755 response is returned only if a new mailbox with that name has been 1756 created. It is an error to attempt to create INBOX or a mailbox with 1757 a name that refers to an extant mailbox. Any error in creation will 1758 return a tagged NO response. If a client attempts to create a UTF-8 1759 mailbox name that is not a valid Net-Unicode name, the server MUST 1760 reject the creation or convert the name to Net-Unicode prior to 1761 creating the mailbox. If the server decides to convert (normalize) 1762 the name, it SHOULD return an untagged LIST with OLDNAME extended 1763 data item, with the OLDNAME value being the supplied mailbox name and 1764 the name parameter being the normalized mailbox name. (See 1765 Section 6.3.9.7 for more details.) 1767 Mailboxes created in one IMAP session MAY be announced to other IMAP 1768 sessions using unsolicited LIST response. If the server 1769 automatically subscribes a mailbox when it is created, then the 1770 unsolicited LIST response for each affected subscribed mailbox name 1771 MUST include the \Subscribed attribute. 1773 If the mailbox name is suffixed with the server's hierarchy separator 1774 character (as returned from the server by a LIST command), this is a 1775 declaration that the client intends to create mailbox names under 1776 this name in the hierarchy. Server implementations that do not 1777 require this declaration MUST ignore the declaration. In any case, 1778 the name created is without the trailing hierarchy delimiter. 1780 If the server's hierarchy separator character appears elsewhere in 1781 the name, the server SHOULD create any superior hierarchical names 1782 that are needed for the CREATE command to be successfully completed. 1783 In other words, an attempt to create "foo/bar/zap" on a server in 1784 which "/" is the hierarchy separator character SHOULD create foo/ and 1785 foo/bar/ if they do not already exist. 1787 If a new mailbox is created with the same name as a mailbox which was 1788 deleted, its unique identifiers MUST be greater than any unique 1789 identifiers used in the previous incarnation of the mailbox UNLESS 1790 the new incarnation has a different unique identifier validity value. 1791 See the description of the UID command for more detail. 1793 Example: C: A003 CREATE owatagusiam/ 1794 S: A003 OK CREATE completed 1795 C: A004 CREATE owatagusiam/blurdybloop 1796 S: A004 OK CREATE completed 1797 C: A005 CREATE NonNormalized 1798 S: * LIST () "/" "Normalized" ("OLDNAME" ("NonNormalized")) 1799 S: A005 OK CREATE completed 1801 (in the last example imagine that "NonNormalized" is 1802 a non NFC normalized Unicode mailbox name and that 1803 "Normalized" is its NFC normalized version.) 1805 Note: The interpretation of this example depends on whether "/" 1806 was returned as the hierarchy separator from LIST. If "/" is the 1807 hierarchy separator, a new level of hierarchy named "owatagusiam" 1808 with a member called "blurdybloop" is created. Otherwise, two 1809 mailboxes at the same hierarchy level are created. 1811 6.3.5. DELETE Command 1813 Arguments: mailbox name 1815 Responses: OPTIONAL untagged response: LIST 1817 Result: OK - delete completed 1818 NO - delete failure: can't delete mailbox with that name 1819 BAD - command unknown or arguments invalid 1821 The DELETE command permanently removes the mailbox with the given 1822 name. A tagged OK response is returned only if the mailbox has been 1823 deleted. It is an error to attempt to delete INBOX or a mailbox name 1824 that does not exist. 1826 The DELETE command MUST NOT remove inferior hierarchical names. For 1827 example, if a mailbox "foo" has an inferior "foo.bar" (assuming "." 1828 is the hierarchy delimiter character), removing "foo" MUST NOT remove 1829 "foo.bar". It is an error to attempt to delete a name that has 1830 inferior hierarchical names and also has the \Noselect mailbox name 1831 attribute (see the description of the LIST response for more 1832 details). 1834 It is permitted to delete a name that has inferior hierarchical names 1835 and does not have the \Noselect mailbox name attribute. If the 1836 server implementation does not permit deleting the name while 1837 inferior hierarchical names exists then it SHOULD disallow the DELETE 1838 command by returning a tagged NO response. The NO response SHOULD 1839 include the HASCHILDREN response code. Alternatively the server MAY 1840 allow the DELETE command, but sets the \Noselect mailbox name 1841 attribute for that name. 1843 If the server returns OK response, all messages in that mailbox are 1844 removed by the DELETE command. 1846 The value of the highest-used unique identifier of the deleted 1847 mailbox MUST be preserved so that a new mailbox created with the same 1848 name will not reuse the identifiers of the former incarnation, UNLESS 1849 the new incarnation has a different unique identifier validity value. 1850 See the description of the UID command for more detail. 1852 If the server decides to convert (normalize) the mailbox name, it 1853 SHOULD return an untagged LIST with the "\NonExistent" attribute and 1854 OLDNAME extended data item, with the OLDNAME value being the supplied 1855 mailbox name and the name parameter being the normalized mailbox 1856 name. (See Section 6.3.9.7 for more details.) 1858 Mailboxes deleted in one IMAP session MAY be announced to other IMAP 1859 sessions using unsolicited LIST response, containing the 1860 "\NonExistent" attribute. 1862 Examples: C: A682 LIST "" * 1863 S: * LIST () "/" blurdybloop 1864 S: * LIST (\Noselect) "/" foo 1865 S: * LIST () "/" foo/bar 1866 S: A682 OK LIST completed 1867 C: A683 DELETE blurdybloop 1868 S: A683 OK DELETE completed 1869 C: A684 DELETE foo 1870 S: A684 NO Name "foo" has inferior hierarchical names 1871 C: A685 DELETE foo/bar 1872 S: A685 OK DELETE Completed 1873 C: A686 LIST "" * 1874 S: * LIST (\Noselect) "/" foo 1875 S: A686 OK LIST completed 1876 C: A687 DELETE foo 1877 S: A687 OK DELETE Completed 1878 C: A82 LIST "" * 1879 S: * LIST () "." blurdybloop 1880 S: * LIST () "." foo 1881 S: * LIST () "." foo.bar 1882 S: A82 OK LIST completed 1883 C: A83 DELETE blurdybloop 1884 S: A83 OK DELETE completed 1885 C: A84 DELETE foo 1886 S: A84 OK DELETE Completed 1887 C: A85 LIST "" * 1888 S: * LIST () "." foo.bar 1889 S: A85 OK LIST completed 1890 C: A86 LIST "" % 1891 S: * LIST (\Noselect) "." foo 1892 S: A86 OK LIST completed 1894 6.3.6. RENAME Command 1896 Arguments: existing mailbox name 1897 new mailbox name 1899 Responses: OPTIONAL untagged response: LIST 1901 Result: OK - rename completed 1902 NO - rename failure: can't rename mailbox with that name, 1903 can't rename to mailbox with that name 1904 BAD - command unknown or arguments invalid 1906 The RENAME command changes the name of a mailbox. A tagged OK 1907 response is returned only if the mailbox has been renamed. It is an 1908 error to attempt to rename from a mailbox name that does not exist or 1909 to a mailbox name that already exists. Any error in renaming will 1910 return a tagged NO response. 1912 If the name has inferior hierarchical names, then the inferior 1913 hierarchical names MUST also be renamed. For example, a rename of 1914 "foo" to "zap" will rename "foo/bar" (assuming "/" is the hierarchy 1915 delimiter character) to "zap/bar". 1917 If the server's hierarchy separator character appears in the name, 1918 the server SHOULD create any superior hierarchical names that are 1919 needed for the RENAME command to complete successfully. In other 1920 words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a 1921 server in which "/" is the hierarchy separator character in the 1922 corresponding namespace SHOULD create baz/ and baz/rag/ if they do 1923 not already exist. 1925 The value of the highest-used unique identifier of the old mailbox 1926 name MUST be preserved so that a new mailbox created with the same 1927 name will not reuse the identifiers of the former incarnation, UNLESS 1928 the new incarnation has a different unique identifier validity value. 1929 See the description of the UID command for more detail. 1931 Renaming INBOX is permitted, and has special behavior. (Note that 1932 some servers disallow renaming INBOX, so clients need to be able to 1933 handle such RENAME failing). It moves all messages in INBOX to a new 1934 mailbox with the given name, leaving INBOX empty. If the server 1935 implementation supports inferior hierarchical names of INBOX, these 1936 are unaffected by a rename of INBOX. 1938 If the server allows creation of mailboxes with names that are not 1939 valid Net-Unicode names, the server normalizes both the existing 1940 mailbox name parameter and the new mailbox name parameter. If the 1941 normalized version of any of these 2 parameters differs from the 1942 corresponding supplied version, the server SHOULD return an untagged 1943 LIST response with OLDNAME extended data item, with the OLDNAME value 1944 being the supplied existing mailbox name and the name parameter being 1945 the normalized new mailbox name (see Section 6.3.9.7). This would 1946 allow the client to correlate supplied name with the normalized name. 1948 Mailboxes renamed in one IMAP session MAY be announced to other IMAP 1949 sessions using unsolicited LIST response with OLDNAME extended data 1950 item. 1952 In both of the above cases: if the server automatically subscribes a 1953 mailbox when it is renamed, then the unsolicited LIST response for 1954 each affected subscribed mailbox name MUST include the \Subscribed 1955 attribute. No unsolicited LIST responses need to be sent for 1956 children mailboxes, if any. When INBOX is successfully renamed, a 1957 new INBOX is assumed to be created. No unsolicited LIST responses 1958 need to be sent for INBOX in this case. 1960 Examples: C: A682 LIST "" * 1961 S: * LIST () "/" blurdybloop 1962 S: * LIST (\Noselect) "/" foo 1963 S: * LIST () "/" foo/bar 1964 S: A682 OK LIST completed 1965 C: A683 RENAME blurdybloop sarasoop 1966 S: A683 OK RENAME completed 1967 C: A684 RENAME foo zowie 1968 S: A684 OK RENAME Completed 1969 C: A685 LIST "" * 1970 S: * LIST () "/" sarasoop 1971 S: * LIST (\Noselect) "/" zowie 1972 S: * LIST () "/" zowie/bar 1973 S: A685 OK LIST completed 1975 C: Z432 LIST "" * 1976 S: * LIST () "." INBOX 1977 S: * LIST () "." INBOX.bar 1978 S: Z432 OK LIST completed 1979 C: Z433 RENAME INBOX old-mail 1980 S: Z433 OK RENAME completed 1981 C: Z434 LIST "" * 1982 S: * LIST () "." INBOX 1983 S: * LIST () "." INBOX.bar 1984 S: * LIST () "." old-mail 1985 S: Z434 OK LIST completed 1987 Note that renaming a mailbox doesn't update subscription information 1988 on the original name. To keep subscription information in sync, the 1989 following sequence of commands can be used: 1991 C: 1001 RENAME X Y 1992 C: 1002 SUBSCRIBE Y 1993 C: 1003 UNSUBSCRIBE X 1995 Note that the above sequence of commands doesn't account for updating 1996 subscription for any children mailboxes of mailbox X. 1998 6.3.7. SUBSCRIBE Command 2000 Arguments: mailbox 2002 Responses: no specific responses for this command 2004 Result: OK - subscribe completed 2005 NO - subscribe failure: can't subscribe to that name 2006 BAD - command unknown or arguments invalid 2008 The SUBSCRIBE command adds the specified mailbox name to the server's 2009 set of "active" or "subscribed" mailboxes as returned by the LIST 2010 (SUBSCRIBED) command. This command returns a tagged OK response if 2011 the subscription is successful or if the mailbox is already 2012 subscribed. 2014 A server MAY validate the mailbox argument to SUBSCRIBE to verify 2015 that it exists. However, it SHOULD NOT unilaterally remove an 2016 existing mailbox name from the subscription list even if a mailbox by 2017 that name no longer exists. 2019 Note: This requirement is because a server site can choose to 2020 routinely remove a mailbox with a well-known name (e.g., "system- 2021 alerts") after its contents expire, with the intention of 2022 recreating it when new contents are appropriate. 2024 Example: C: A002 SUBSCRIBE #news.comp.mail.mime 2025 S: A002 OK SUBSCRIBE completed 2027 6.3.8. UNSUBSCRIBE Command 2029 Arguments: mailbox name 2031 Responses: no specific responses for this command 2033 Result: OK - unsubscribe completed 2034 NO - unsubscribe failure: can't unsubscribe that name 2035 BAD - command unknown or arguments invalid 2037 The UNSUBSCRIBE command removes the specified mailbox name from the 2038 server's set of "active" or "subscribed" mailboxes as returned by the 2039 LIST (SUBSCRIBED) command. This command returns a tagged OK response 2040 if the unsubscription is successful or if the mailbox is not 2041 subscribed. 2043 Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime 2044 S: A002 OK UNSUBSCRIBE completed 2046 6.3.9. LIST Command 2048 Arguments (basic): reference name 2049 mailbox name with possible wildcards 2051 Arguments (extended): selection options (OPTIONAL) 2052 reference name 2053 mailbox patterns 2054 return options (OPTIONAL) 2056 Responses: untagged responses: LIST 2058 Result: OK - list completed 2059 NO - list failure: can't list that reference or name 2060 BAD - command unknown or arguments invalid 2062 The LIST command returns a subset of names from the complete set of 2063 all names available to the client. Zero or more untagged LIST 2064 replies are returned, containing the name attributes, hierarchy 2065 delimiter, name, and possible extension information; see the 2066 description of the LIST reply for more detail. 2068 The LIST command SHOULD return its data quickly, without undue delay. 2069 For example, it SHOULD NOT go to excess trouble to calculate the 2070 \Marked or \Unmarked status or perform other processing; if each name 2071 requires 1 second of processing, then a list of 1200 names would take 2072 20 minutes! 2074 The extended LIST command, originally introduced in [RFC5258], 2075 provides capabilities beyond that of the original IMAP LIST command. 2076 The extended syntax is being used if one or more of the following 2077 conditions is true: 2079 1. if the first word after the command name begins with a 2080 parenthesis ("LIST selection options"); 2082 2. if the second word after the command name begins with a 2083 parenthesis; 2085 3. if the LIST command has more than 2 parameters ("LIST return 2086 options") 2088 An empty ("" string) reference name argument indicates that the 2089 mailbox name is interpreted as by SELECT. The returned mailbox names 2090 MUST match the supplied mailbox name pattern(s). A non-empty 2091 reference name argument is the name of a mailbox or a level of 2092 mailbox hierarchy, and indicates the context in which the mailbox 2093 name is interpreted. Clients SHOULD use the empty reference 2094 argument. 2096 In the basic syntax only, an empty ("" string) mailbox name argument 2097 is a special request to return the hierarchy delimiter and the root 2098 name of the name given in the reference. The value returned as the 2099 root MAY be the empty string if the reference is non-rooted or is an 2100 empty string. In all cases, a hierarchy delimiter (or NIL if there 2101 is no hierarchy) is returned. This permits a client to get the 2102 hierarchy delimiter (or find out that the mailbox names are flat) 2103 even when no mailboxes by that name currently exist. 2105 In the extended syntax, any mailbox name arguments that are empty 2106 strings are ignored. There is no special meaning for empty mailbox 2107 names when the extended syntax is used. 2109 The reference and mailbox name arguments are interpreted into a 2110 canonical form that represents an unambiguous left-to-right 2111 hierarchy. The returned mailbox names will be in the interpreted 2112 form, that we call "canonical LIST pattern" later in this document. 2113 To define the term "canonical LIST pattern" formally: it refers to 2114 the canonical pattern constructed internally by the server from the 2115 reference and mailbox name arguments. 2117 Note: The interpretation of the reference argument is 2118 implementation-defined. It depends upon whether the server 2119 implementation has a concept of the "current working directory" 2120 and leading "break out characters", which override the current 2121 working directory. 2123 For example, on a server which exports a UNIX or NT filesystem, 2124 the reference argument contains the current working directory, and 2125 the mailbox name argument would contain the name as interpreted in 2126 the current working directory. 2128 If a server implementation has no concept of break out characters, 2129 the canonical form is normally the reference name appended with 2130 the mailbox name. Note that if the server implements the 2131 namespace convention (Section 5.1.2.1), "#" is a break out 2132 character and must be treated as such. 2134 If the reference argument is not a level of mailbox hierarchy 2135 (that is, it is a \NoInferiors name), and/or the reference 2136 argument does not end with the hierarchy delimiter, it is 2137 implementation-dependent how this is interpreted. For example, a 2138 reference of "foo/bar" and mailbox name of "rag/baz" could be 2139 interpreted as "foo/bar/rag/baz", "foo/barrag/baz", or "foo/rag/ 2140 baz". A client SHOULD NOT use such a reference argument except at 2141 the explicit request of the user. A hierarchical browser MUST NOT 2142 make any assumptions about server interpretation of the reference 2143 unless the reference is a level of mailbox hierarchy AND ends with 2144 the hierarchy delimiter. 2146 Any part of the reference argument that is included in the 2147 interpreted form SHOULD prefix the interpreted form. It SHOULD also 2148 be in the same form as the reference name argument. This rule 2149 permits the client to determine if the returned mailbox name is in 2150 the context of the reference argument, or if something about the 2151 mailbox argument overrode the reference argument. Without this rule, 2152 the client would have to have knowledge of the server's naming 2153 semantics including what characters are "breakouts" that override a 2154 naming context. 2156 For example, here are some examples of how references 2157 and mailbox names might be interpreted on a UNIX-based 2158 server: 2160 Reference Mailbox Name Interpretation 2161 ------------ ------------ -------------- 2162 ~smith/Mail/ foo.* ~smith/Mail/foo.* 2163 archive/ % archive/% 2164 #news. comp.mail.* #news.comp.mail.* 2165 ~smith/Mail/ /usr/doc/foo /usr/doc/foo 2166 archive/ ~fred/Mail/* ~fred/Mail/* 2168 The first three examples demonstrate interpretations in 2169 the context of the reference argument. Note that 2170 "~smith/Mail" SHOULD NOT be transformed into something 2171 like "/u2/users/smith/Mail", or it would be impossible 2172 for the client to determine that the interpretation was 2173 in the context of the reference. 2175 The character "*" is a wildcard, and matches zero or more characters 2176 at this position. The character "%" is similar to "*", but it does 2177 not match a hierarchy delimiter. If the "%" wildcard is the last 2178 character of a mailbox name argument, matching levels of hierarchy 2179 are also returned. If these levels of hierarchy are not also 2180 selectable mailboxes, they are returned with the \Noselect mailbox 2181 name attribute (see the description of the LIST response for more 2182 details). 2184 Any syntactically valid pattern that is not accepted by a server for 2185 any reason MUST be silently ignored. I.e. it results in no LIST 2186 responses and the LIST command still returns tagged OK response. 2188 Selection options tell the server to limit the mailbox names that are 2189 selected by the LIST operation. If selection options are used, the 2190 mailboxes returned are those that match both the list of canonical 2191 LIST patterns and the selection options. Unless a particular 2192 selection option provides special rules, the selection options are 2193 cumulative: a mailbox that matches the mailbox patterns is selected 2194 only if it also matches all of the selection options. (An example of 2195 a selection option with special rules is the RECURSIVEMATCH option.) 2196 Return options control what information is returned for each matched 2197 mailbox. Return options MUST NOT cause the server to report 2198 information about additional mailbox names other than those that 2199 match the canonical LIST patterns and selection options. If no 2200 return options are specified, the client is only expecting 2201 information about mailbox attributes. The server MAY return other 2202 information about the matched mailboxes, and clients MUST be able to 2203 handle that situation. 2205 Initial selection options and return options are defined in the 2206 following subsections, and new ones will also be defined in 2207 extensions. Initial options defined in this document MUST be 2208 supported. Each non-initial option will be enabled by a capability 2209 string (one capability may enable multiple options), and a client 2210 MUST NOT send an option for which the server has not advertised 2211 support. A server MUST respond to options it does not recognize with 2212 a BAD response. The client SHOULD NOT specify any option more than 2213 once; however, if the client does this, the server MUST act as if it 2214 received the option only once. The order in which options are 2215 specified by the client is not significant. 2217 In general, each selection option except RECURSIVEMATCH will have a 2218 corresponding return option with the same name. The REMOTE selection 2219 option is an anomaly in this regard, and does not have a 2220 corresponding return option. That is because it expands, rather than 2221 restricts, the set of mailboxes that are returned. Future extensions 2222 to this specification should keep this parallelism in mind and define 2223 a pair of corresponding selection and return options. 2225 Server implementations are permitted to "hide" otherwise accessible 2226 mailboxes from the wildcard characters, by preventing certain 2227 characters or names from matching a wildcard in certain situations. 2228 For example, a UNIX-based server might restrict the interpretation of 2229 "*" so that an initial "/" character does not match. 2231 The special name INBOX is included in the output from LIST, if INBOX 2232 is supported by this server for this user and if the uppercase string 2233 "INBOX" matches the interpreted reference and mailbox name arguments 2234 with wildcards as described above. The criteria for omitting INBOX 2235 is whether SELECT INBOX will return failure; it is not relevant 2236 whether the user's real INBOX resides on this or some other server. 2238 6.3.9.1. LIST Selection Options 2240 The selection options defined in this specification are as follows: 2242 SUBSCRIBED - causes the LIST command to list subscribed names, 2243 rather than the existing mailboxes. This will often be a subset 2244 of the actual mailboxes. It's also possible for this list to 2245 contain the names of mailboxes that don't exist. In any case, the 2246 list MUST include exactly those mailbox names that match the 2247 canonical list pattern and are subscribed to. 2249 This option defines a mailbox attribute, "\Subscribed", that 2250 indicates that a mailbox name is subscribed to. The "\Subscribed" 2251 attribute MUST be supported and MUST be accurately computed when 2252 the SUBSCRIBED selection option is specified. 2254 Note that the SUBSCRIBED selection option implies the SUBSCRIBED 2255 return option (see below). 2257 REMOTE - causes the LIST command to show remote mailboxes as well as 2258 local ones, as described in [RFC2193]. This option is intended to 2259 replace the RLIST command and, in conjunction with the SUBSCRIBED 2260 selection option, the RLSUB command. Servers that don't support 2261 remote mailboxes just ignore this option. 2263 This option defines a mailbox attribute, "\Remote", that indicates 2264 that a mailbox is a remote mailbox. The "\Remote" attribute MUST 2265 be accurately computed when the REMOTE option is specified. 2267 The REMOTE selection option has no interaction with other options. 2268 Its effect is to tell the server to apply the other options, if 2269 any, to remote mailboxes, in addition to local ones. In 2270 particular, it has no interaction with RECURSIVEMATCH (see below). 2271 A request for (REMOTE RECURSIVEMATCH) is invalid, because a 2272 request for (RECURSIVEMATCH) is also invalid. A request for 2273 (REMOTE RECURSIVEMATCH SUBSCRIBED) is asking for all subscribed 2274 mailboxes, both local and remote. 2276 RECURSIVEMATCH - this option forces the server to return information 2277 about parent mailboxes that don't match other selection options, 2278 but have some submailboxes that do. Information about children is 2279 returned in the CHILDINFO extended data item, as described in 2280 Section 6.3.9.6. 2282 Note 1: In order for a parent mailbox to be returned, it still has 2283 to match the canonical LIST pattern. 2285 Note 2: When returning the CHILDINFO extended data item, it 2286 doesn't matter whether or not the submailbox matches the canonical 2287 LIST pattern. See also example 9 in Section 6.3.9.8. 2289 The RECURSIVEMATCH option MUST NOT occur as the only selection 2290 option (or only with REMOTE), as it only makes sense when other 2291 selection options are also used. The server MUST return BAD 2292 tagged response in such case. 2294 Note that even if the RECURSIVEMATCH option is specified, the 2295 client MUST still be able to handle a case when a CHILDINFO 2296 extended data item is returned and there are no submailboxes that 2297 meet the selection criteria of the subsequent LIST command, as 2298 they can be deleted/renamed after the LIST response was sent, but 2299 before the client had a chance to access them. 2301 6.3.9.2. LIST Return Options 2303 The return options defined in this specification are as follows: 2305 SUBSCRIBED - causes the LIST command to return subscription state 2306 for all matching mailbox names. The "\Subscribed" attribute MUST 2307 be supported and MUST be accurately computed when the SUBSCRIBED 2308 return option is specified. Further, all mailbox flags MUST be 2309 accurately computed (this differs from the behavior of the 2310 obsolete LSUB command from IMAP4rev1). 2312 CHILDREN - requests mailbox child information as originally proposed 2313 in [RFC3348]. See Section 6.3.9.5, below, for details. This 2314 option MUST be supported by all servers. 2316 STATUS - requests STATUS response for each matching mailbox. 2318 This option takes STATUS data items as parameters. For each 2319 selectable mailbox matching the list pattern and selection 2320 options, the server MUST return an untagged LIST response 2321 followed by an untagged STATUS response containing the 2322 information requested in the STATUS return option, except for 2323 some cases described below. 2325 If an attempted STATUS for a listed mailbox fails because the 2326 mailbox can't be selected (e.g., if the "l" ACL right [RFC4314] 2327 is granted to the mailbox and the "r" right is not granted, or 2328 due to a race condition between LIST and STATUS changing the 2329 mailbox to \NoSelect), the STATUS response MUST NOT be returned 2330 and the LIST response MUST include the \NoSelect attribute. 2331 This means the server may have to buffer the LIST reply until 2332 it has successfully looked up the necessary STATUS information. 2334 If the server runs into unexpected problems while trying to 2335 look up the STATUS information, it MAY drop the corresponding 2336 STATUS reply. In such a situation, the LIST command would 2337 still return a tagged OK reply. 2339 6.3.9.3. General Principles for Returning LIST Responses 2341 This section outlines several principles that can be used by server 2342 implementations of this document to decide whether a LIST response 2343 should be returned, as well as how many responses and what kind of 2344 information they may contain. 2346 1. At most one LIST response should be returned for each mailbox 2347 name that matches the canonical LIST pattern. Server 2348 implementors must not assume that clients will be able to 2349 assemble mailbox attributes and other information returned in 2350 multiple LIST responses. 2352 2. There are only two reasons for including a matching mailbox name 2353 in the responses to the LIST command (note that the server is 2354 allowed to return unsolicited responses at any time, and such 2355 responses are not governed by this rule): 2357 A. The mailbox name also satisfies the selection criteria. 2359 B. The mailbox name doesn't satisfy the selection criteria, but 2360 it has at least one descendant mailbox name that satisfies 2361 the selection criteria and that doesn't match the canonical 2362 LIST pattern. 2364 For more information on this case, see the CHILDINFO extended 2365 data item described in Section 6.3.9.6. Note that the 2366 CHILDINFO extended data item can only be returned when the 2367 RECURSIVEMATCH selection option is specified. 2369 3. Attributes returned in the same LIST response must be treated 2370 additively. For example, the following response 2372 S: * LIST (\Subscribed \NonExistent) "/" "Fruit/Peach" 2374 means that the "Fruit/Peach" mailbox doesn't exist, but it is 2375 subscribed. 2377 6.3.9.4. Additional LIST-related Requirements on Clients 2379 All clients MUST treat a LIST attribute with a stronger meaning as 2380 implying any attribute that can be inferred from it. (See 2381 Section 7.2.3 for the list of currently defined attributes). For 2382 example, the client must treat the presence of the \NoInferiors 2383 attribute as if the \HasNoChildren attribute was also sent by the 2384 server. 2386 The following table summarizes inference rules. 2388 +--------------------+-------------------+ 2389 | returned attribute | implied attribute | 2390 +--------------------+-------------------+ 2391 | \NoInferiors | \HasNoChildren | 2392 | \NonExistent | \NoSelect | 2393 +--------------------+-------------------+ 2395 6.3.9.5. The CHILDREN Return Option 2397 The CHILDREN return option is simply an indication that the client 2398 wants information about whether or not mailboxes contain children 2399 mailboxes; a server MAY provide it even if the option is not 2400 specified. 2402 Many IMAP4 clients present to the user a hierarchical view of the 2403 mailboxes that a user has access to. Rather than initially 2404 presenting to the user the entire mailbox hierarchy, it is often 2405 preferable to show to the user a collapsed outline list of the 2406 mailbox hierarchy (particularly if there is a large number of 2407 mailboxes). The user can then expand the collapsed outline hierarchy 2408 as needed. It is common to include within the collapsed hierarchy a 2409 visual clue (such as a ''+'') to indicate that there are child 2410 mailboxes under a particular mailbox. When the visual clue is 2411 clicked, the hierarchy list is expanded to show the child mailboxes. 2412 The CHILDREN return option provides a mechanism for a client to 2413 efficiently determine whether a particular mailbox has children, 2414 without issuing a LIST "" * or a LIST "" % for each mailbox name. 2415 The CHILDREN return option defines two new attributes that MUST be 2416 returned within a LIST response: \HasChildren and \HasNoChildren. 2417 Although these attributes MAY be returned in response to any LIST 2418 command, the CHILDREN return option is provided to indicate that the 2419 client particularly wants this information. If the CHILDREN return 2420 option is present, the server MUST return these attributes even if 2421 their computation is expensive. 2423 \HasChildren 2425 The presence of this attribute indicates that the mailbox has 2426 child mailboxes. A server SHOULD NOT set this attribute if 2427 there are child mailboxes and the user does not have permission 2428 to access any of them. In this case, \HasNoChildren SHOULD be 2429 used. In many cases, however, a server may not be able to 2430 efficiently compute whether a user has access to any child 2431 mailbox. Note that even though the \HasChildren attribute for a 2432 mailbox must be correct at the time of processing of the 2433 mailbox, a client must be prepared to deal with a situation when 2434 a mailbox is marked with the \HasChildren attribute, but no 2435 child mailbox appears in the response to the LIST command. This 2436 might happen, for example, due to children mailboxes being 2437 deleted or made inaccessible to the user (using access control) 2438 by another client before the server is able to list them. 2440 \HasNoChildren 2442 The presence of this attribute indicates that the mailbox has NO 2443 child mailboxes that are accessible to the currently 2444 authenticated user. 2446 It is an error for the server to return both a \HasChildren and a 2447 \HasNoChildren attribute in the same LIST response. 2449 Note: the \HasNoChildren attribute should not be confused with the 2450 the \NoInferiors attribute, which indicates that no child mailboxes 2451 exist now and none can be created in the future. 2453 6.3.9.6. CHILDINFO Extended Data Item 2455 The CHILDINFO extended data item MUST NOT be returned unless the 2456 client has specified the RECURSIVEMATCH selection option. 2458 The CHILDINFO extended data item in a LIST response describes the 2459 selection criteria that has caused it to be returned and indicates 2460 that the mailbox has at least one descendant mailbox that matches the 2461 selection criteria. 2463 Note: Some servers allow for mailboxes to exist without requiring 2464 their parent to exist. For example, a mailbox "Customers/ABC" can 2465 exist while the mailbox "Customers" does not. As CHILDINFO extended 2466 data item is not allowed if the RECURSIVEMATCH selection option is 2467 not specified, such servers SHOULD use the "\NonExistent 2468 \HasChildren" attribute pair to signal to the client that there is a 2469 descendant mailbox that matches the selection criteria. See example 2470 11 in Section 6.3.9.8. 2472 The returned selection criteria allow the client to distinguish a 2473 solicited response from an unsolicited one, as well as to distinguish 2474 among solicited responses caused by multiple pipelined LIST commands 2475 that specify different criteria. 2477 Servers SHOULD ONLY return a non-matching mailbox name along with 2478 CHILDINFO if at least one matching child is not also being returned. 2479 That is, servers SHOULD suppress redundant CHILDINFO responses. 2481 Examples 8 and 10 in Section 6.3.9.8 demonstrate the difference 2482 between present CHILDINFO extended data item and the "\HasChildren" 2483 attribute. 2485 The following table summarizes interaction between the "\NonExistent" 2486 attribute and CHILDINFO (the first column indicates whether the 2487 parent mailbox exists): 2489 +--------+-------------+------------------+-------------------------+ 2490 | exists | meets the | has a child that | returned | 2491 | | selection | meets the | IMAP4rev2/LIST-EXTENDED | 2492 | | criteria | selection | attributes and | 2493 | | | criteria | CHILDINFO | 2494 +--------+-------------+------------------+-------------------------+ 2495 | no | no | no | no LIST response | 2496 | | | | returned | 2497 | yes | no | no | no LIST response | 2498 | | | | returned | 2499 | no | yes | no | (\NonExistent ) | 2500 | yes | yes | no | () | 2501 | no | no | yes | (\NonExistent) + | 2502 | | | | CHILDINFO | 2503 | yes | no | yes | () + CHILDINFO | 2504 | no | yes | yes | (\NonExistent ) + | 2505 | | | | CHILDINFO | 2506 | yes | yes | yes | () + CHILDINFO | 2507 +--------+-------------+------------------+-------------------------+ 2509 where is one or more attributes that correspond to the 2510 selection criteria; for example, for the SUBSCRIBED option the 2511 is \Subscribed. 2513 6.3.9.7. OLDNAME Extended Data Item 2515 The OLDNAME extended data item is included when a mailbox name is 2516 created (with CREATE command), renamed (with RENAME command) or 2517 deleted (with DELETE command). (When a mailbox is deleted the 2518 "\NonExistent" attribute is also included.) IMAP extensions can 2519 specify other conditions when OLDNAME extended data item should be 2520 included. 2522 If the server allows de-normalized mailbox names (see Section 5.1) in 2523 SELECT/EXAMINE, CREATE, RENAME or DELETE, it SHOULD return an 2524 unsolicited LIST response that includes OLDNAME extended data item, 2525 whenever the supplied mailbox name differs from the resulting 2526 normalized mailbox name. From the client point of view this is 2527 indistinguishable from another user renaming of deleting the mailbox, 2528 as specified in the previous paragraph. 2530 A deleted mailbox can be announced like this: 2532 S: * LIST (\NonExistent) "." "INBOX.DeletedMailbox" 2534 Example of a renamed mailbox: 2536 S: * LIST () "/" "NewMailbox" ("OLDNAME" ("OldMailbox")) 2538 6.3.9.8. LIST Command Examples 2540 This example shows some uses of the basic LIST command: 2542 Example: C: A101 LIST "" "" 2543 S: * LIST (\Noselect) "/" "" 2544 S: A101 OK LIST Completed 2545 C: A102 LIST #news.comp.mail.misc "" 2546 S: * LIST (\Noselect) "." #news. 2547 S: A102 OK LIST Completed 2548 C: A103 LIST /usr/staff/jones "" 2549 S: * LIST (\Noselect) "/" / 2550 S: A103 OK LIST Completed 2551 C: A202 LIST ~/Mail/ % 2552 S: * LIST (\Noselect) "/" ~/Mail/foo 2553 S: * LIST () "/" ~/Mail/meetings 2554 S: A202 OK LIST completed 2556 Extended examples: 2558 1: The first example shows the complete local hierarchy that will 2559 be used for the other examples. 2561 C: A01 LIST "" "*" 2562 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2563 S: * LIST () "/" "Fruit" 2564 S: * LIST () "/" "Fruit/Apple" 2565 S: * LIST () "/" "Fruit/Banana" 2566 S: * LIST () "/" "Tofu" 2567 S: * LIST () "/" "Vegetable" 2568 S: * LIST () "/" "Vegetable/Broccoli" 2569 S: * LIST () "/" "Vegetable/Corn" 2570 S: A01 OK done 2572 2: In the next example, we will see the subscribed mailboxes. This 2573 is similar to, but not equivalent with now deprecated, (see [RFC3501] for more details on LSUB command). Note 2575 that the mailbox called "Fruit/Peach" is subscribed to, but does 2576 not actually exist (perhaps it was deleted while still 2577 subscribed). The "Fruit" mailbox is not subscribed to, but it 2578 has two subscribed children. The "Vegetable" mailbox is 2579 subscribed and has two children; one of them is subscribed as 2580 well. 2582 C: A02 LIST (SUBSCRIBED) "" "*" 2583 S: * LIST (\Marked \NoInferiors \Subscribed) "/" "inbox" 2584 S: * LIST (\Subscribed) "/" "Fruit/Banana" 2585 S: * LIST (\Subscribed \NonExistent) "/" "Fruit/Peach" 2586 S: * LIST (\Subscribed) "/" "Vegetable" 2587 S: * LIST (\Subscribed) "/" "Vegetable/Broccoli" 2588 S: A02 OK done 2590 3: The next example shows the use of the CHILDREN option. The 2591 client, without having to list the second level of hierarchy, 2592 now knows which of the top-level mailboxes have submailboxes 2593 (children) and which do not. Note that it's not necessary for 2594 the server to return the \HasNoChildren attribute for the inbox, 2595 because the \NoInferiors attribute already implies that, and has 2596 a stronger meaning. 2598 C: A03 LIST () "" "%" RETURN (CHILDREN) 2599 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2600 S: * LIST (\HasChildren) "/" "Fruit" 2601 S: * LIST (\HasNoChildren) "/" "Tofu" 2602 S: * LIST (\HasChildren) "/" "Vegetable" 2603 S: A03 OK done 2605 4: In this example, we see more mailboxes that reside on another 2606 server. This is similar to the command . 2608 C: A04 LIST (REMOTE) "" "%" RETURN (CHILDREN) 2609 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2610 S: * LIST (\HasChildren) "/" "Fruit" 2611 S: * LIST (\HasNoChildren) "/" "Tofu" 2612 S: * LIST (\HasChildren) "/" "Vegetable" 2613 S: * LIST (\Remote) "/" "Bread" 2614 S: * LIST (\HasChildren \Remote) "/" "Meat" 2615 S: A04 OK done 2617 5: The following example also requests the server to include 2618 mailboxes that reside on another server. The server returns 2619 information about all mailboxes that are subscribed. This is 2620 similar to the command (see [RFC2193] for more 2621 details on RLSUB). We also see the use of two selection 2622 options. 2624 C: A05 LIST (REMOTE SUBSCRIBED) "" "*" 2625 S: * LIST (\Marked \NoInferiors \Subscribed) "/" "inbox" 2626 S: * LIST (\Subscribed) "/" "Fruit/Banana" 2627 S: * LIST (\Subscribed \NonExistent) "/" "Fruit/Peach" 2628 S: * LIST (\Subscribed) "/" "Vegetable" 2629 S: * LIST (\Subscribed) "/" "Vegetable/Broccoli" 2630 S: * LIST (\Remote \Subscribed) "/" "Bread" 2631 S: A05 OK done 2633 6: The following example requests the server to include mailboxes 2634 that reside on another server. The server is asked to return 2635 subscription information for all returned mailboxes. This is 2636 different from the example above. 2638 Note that the output of this command is not a superset of the 2639 output in the previous example, as it doesn't include LIST 2640 response for the non-existent "Fruit/Peach". 2642 C: A06 LIST (REMOTE) "" "*" RETURN (SUBSCRIBED) 2643 S: * LIST (\Marked \NoInferiors \Subscribed) "/" "inbox" 2644 S: * LIST () "/" "Fruit" 2645 S: * LIST () "/" "Fruit/Apple" 2646 S: * LIST (\Subscribed) "/" "Fruit/Banana" 2647 S: * LIST () "/" "Tofu" 2648 S: * LIST (\Subscribed) "/" "Vegetable" 2649 S: * LIST (\Subscribed) "/" "Vegetable/Broccoli" 2650 S: * LIST () "/" "Vegetable/Corn" 2651 S: * LIST (\Remote \Subscribed) "/" "Bread" 2652 S: * LIST (\Remote) "/" "Meat" 2653 S: A06 OK done 2655 7: The following example demonstrates the difference between the 2656 \HasChildren attribute and the CHILDINFO extended data item. 2658 Let's assume there is the following hierarchy: 2660 C: C01 LIST "" "*" 2661 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2662 S: * LIST () "/" "Foo" 2663 S: * LIST () "/" "Foo/Bar" 2664 S: * LIST () "/" "Foo/Baz" 2665 S: * LIST () "/" "Moo" 2666 S: C01 OK done 2668 If the client asks RETURN (CHILDREN), it will get this: 2670 C: CA3 LIST "" "%" RETURN (CHILDREN) 2671 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2672 S: * LIST (\HasChildren) "/" "Foo" 2673 S: * LIST (\HasNoChildren) "/" "Moo" 2674 S: CA3 OK done 2676 A) Let's also assume that the mailbox "Foo/Baz" is the only 2677 subscribed mailbox. Then we get this result: 2679 C: C02 LIST (SUBSCRIBED) "" "*" 2680 S: * LIST (\Subscribed) "/" "Foo/Baz" 2681 S: C02 OK done 2683 Now, if the client issues , the server 2684 will return no mailboxes (as the mailboxes "Moo", "Foo", and 2685 "Inbox" are NOT subscribed). However, if the client issues 2686 this: 2688 C: C04 LIST (SUBSCRIBED RECURSIVEMATCH) "" "%" 2689 S: * LIST () "/" "Foo" ("CHILDINFO" ("SUBSCRIBED")) 2690 S: C04 OK done 2692 (i.e., the mailbox "Foo" is not subscribed, but it has a child 2693 that is.) 2695 A1) If the mailbox "Foo" had also been subscribed, the last 2696 command would return this: 2698 C: C04 LIST (SUBSCRIBED RECURSIVEMATCH) "" "%" 2699 S: * LIST (\Subscribed) "/" "Foo" ("CHILDINFO" ("SUBSCRIBED")) 2700 S: C04 OK done 2702 or even this: 2704 C: C04 LIST (SUBSCRIBED RECURSIVEMATCH) "" "%" 2705 S: * LIST (\Subscribed \HasChildren) "/" "Foo" ("CHILDINFO" 2706 ("SUBSCRIBED")) 2707 S: C04 OK done 2709 A2) If we assume instead that the mailbox "Foo" is not part of 2710 the original hierarchy and is not subscribed, the last command 2711 will give this result: 2713 C: C04 LIST (SUBSCRIBED RECURSIVEMATCH) "" "%" 2714 S: * LIST (\NonExistent) "/" "Foo" ("CHILDINFO" ("SUBSCRIBED")) 2715 S: C04 OK done 2716 B) Now, let's assume that no mailbox is subscribed. In this 2717 case, the command will 2718 return no responses, as there are no subscribed children (even 2719 though "Foo" has children). 2721 C) And finally, suppose that only the mailboxes "Foo" and "Moo" 2722 are subscribed. In that case, we see this result: 2724 C: C04 LIST (SUBSCRIBED RECURSIVEMATCH) "" "%" RETURN (CHILDREN) 2725 S: * LIST (\HasChildren \Subscribed) "/" "Foo" 2726 S: * LIST (\HasNoChildren \Subscribed) "/" "Moo" 2727 S: C04 OK done 2729 (which means that the mailbox "Foo" has children, but none of 2730 them is subscribed). 2732 8: The following example demonstrates that the CHILDINFO extended 2733 data item is returned whether or not children mailboxes match 2734 the canonical LIST pattern. 2736 Let's assume there is the following hierarchy: 2738 C: D01 LIST "" "*" 2739 S: * LIST (\Marked \NoInferiors) "/" "inbox" 2740 S: * LIST () "/" "foo2" 2741 S: * LIST () "/" "foo2/bar1" 2742 S: * LIST () "/" "foo2/bar2" 2743 S: * LIST () "/" "baz2" 2744 S: * LIST () "/" "baz2/bar2" 2745 S: * LIST () "/" "baz2/bar22" 2746 S: * LIST () "/" "baz2/bar222" 2747 S: * LIST () "/" "eps2" 2748 S: * LIST () "/" "eps2/mamba" 2749 S: * LIST () "/" "qux2/bar2" 2750 S: D01 OK done 2752 And that the following mailboxes are subscribed: 2754 C: D02 LIST (SUBSCRIBED) "" "*" 2755 S: * LIST (\Subscribed) "/" "foo2/bar1" 2756 S: * LIST (\Subscribed) "/" "foo2/bar2" 2757 S: * LIST (\Subscribed) "/" "baz2/bar2" 2758 S: * LIST (\Subscribed) "/" "baz2/bar22" 2759 S: * LIST (\Subscribed) "/" "baz2/bar222" 2760 S: * LIST (\Subscribed) "/" "eps2" 2761 S: * LIST (\Subscribed) "/" "eps2/mamba" 2762 S: * LIST (\Subscribed) "/" "qux2/bar2" 2763 S: D02 OK done 2764 The client issues the following command first: 2766 C: D03 LIST (RECURSIVEMATCH SUBSCRIBED) "" "*2" 2767 S: * LIST () "/" "foo2" ("CHILDINFO" ("SUBSCRIBED")) 2768 S: * LIST (\Subscribed) "/" "foo2/bar2" 2769 S: * LIST (\Subscribed) "/" "baz2/bar2" 2770 S: * LIST (\Subscribed) "/" "baz2/bar22" 2771 S: * LIST (\Subscribed) "/" "baz2/bar222" 2772 S: * LIST (\Subscribed) "/" "eps2" ("CHILDINFO" ("SUBSCRIBED")) 2773 S: * LIST (\Subscribed) "/" "qux2/bar2" 2774 S: D03 OK done 2776 and the server may also include (but this would violate a SHOULD 2777 NOT in Section 3.5, because CHILDINFO is redundant) 2779 S: * LIST () "/" "baz2" ("CHILDINFO" ("SUBSCRIBED")) 2780 S: * LIST (\NonExistent) "/" "qux2" ("CHILDINFO" ("SUBSCRIBED")) 2782 The CHILDINFO extended data item is returned for mailboxes 2783 "foo2", "baz2", and "eps2", because all of them have subscribed 2784 children, even though for the mailbox "foo2" only one of the two 2785 subscribed children matches the pattern, for the mailbox "baz2" 2786 all the subscribed children match the pattern, and for the 2787 mailbox "eps2" none of the subscribed children matches the 2788 pattern. 2790 Note that if the client issues 2792 C: D03 LIST (RECURSIVEMATCH SUBSCRIBED) "" "*" 2793 S: * LIST () "/" "foo2" ("CHILDINFO" ("SUBSCRIBED")) 2794 S: * LIST (\Subscribed) "/" "foo2/bar1" 2795 S: * LIST (\Subscribed) "/" "foo2/bar2" 2796 S: * LIST () "/" "baz2" ("CHILDINFO" ("SUBSCRIBED")) 2797 S: * LIST (\Subscribed) "/" "baz2/bar2" 2798 S: * LIST (\Subscribed) "/" "baz2/bar22" 2799 S: * LIST (\Subscribed) "/" "baz2/bar222" 2800 S: * LIST (\Subscribed) "/" "eps2" ("CHILDINFO" ("SUBSCRIBED")) 2801 S: * LIST (\Subscribed) "/" "eps2/mamba" 2802 S: * LIST (\Subscribed) "/" "qux2/bar2" 2803 S: D03 OK done 2805 The LIST responses for mailboxes "foo2", "baz2", and "eps2" 2806 still have the CHILDINFO extended data item, even though this 2807 information is redundant and the client can determine it by 2808 itself. 2810 9: The following example shows usage of extended syntax for mailbox 2811 pattern. It also demonstrates that the presence of the 2812 CHILDINFO extended data item doesn't necessarily imply 2813 \HasChildren. 2815 C: a1 LIST "" ("foo") 2816 S: * LIST () "/" foo 2817 S: a1 OK done 2819 C: a2 LIST (SUBSCRIBED) "" "foo/*" 2820 S: * LIST (\Subscribed \NonExistent) "/" foo/bar 2821 S: a2 OK done 2823 C: a3 LIST (SUBSCRIBED RECURSIVEMATCH) "" foo RETURN (CHILDREN) 2824 S: * LIST (\HasNoChildren) "/" foo ("CHILDINFO" ("SUBSCRIBED")) 2825 S: a3 OK done 2827 10: The following example shows how a server that supports missing 2828 mailbox hierarchy elements can signal to a client that didn't 2829 specify the RECURSIVEMATCH selection option that there is a 2830 child mailbox that matches the selection criteria. 2832 C: a1 LIST (REMOTE) "" * 2833 S: * LIST () "/" music/rock 2834 S: * LIST (\Remote) "/" also/jazz 2835 S: a1 OK done 2837 C: a2 LIST () "" % 2838 S: * LIST (\NonExistent \HasChildren) "/" music 2839 S: a2 OK done 2841 C: a3 LIST (REMOTE) "" % 2842 S: * LIST (\NonExistent \HasChildren) "/" music 2843 S: * LIST (\NonExistent \HasChildren) "/" also 2844 S: a3 OK done 2846 C: a3.1 LIST "" (% music/rock) 2847 S: * LIST () "/" music/rock 2848 S: a3.1 OK done 2850 Because "music/rock" is the only mailbox under "music", there's 2851 no need for the server to also return "music". However clients 2852 must handle both cases. 2854 11: The following examples show use of STATUS return option. 2856 C: A01 LIST "" % RETURN (STATUS (MESSAGES UNSEEN)) 2857 S: * LIST () "." "INBOX" 2858 S: * STATUS "INBOX" (MESSAGES 17 UNSEEN 16) 2859 S: * LIST () "." "foo" 2860 S: * STATUS "foo" (MESSAGES 30 UNSEEN 29) 2861 S: * LIST (\NoSelect) "." "bar" 2862 S: A01 OK List completed. 2864 The "bar" mailbox isn't selectable, so it has no STATUS reply. 2866 C: A02 LIST (SUBSCRIBED RECURSIVEMATCH) "" % RETURN (STATUS 2867 (MESSAGES)) 2868 S: * LIST (\Subscribed) "." "INBOX" 2869 S: * STATUS "INBOX" (MESSAGES 17) 2870 S: * LIST () "." "foo" (CHILDINFO ("SUBSCRIBED")) 2871 S: A02 OK List completed. 2873 The LIST reply for "foo" is returned because it has matching 2874 children, but no STATUS reply is returned because "foo" itself 2875 doesn't match the selection criteria. 2877 6.3.10. NAMESPACE Command 2879 Arguments: none 2881 Responses: REQUIRED untagged responses: NAMESPACE 2883 Result: OK - command completed 2884 NO - Can't complete the command 2885 BAD - arguments invalid 2887 The NAMESPACE command causes a single ungagged NAMESPACE response to 2888 be returned. The untagged NAMESPACE response contains the prefix and 2889 hierarchy delimiter to the server's Personal Namespace(s), Other 2890 Users' Namespace(s), and Shared Namespace(s) that the server wishes 2891 to expose. The response will contain a NIL for any namespace class 2892 that is not available. The Namespace-Response-Extensions ABNF non 2893 terminal is defined for extensibility and MAY be included in the 2894 NAMESPACE response. 2896 Example 1: 2898 In this example a server supports a single personal namespace. No 2899 leading prefix is used on personal mailboxes and "/" is the hierarchy 2900 delimiter. 2902 C: A001 NAMESPACE 2903 S: * NAMESPACE (("" "/")) NIL NIL 2904 S: A001 OK NAMESPACE command completed 2906 Example 2: 2908 A user logged on anonymously to a server. No personal mailboxes are 2909 associated with the anonymous user and the user does not have access 2910 to the Other Users' Namespace. No prefix is required to access 2911 shared mailboxes and the hierarchy delimiter is "." 2913 C: A001 NAMESPACE 2914 S: * NAMESPACE NIL NIL (("" ".")) 2915 S: A001 OK NAMESPACE command completed 2917 Example 3: 2919 A server that contains a Personal Namespace and a single Shared 2920 Namespace. 2922 C: A001 NAMESPACE 2923 S: * NAMESPACE (("" "/")) NIL (("Public Folders/" "/")) 2924 S: A001 OK NAMESPACE command completed 2926 Example 4: 2928 A server that contains a Personal Namespace, Other Users' Namespace 2929 and multiple Shared Namespaces. Note that the hierarchy delimiter 2930 used within each namespace can be different. 2932 C: A001 NAMESPACE 2933 S: * NAMESPACE (("" "/")) (("~" "/")) (("#shared/" "/") 2934 ("#public/" "/")("#ftp/" "/")("#news." ".")) 2935 S: A001 OK NAMESPACE command completed 2937 The prefix string allows a client to do things such as automatically 2938 creating personal mailboxes or LISTing all available mailboxes within 2939 a namespace. 2941 Example 5: 2943 A server that supports only the Personal Namespace, with a leading 2944 prefix of INBOX to personal mailboxes and a hierarchy delimiter of 2945 "." 2946 C: A001 NAMESPACE 2947 S: * NAMESPACE (("INBOX." ".")) NIL NIL 2948 S: A001 OK NAMESPACE command completed 2950 < Automatically create a mailbox to store sent items.> 2952 C: A002 CREATE "INBOX.Sent Mail" 2953 S: A002 OK CREATE command completed 2955 Although typically a server will support only a single Personal 2956 Namespace, and a single Other User's Namespace, circumstances exist 2957 where there MAY be multiples of these, and a client MUST be prepared 2958 for them. If a client is configured such that it is required to 2959 create a certain mailbox, there can be circumstances where it is 2960 unclear which Personal Namespaces it should create the mailbox in. 2961 In these situations a client SHOULD let the user select which 2962 namespaces to create the mailbox in or just use the first personal 2963 namespace. 2965 Example 6: 2967 In this example, a server supports 2 Personal Namespaces. In 2968 addition to the regular Personal Namespace, the user has an 2969 additional personal namespace to allow access to mailboxes in an MH 2970 format mailstore. 2972 The client is configured to save a copy of all mail sent by the user 2973 into a mailbox called 'Sent Mail'. Furthermore, after a message is 2974 deleted from a mailbox, the client is configured to move that message 2975 to a mailbox called 'Deleted Items'. 2977 Note that this example demonstrates how some extension flags can be 2978 passed to further describe the #mh namespace. 2980 C: A001 NAMESPACE 2981 S: * NAMESPACE (("" "/")("#mh/" "/" "X-PARAM" 2982 ("FLAG1" "FLAG2"))) NIL NIL 2983 S: A001 OK NAMESPACE command completed 2985 < It is desired to keep only one copy of sent mail. 2986 It is unclear which Personal Namespace the client 2987 should use to create the 'Sent Mail' mailbox. 2988 The user is prompted to select a namespace and only 2989 one 'Sent Mail' mailbox is created. > 2991 C: A002 CREATE "Sent Mail" 2992 S: A002 OK CREATE command completed 2994 < The client is designed so that it keeps two 2995 'Deleted Items' mailboxes, one for each namespace. > 2997 C: A003 CREATE "Delete Items" 2998 S: A003 OK CREATE command completed 3000 C: A004 CREATE "#mh/Deleted Items" 3001 S: A004 OK CREATE command completed 3003 The next level of hierarchy following the Other Users' Namespace 3004 prefix SHOULD consist of , where is a user name 3005 as per the LOGIN or AUTHENTICATE command. 3007 A client can construct a LIST command by appending a "%" to the Other 3008 Users' Namespace prefix to discover the Personal Namespaces of other 3009 users that are available to the currently authenticated user. 3011 In response to such a LIST command, a server SHOULD NOT return user 3012 names that have not granted access to their personal mailboxes to the 3013 user in question. 3015 A server MAY return a LIST response containing only the names of 3016 users that have explicitly granted access to the user in question. 3018 Alternatively, a server MAY return NO to such a LIST command, 3019 requiring that a user name be included with the Other Users' 3020 Namespace prefix before listing any other user's mailboxes. 3022 Example 7: 3024 A server that supports providing a list of other user's mailboxes 3025 that are accessible to the currently logged on user. 3027 C: A001 NAMESPACE 3028 S: * NAMESPACE (("" "/")) (("Other Users/" "/")) NIL 3029 S: A001 OK NAMESPACE command completed 3031 C: A002 LIST "" "Other Users/%" 3032 S: * LIST () "/" "Other Users/Mike" 3033 S: * LIST () "/" "Other Users/Karen" 3034 S: * LIST () "/" "Other Users/Matthew" 3035 S: * LIST () "/" "Other Users/Tesa" 3036 S: A002 OK LIST command completed 3038 Example 8: 3040 A server that does not support providing a list of other user's 3041 mailboxes that are accessible to the currently logged on user. The 3042 mailboxes are listable if the client includes the name of the other 3043 user with the Other Users' Namespace prefix. 3045 C: A001 NAMESPACE 3046 S: * NAMESPACE (("" "/")) (("#Users/" "/")) NIL 3047 S: A001 OK NAMESPACE command completed 3049 < In this example, the currently logged on user has access to 3050 the Personal Namespace of user Mike, but the server chose to 3051 suppress this information in the LIST response. However, 3052 by appending the user name Mike (received through user input) 3053 to the Other Users' Namespace prefix, the client is able 3054 to get a listing of the personal mailboxes of user Mike. > 3056 C: A002 LIST "" "#Users/%" 3057 S: A002 NO The requested item could not be found. 3059 C: A003 LIST "" "#Users/Mike/%" 3060 S: * LIST () "/" "#Users/Mike/INBOX" 3061 S: * LIST () "/" "#Users/Mike/Foo" 3062 S: A003 OK LIST command completed. 3064 A prefix string might not contain a hierarchy delimiter, because in 3065 some cases it is not needed as part of the prefix. 3067 Example 9: 3069 A server that allows access to the Other Users' Namespace by 3070 prefixing the others' mailboxes with a '~' followed by , 3071 where is a user name as per the LOGIN or AUTHENTICATE 3072 command. 3074 C: A001 NAMESPACE 3075 S: * NAMESPACE (("" "/")) (("~" "/")) NIL 3076 S: A001 OK NAMESPACE command completed 3078 < List the mailboxes for user mark > 3080 C: A002 LIST "" "~mark/%" 3081 S: * LIST () "/" "~mark/INBOX" 3082 S: * LIST () "/" "~mark/foo" 3083 S: A002 OK LIST command completed 3085 6.3.11. STATUS Command 3087 Arguments: mailbox name 3088 status data item names 3090 Responses: REQUIRED untagged responses: STATUS 3092 Result: OK - status completed 3093 NO - status failure: no status for that name 3094 BAD - command unknown or arguments invalid 3096 The STATUS command requests the status of the indicated mailbox. It 3097 does not change the currently selected mailbox, nor does it affect 3098 the state of any messages in the queried mailbox. 3100 The STATUS command provides an alternative to opening a second 3101 IMAP4rev2 connection and doing an EXAMINE command on a mailbox to 3102 query that mailbox's status without deselecting the current mailbox 3103 in the first IMAP4rev2 connection. 3105 Unlike the LIST command, the STATUS command is not guaranteed to be 3106 fast in its response. Under certain circumstances, it can be quite 3107 slow. In some implementations, the server is obliged to open the 3108 mailbox read-only internally to obtain certain status information. 3109 Also unlike the LIST command, the STATUS command does not accept 3110 wildcards. 3112 Note: The STATUS command is intended to access the status of 3113 mailboxes other than the currently selected mailbox. Because the 3114 STATUS command can cause the mailbox to be opened internally, and 3115 because this information is available by other means on the 3116 selected mailbox, the STATUS command SHOULD NOT be used on the 3117 currently selected mailbox. However, servers MUST be able to 3118 execute STATUS command on the selected mailbox. (This might also 3119 implicitly happen when STATUS return option is used in a LIST 3120 command). 3122 The STATUS command MUST NOT be used as a "check for new messages 3123 in the selected mailbox" operation (refer to sections Section 7, 3124 Section 7.3.1 for more information about the proper method for new 3125 message checking). 3127 STATUS SIZE (see below) can take a significant amount of time, 3128 depending upon server implementation. Clients should use STATUS 3129 SIZE cautiously. 3131 The currently defined status data items that can be requested are: 3133 MESSAGES The number of messages in the mailbox. 3135 UIDNEXT The next unique identifier value of the mailbox. Refer to 3136 Section 2.3.1.1 for more information. 3138 UIDVALIDITY The unique identifier validity value of the mailbox. 3139 Refer to Section 2.3.1.1 for more information. 3141 UNSEEN The number of messages which do not have the \Seen flag set. 3143 DELETED The number of messages which have the \Deleted flag set. 3145 SIZE The total size of the mailbox in octets. This is not strictly 3146 required to be an exact value, but it MUST be equal to or greater 3147 than the sum of the values of the RFC822.SIZE FETCH message data 3148 items (see Section 6.4.5) of all messages in the mailbox. 3150 Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES) 3151 S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 3152 S: A042 OK STATUS completed 3154 6.3.12. APPEND Command 3156 Arguments: mailbox name 3157 OPTIONAL flag parenthesized list 3158 OPTIONAL date/time string 3159 message literal 3161 Responses: OPTIONAL untagged response: LIST 3163 Result: OK - append completed 3164 NO - append error: can't append to that mailbox, error 3165 in flags or date/time or message text 3166 BAD - command unknown or arguments invalid 3168 The APPEND command appends the literal argument as a new message to 3169 the end of the specified destination mailbox. This argument SHOULD 3170 be in the format of an [RFC-5322] or [I18N-HDRS] message. 8-bit 3171 characters are permitted in the message. A server implementation 3172 that is unable to preserve 8-bit data properly MUST be able to 3173 reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB] 3174 content transfer encoding. 3176 Note: There may be exceptions, e.g., draft messages, in which 3177 required [RFC-5322] header lines are omitted in the message 3178 literal argument to APPEND. The full implications of doing so 3179 must be understood and carefully weighed. 3181 If a flag parenthesized list is specified, the flags SHOULD be set in 3182 the resulting message; otherwise, the flag list of the resulting 3183 message is set to empty by default. 3185 If a date-time is specified, the internal date SHOULD be set in the 3186 resulting message; otherwise, the internal date of the resulting 3187 message is set to the current date and time by default. 3189 If the append is unsuccessful for any reason, the mailbox MUST be 3190 restored to its state before the APPEND attempt (other than possibly 3191 keeping the changed mailbox's UIDNEXT value); no partial appending is 3192 permitted. 3194 If the destination mailbox does not exist, a server MUST return an 3195 error, and MUST NOT automatically create the mailbox. Unless it is 3196 certain that the destination mailbox can not be created, the server 3197 MUST send the response code "[TRYCREATE]" as the prefix of the text 3198 of the tagged NO response. This gives a hint to the client that it 3199 can attempt a CREATE command and retry the APPEND if the CREATE is 3200 successful. 3202 On successful completion of an APPEND, the server SHOULD return an 3203 APPENDUID response code (see Section 7.1). 3205 In the case of a mailbox that has permissions set so that the client 3206 can APPEND to the mailbox, but not SELECT or EXAMINE it, the server 3207 SHOULD NOT send an APPENDUID response code as it would disclose 3208 information about the mailbox. 3210 In the case of a mailbox that has UIDNOTSTICKY status (see 3211 Section 7.1), the server MAY omit the APPENDUID response code as it 3212 is not meaningful. 3214 If the server does not return the APPENDUID response codes, the 3215 client can discover this information by selecting the destination 3216 mailbox. The location of messages placed in the destination mailbox 3217 by APPEND can be determined by using FETCH and/or SEARCH commands 3218 (e.g., for Message-ID or some unique marker placed in the message in 3219 an APPEND). 3221 If the mailbox is currently selected, the normal new message actions 3222 SHOULD occur. Specifically, the server SHOULD notify the client 3223 immediately via an untagged EXISTS response. If the server does not 3224 do so, the client MAY issue a NOOP command after one or more APPEND 3225 commands. 3227 If the server decides to convert (normalize) the mailbox name, it 3228 SHOULD return an untagged LIST with OLDNAME extended data item, with 3229 the OLDNAME value being the supplied mailbox name and the name 3230 parameter being the normalized mailbox name. (See Section 6.3.9.7 3231 for more details.) 3233 Example: C: A003 APPEND saved-messages (\Seen) {310} 3234 S: + Ready for literal data 3235 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 3236 C: From: Fred Foobar 3237 C: Subject: afternoon meeting 3238 C: To: mooch@owatagu.siam.edu 3239 C: Message-Id: 3240 C: MIME-Version: 1.0 3241 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 3242 C: 3243 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 3244 C: 3245 S: A003 OK APPEND completed 3247 Example: C: A003 APPEND saved-messages (\Seen) {297} 3248 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) 3249 C: From: Fred Foobar 3250 C: Subject: afternoon meeting 3251 C: To: mooch@example.com 3252 C: Message-Id: 3253 C: MIME-Version: 1.0 3254 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 3255 C: 3256 C: Hello Joe, do you think we can meet at 3:30 tomorrow? 3257 C: 3258 S: A003 OK [APPENDUID 38505 3955] APPEND completed 3259 C: A004 COPY 2:4 meeting 3260 S: A004 OK [COPYUID 38505 304,319:320 3956:3958] Done 3261 C: A005 UID COPY 305:310 meeting 3262 S: A005 OK No matching messages, so nothing copied 3263 C: A006 COPY 2 funny 3264 S: A006 OK Done 3265 C: A007 SELECT funny 3266 S: * 1 EXISTS 3267 S: * OK [UIDVALIDITY 3857529045] Validity session-only 3268 S: * OK [UIDNEXT 2] Predicted next UID 3269 S: * NO [UIDNOTSTICKY] Non-persistent UIDs 3270 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 3271 S: * OK [PERMANENTFLAGS (\Deleted \Seen)] Limited 3272 S: * LIST () "." funny 3273 S: A007 OK [READ-WRITE] SELECT completed 3275 In this example, A003 and A004 demonstrate successful appending and 3276 copying to a mailbox that returns the UIDs assigned to the messages. 3277 A005 is an example in which no messages were copied; this is because 3278 in A003, we see that message 2 had UID 304, and message 3 had UID 3279 319; therefore, UIDs 305 through 310 do not exist (refer to 3280 Section 2.3.1.1 for further explanation). A006 is an example of a 3281 message being copied that did not return a COPYUID; and, as expected, 3282 A007 shows that the mail store containing that mailbox does not 3283 support persistent UIDs. 3285 Note: The APPEND command is not used for message delivery, because 3286 it does not provide a mechanism to transfer [SMTP] envelope 3287 information. 3289 6.3.13. IDLE Command 3291 Arguments: none 3293 Responses: continuation data will be requested; the client sends the 3294 continuation data "DONE" to end the command 3296 Result: OK - IDLE completed after client sent "DONE" 3297 NO - failure: the server will not allow the IDLE command 3298 at this time 3299 BAD - command unknown or arguments invalid 3301 Without the IDLE command a client requires to poll the server for 3302 changes to the selected mailbox (new mail, deletions, flag changes). 3303 It's often more desirable to have the server transmit updates to the 3304 client in real time. This allows a user to see new mail immediately. 3305 The IDLE command allows a client to tell the server that it's ready 3306 to accept such real-time updates. 3308 The IDLE command is sent from the client to the server when the 3309 client is ready to accept unsolicited update messages. The server 3310 requests a response to the IDLE command using the continuation ("+") 3311 response. The IDLE command remains active until the client responds 3312 to the continuation, and as long as an IDLE command is active, the 3313 server is now free to send untagged EXISTS, EXPUNGE, FETCH, and other 3314 responses at any time. If the server choose to send unsolicited 3315 FETCH responses, they MUST include UID FETCH item. 3317 The IDLE command is terminated by the receipt of a "DONE" 3318 continuation from the client; such response satisfies the server's 3319 continuation request. At that point, the server MAY send any 3320 remaining queued untagged responses and then MUST immediately send 3321 the tagged response to the IDLE command and prepare to process other 3322 commands. As for other commands, the processing of any new command 3323 may cause the sending of unsolicited untagged responses, subject to 3324 the ambiguity limitations. The client MUST NOT send a command while 3325 the server is waiting for the DONE, since the server will not be able 3326 to distinguish a command from a continuation. 3328 The server MAY consider a client inactive if it has an IDLE command 3329 running, and if such a server has an inactivity timeout it MAY log 3330 the client off implicitly at the end of its timeout period. Because 3331 of that, clients using IDLE are advised to terminate the IDLE and re- 3332 issue it at least every 29 minutes to avoid being logged off. This 3333 still allows a client to receive immediate mailbox updates even 3334 though it need only "poll" at half hour intervals. 3336 Example: C: A001 SELECT INBOX 3337 S: * FLAGS (\Deleted \Seen \Flagged) 3338 S: * OK [PERMANENTFLAGS (\Deleted \Seen \Flagged)] Limited 3339 S: * 3 EXISTS 3340 S: * OK [UIDVALIDITY 1] 3341 S: * LIST () "/" INBOX 3342 S: A001 OK [READ-WRITE] SELECT completed 3343 C: A002 IDLE 3344 S: + idling 3345 ...time passes; new mail arrives... 3346 S: * 4 EXISTS 3347 C: DONE 3348 S: A002 OK IDLE terminated 3349 ...another client expunges message 2 now... 3350 C: A003 FETCH 4 ALL 3351 S: * 4 FETCH (...) 3352 S: A003 OK FETCH completed 3353 C: A004 IDLE 3354 S: * 2 EXPUNGE 3355 S: * 3 EXISTS 3356 S: + idling 3357 ...time passes; another client expunges message 3... 3358 S: * 3 EXPUNGE 3359 S: * 2 EXISTS 3360 ...time passes; new mail arrives... 3361 S: * 3 EXISTS 3362 C: DONE 3363 S: A004 OK IDLE terminated 3364 C: A005 FETCH 3 ALL 3365 S: * 3 FETCH (...) 3366 S: A005 OK FETCH completed 3367 C: A006 IDLE 3369 6.4. Client Commands - Selected State 3371 In the selected state, commands that manipulate messages in a mailbox 3372 are permitted. 3374 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT), 3375 and the authenticated state commands (SELECT, EXAMINE, NAMESPACE, 3376 CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, STATUS, and 3377 APPEND), the following commands are valid in the selected state: 3378 CLOSE, UNSELECT, EXPUNGE, SEARCH, FETCH, STORE, COPY, MOVE, and UID. 3380 6.4.1. CLOSE Command 3382 Arguments: none 3384 Responses: no specific responses for this command 3386 Result: OK - close completed, now in authenticated state 3387 BAD - command unknown or arguments invalid 3389 The CLOSE command permanently removes all messages that have the 3390 \Deleted flag set from the currently selected mailbox, and returns to 3391 the authenticated state from the selected state. No untagged EXPUNGE 3392 responses are sent. 3394 No messages are removed, and no error is given, if the mailbox is 3395 selected by an EXAMINE command or is otherwise selected read-only. 3397 Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT command 3398 MAY be issued without previously issuing a CLOSE command. The 3399 SELECT, EXAMINE, and LOGOUT commands implicitly close the currently 3400 selected mailbox without doing an expunge. However, when many 3401 messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT sequence is 3402 considerably faster than an EXPUNGE-LOGOUT or EXPUNGE-SELECT because 3403 no untagged EXPUNGE responses (which the client would probably 3404 ignore) are sent. 3406 Example: C: A341 CLOSE 3407 S: A341 OK CLOSE completed 3409 6.4.2. UNSELECT Command 3411 Arguments: none 3413 Responses: no specific responses for this command 3415 Result: OK - unselect completed, now in authenticated state 3416 BAD - no mailbox selected, or argument supplied but none 3417 permitted 3419 The UNSELECT command frees server's resources associated with the 3420 selected mailbox and returns the server to the authenticated state. 3421 This command performs the same actions as CLOSE, except that no 3422 messages are permanently removed from the currently selected mailbox. 3424 Example: C: A342 UNSELECT 3425 S: A342 OK Unselect completed 3427 6.4.3. EXPUNGE Command 3429 Arguments: none 3431 Responses: untagged responses: EXPUNGE 3433 Result: OK - expunge completed 3434 NO - expunge failure: can't expunge (e.g., permission 3435 denied) 3436 BAD - command unknown or arguments invalid 3438 The EXPUNGE command permanently removes all messages that have the 3439 \Deleted flag set from the currently selected mailbox. Before 3440 returning an OK to the client, an untagged EXPUNGE response is sent 3441 for each message that is removed. 3443 Example: C: A202 EXPUNGE 3444 S: * 3 EXPUNGE 3445 S: * 3 EXPUNGE 3446 S: * 5 EXPUNGE 3447 S: * 8 EXPUNGE 3448 S: A202 OK EXPUNGE completed 3450 Note: In this example, messages 3, 4, 7, and 11 had the \Deleted flag 3451 set. See the description of the EXPUNGE response for further 3452 explanation. 3454 6.4.4. SEARCH Command 3456 Arguments: OPTIONAL result specifier 3457 OPTIONAL [CHARSET] specification 3458 searching criteria (one or more) 3460 Responses: OPTIONAL untagged response: ESEARCH 3462 Result: OK - search completed 3463 NO - search error: can't search that [CHARSET] or 3464 criteria 3465 BAD - command unknown or arguments invalid 3467 The SEARCH command searches the mailbox for messages that match the 3468 given searching criteria. 3470 The SEARCH command may contain result options. Result options 3471 control what kind of information is returned about messages matching 3472 the search criteria in an untagged ESEARCH response. If no result 3473 option is specified or empty list of options is specified "()", ALL 3474 is assumed (see below). The order of individual options is 3475 arbitrary. Individual options may contain parameters enclosed in 3476 parentheses (*). If an option has parameters, they consist of atoms 3477 and/or strings and/or lists in a specific order. Any options not 3478 defined by extensions that the server supports must be rejected with 3479 a BAD response. 3481 (*) - if an option has a mandatory parameter, which can always be 3482 represented as a number or a sequence-set, the option parameter does 3483 not need the enclosing (). See the ABNF for more details. 3485 This document specifies the following result options: 3487 MIN 3489 Return the lowest message number/UID that satisfies the SEARCH 3490 criteria. 3492 If the SEARCH results in no matches, the server MUST NOT 3493 include the MIN result option in the ESEARCH response; however, 3494 it still MUST send the ESEARCH response. 3496 MAX 3498 Return the highest message number/UID that satisfies the SEARCH 3499 criteria. 3501 If the SEARCH results in no matches, the server MUST NOT 3502 include the MAX result option in the ESEARCH response; however, 3503 it still MUST send the ESEARCH response. 3505 ALL 3507 Return all message numbers/UIDs that satisfy the SEARCH 3508 criteria using the sequence-set syntax. Note, the client MUST 3509 NOT assume that messages/UIDs will be listed in any particular 3510 order. 3512 If the SEARCH results in no matches, the server MUST NOT 3513 include the ALL result option in the ESEARCH response; however, 3514 it still MUST send the ESEARCH response. 3516 COUNT Return number of the messages that satisfy the SEARCH 3517 criteria. This result option MUST always be included in the 3518 ESEARCH response. 3520 SAVE 3521 This option tells the server to remember the result of the 3522 SEARCH or UID SEARCH command (as well as any command based on 3523 SEARCH, e.g., SORT and THREAD [RFC5256]>) and store it in an 3524 internal variable that we will reference as the "search result 3525 variable". The client can use the "$" marker to reference the 3526 content of this internal variable. The "$" marker can be used 3527 instead of message sequence or UID sequence in order to 3528 indicate that the server should substitute it with the list of 3529 messages from the search result variable. Thus, the client can 3530 use the result of the latest remembered SEARCH command as a 3531 parameter to another command. See Section 6.4.4.1 for details 3532 on how the value of the search result variable is determined, 3533 how it is affected by other commands executed, and how SAVE 3534 return option interacts with other return options. 3536 In absence of any other SEARCH result option, the SAVE result 3537 option also suppresses any ESEARCH response that would have 3538 been otherwise returned by the SEARCH command. 3540 Note: future extensions to this document can allow servers to return 3541 multiple ESEARCH responses for a single extended SEARCH command. 3542 However all options specified above MUST result in a single ESEARCH 3543 response if used by themselves or in a combination. This guaranty 3544 simplifies processing in IMAP4rev2 clients. Future SEARCH extensions 3545 that relax this restriction will have to describe how results from 3546 multiple ESEARCH responses are to be amalgamated. 3548 Searching criteria consist of one or more search keys. 3550 When multiple keys are specified, the result is the intersection (AND 3551 function) of all the messages that match those keys. For example, 3552 the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers to all 3553 deleted messages from Smith with INTERNALDATE greater than February 3554 1, 1994. A search key can also be a parenthesized list of one or 3555 more search keys (e.g., for use with the OR and NOT keys). 3557 Server implementations MAY exclude [MIME-IMB] body parts with 3558 terminal content media types other than TEXT and MESSAGE from 3559 consideration in SEARCH matching. 3561 The OPTIONAL [CHARSET] specification consists of the word "CHARSET" 3562 followed by a registered [CHARSET] [CHARSET-REG]. It indicates the 3563 [CHARSET] of the strings that appear in the search criteria. 3564 [MIME-IMB] content transfer encodings, and [MIME-HDRS] strings in 3565 [RFC-5322]/[MIME-IMB] headers, MUST be decoded before comparing text. 3566 Servers MUST support US-ASCII and UTF-8 charsets; other [CHARSET]s 3567 MAY be supported. Clients SHOULD use UTF-8. Note that if "CHARSET" 3568 is not provided IMAP4rev2 server MUST assume UTF-8, so selecting 3569 CHARSET UTF-8 is redundant. It is permitted for improved 3570 compatibility with existing IMAP4rev1 clients. 3572 If the server does not support the specified [CHARSET], it MUST 3573 return a tagged NO response (not a BAD). This response SHOULD 3574 contain the BADCHARSET response code, which MAY list the [CHARSET]s 3575 supported by the server. 3577 In all search keys that use strings and unless specified otherwise, a 3578 message matches the key if the string is a substring of the 3579 associated text. The matching SHOULD be case-insensitive for 3580 characters within ASCII range. Consider using [IMAP-I18N] for 3581 language-sensitive case-insensitive searching. Note that the empty 3582 string is a substring; this is useful when doing a HEADER search in 3583 order to test for a header field presence in the message. 3585 The defined search keys are as follows. Refer to the Formal Syntax 3586 section for the precise syntactic definitions of the arguments. 3588 Messages with message sequence numbers corresponding 3589 to the specified message sequence number set. 3591 ALL All messages in the mailbox; the default initial key for ANDing. 3593 ANSWERED Messages with the \Answered flag set. 3595 BCC Messages that contain the specified string in the 3596 envelope structure's BCC field. 3598 BEFORE Messages whose internal date (disregarding time and 3599 timezone) is earlier than the specified date. 3601 BODY Messages that contain the specified string in the body 3602 of the message. Unlike TEXT (see below), this doesn't match any 3603 header fields. Servers are allowed to implement flexible matching 3604 for this search key, for example matching "swim" to both "swam" 3605 and "swum" in English language text or only doing full word 3606 matching (where "swim" will not match "swimming"). 3608 CC Messages that contain the specified string in the 3609 envelope structure's CC field. 3611 DELETED Messages with the \Deleted flag set. 3613 DRAFT Messages with the \Draft flag set. 3615 FLAGGED Messages with the \Flagged flag set. 3617 FROM Messages that contain the specified string in the 3618 envelope structure's FROM field. 3620 HEADER Messages that have a header with the 3621 specified field-name (as defined in [RFC-5322]) and that contains 3622 the specified string in the text of the header (what comes after 3623 the colon). If the string to search is zero-length, this matches 3624 all messages that have a header line with the specified field-name 3625 regardless of the contents. Servers should use substring search 3626 for this SEARCH item, as clients can use it for automatic 3627 processing not initiated by end users. For example this can be 3628 used for searching for Message-ID or Content-Type header field 3629 values that need to be exact, or for searches in header fields 3630 that the IMAP server might not know anything about. 3632 KEYWORD Messages with the specified keyword flag set. 3634 LARGER Messages with an [RFC-5322] size larger than the 3635 specified number of octets. 3637 NOT Messages that do not match the specified search 3638 key. 3640 ON Messages whose internal date (disregarding time and 3641 timezone) is within the specified date. 3643 OR Messages that match either search 3644 key. 3646 SEEN Messages that have the \Seen flag set. 3648 SENTBEFORE Messages whose [RFC-5322] Date: header 3649 (disregarding time and timezone) is earlier than the specified 3650 date. 3652 SENTON Messages whose [RFC-5322] Date: header (disregarding 3653 time and timezone) is within the specified date. 3655 SENTSINCE Messages whose [RFC-5322] Date: header 3656 (disregarding time and timezone) is within or later than the 3657 specified date. 3659 SINCE Messages whose internal date (disregarding time and 3660 timezone) is within or later than the specified date. 3662 SMALLER Messages with an [RFC-5322] size smaller than the 3663 specified number of octets. 3665 SUBJECT Messages that contain the specified string in the 3666 envelope structure's SUBJECT field. 3668 TEXT Messages that contain the specified string in the 3669 header (including MIME header fields) or body of the message. 3670 Servers are allowed to implement flexible matching for this search 3671 key, for example matching "swim" to both "swam" and "swum" in 3672 English language text or only doing full word matching (where 3673 "swim" will not match "swimming"). 3675 TO Messages that contain the specified string in the 3676 envelope structure's TO field. 3678 UID Messages with unique identifiers corresponding to 3679 the specified unique identifier set. Sequence set ranges are 3680 permitted. 3682 UNANSWERED Messages that do not have the \Answered flag set. 3684 UNDELETED Messages that do not have the \Deleted flag set. 3686 UNDRAFT Messages that do not have the \Draft flag set. 3688 UNFLAGGED Messages that do not have the \Flagged flag set. 3690 UNKEYWORD Messages that do not have the specified keyword 3691 flag set. 3693 UNSEEN Messages that do not have the \Seen flag set. 3695 Example: C: A282 SEARCH RETURN (MIN COUNT) FLAGGED 3696 SINCE 1-Feb-1994 NOT FROM "Smith" 3697 S: * ESEARCH (TAG "A282") MIN 2 COUNT 3 3698 S: A282 OK SEARCH completed 3700 Example: C: A283 SEARCH RETURN () FLAGGED 3701 SINCE 1-Feb-1994 NOT FROM "Smith" 3702 S: * ESEARCH (TAG "A283") ALL 2,10:11 3703 S: A283 OK SEARCH completed 3705 Example: C: A284 SEARCH TEXT "string not in mailbox" 3706 S: * ESEARCH (TAG "A284") 3707 S: A284 OK SEARCH completed 3708 C: A285 SEARCH CHARSET UTF-8 TEXT {6} 3709 S: + Ready for literal text 3710 C: XXXXXX 3711 S: * ESEARCH (TAG "A285") ALL 43 3712 S: A285 OK SEARCH completed 3714 Note: Since this document is restricted to 7-bit ASCII text, it is 3715 not possible to show actual UTF-8 data. The "XXXXXX" is a 3716 placeholder for what would be 6 octets of 8-bit data in an actual 3717 transaction. 3719 The following example demonstrates finding the first unseen message 3720 in the mailbox: 3722 Example: C: A284 SEARCH RETURN (MIN) UNSEEN 3723 S: * ESEARCH (TAG "A284") MIN 4 3724 S: A284 OK SEARCH completed 3726 The following example demonstrates that if the ESEARCH UID indicator 3727 is present, all data in the ESEARCH response is referring to UIDs; 3728 for example, the MIN result specifier will be followed by a UID. 3730 Example: C: A285 UID SEARCH RETURN (MIN MAX) 1:5000 3731 S: * ESEARCH (TAG "A285") UID MIN 7 MAX 3800 3732 S: A285 OK SEARCH completed 3734 The following example demonstrates returning the number of deleted 3735 messages: 3737 Example: C: A286 SEARCH RETURN (COUNT) DELETED 3738 S: * ESEARCH (TAG "A286") COUNT 15 3739 S: A286 OK SEARCH completed 3741 6.4.4.1. SAVE result option and SEARCH result variable 3743 Upon successful completion of a SELECT or an EXAMINE command (after 3744 the tagged OK response), the current search result variable is reset 3745 to the empty sequence. 3747 A successful SEARCH command with the SAVE result option sets the 3748 value of the search result variable to the list of messages found in 3749 the SEARCH command. For example, if no messages were found, the 3750 search result variable will contain the empty sequence. 3752 Any of the following SEARCH commands MUST NOT change the search 3753 result variable: 3755 a SEARCH command that caused the server to return the BAD tagged 3756 response, 3758 a SEARCH command with no SAVE result option that caused the server 3759 to return NO tagged response, 3761 a successful SEARCH command with no SAVE result option. 3763 A SEARCH command with the SAVE result option that caused the server 3764 to return the NO tagged response sets the value of the search result 3765 variable to the empty sequence. 3767 When a message listed in the search result variable is EXPUNGEd, it 3768 is automatically removed from the list. Implementors are reminded 3769 that if the server stores the list as a list of message numbers, it 3770 MUST automatically adjust them when notifying the client about 3771 expunged messages, as described in Section 7.4.1. 3773 If the server decides to send a new UIDVALIDITY value while the 3774 mailbox is opened, this causes resetting of the search variable to 3775 the empty sequence. 3777 Note that even if the "$" marker contains the empty sequence of 3778 messages, it must be treated by all commands accepting message sets 3779 as parameters as a valid, but non-matching list of messages. For 3780 example, the "FETCH $" command would return a tagged OK response and 3781 no FETCH responses. See also the Example 5 in Section 6.4.4.4. 3783 The SAVE result option doesn't change whether the server would return 3784 items corresponding to MIN, MAX, ALL, or COUNT result options. 3786 When the SAVE result option is combined with the MIN or MAX result 3787 option, and both ALL and COUNT result options are absent, the 3788 corresponding MIN/MAX is returned (if the search result is not 3789 empty), but the "$" marker would contain a single message as returned 3790 in the MIN/MAX return item. 3792 If the SAVE result option is combined with both MIN and MAX result 3793 options, and both ALL and COUNT result options are absent, the "$" 3794 marker would contain zero, one or two messages as returned in the 3795 MIN/MAX return items. 3797 If the SAVE result option is combined with the ALL and/or COUNT 3798 result option(s), the "$" marker would always contain all messages 3799 found by the SEARCH or UID SEARCH command. 3801 The following table summarizes the additional requirement on ESEARCH 3802 server implementations described in this section. 3804 +------------------------------+--------------------+ 3805 | Combination of Result option | "$" marker value | 3806 +------------------------------+--------------------+ 3807 | SAVE MIN | MIN | 3808 | SAVE MAX | MAX | 3809 | SAVE MIN MAX | MIN & MAX | 3810 | SAVE * [m] | all found messages | 3811 +------------------------------+--------------------+ 3813 where '*' means "ALL" and/or "COUNT", and '[m]' means optional "MIN" 3814 and/or "MAX" 3816 Implementation note: server implementors should note that "$" can 3817 reference IMAP message sequences or UID sequences, depending on the 3818 context where it is used. For example, the "$" marker can be set as 3819 a result of a SEARCH (SAVE) command and used as a parameter to a UID 3820 FETCH command (which accepts a UID sequence, not a message sequence), 3821 or the "$" marker can be set as a result of a UID SEARCH (SAVE) 3822 command and used as a parameter to a FETCH command (which accepts a 3823 message sequence, not a UID sequence). Server implementations need 3824 to automatically map the "$" marker value to message numbers or UIDs, 3825 depending on context where the "$" marker is used. 3827 6.4.4.2. Multiple Commands in Progress 3829 Use of a SEARCH RETURN (SAVE) command followed by a command using the 3830 "$" marker creates direct dependency between the two commands. As 3831 directed by Section 5.5, a server MUST execute the two commands in 3832 the order they were received. 3834 A client MAY pipeline a SEARCH RETURN (SAVE) command with one or more 3835 command using the "$" marker, as long as this doesn't create an 3836 ambiguity, as described in by Section 5.5. Examples 7-9 in 3837 Section 6.4.4.4 explain this in more details. 3839 6.4.4.3. Refusing to Save Search Results 3841 In some cases, the server MAY refuse to save a SEARCH (SAVE) result, 3842 for example, if an internal limit on the number of saved results is 3843 reached. In this case, the server MUST return a tagged NO response 3844 containing the NOTSAVED response code and set the search result 3845 variable to the empty sequence, as described in Section 6.4.4.1. 3847 6.4.4.4. Examples showing use of SAVE result option 3849 Only in this section: explanatory comments in examples that start 3850 with // are not part of the protocol. 3852 1) The following example demonstrates how the client can use the 3853 result of a SEARCH command to FETCH headers of interesting messages: 3855 Example 1: 3856 C: A282 SEARCH RETURN (SAVE) FLAGGED SINCE 1-Feb-1994 3857 NOT FROM "Smith" 3858 S: A282 OK SEARCH completed, result saved 3859 C: A283 FETCH $ (UID INTERNALDATE FLAGS BODY.PEEK[HEADER]) 3860 S: * 2 FETCH (UID 14 ... 3861 S: * 84 FETCH (UID 100 ... 3862 S: * 882 FETCH (UID 1115 ... 3863 S: A283 OK completed 3865 The client can also pipeline the two commands: 3867 Example 2: 3868 C: A282 SEARCH RETURN (SAVE) FLAGGED SINCE 1-Feb-1994 3869 NOT FROM "Smith" 3870 C: A283 FETCH $ (UID INTERNALDATE FLAGS BODY.PEEK[HEADER]) 3871 S: A282 OK SEARCH completed 3872 S: * 2 FETCH (UID 14 ... 3873 S: * 84 FETCH (UID 100 ... 3874 S: * 882 FETCH (UID 1115 ... 3875 S: A283 OK completed 3877 2) The following example demonstrates that the result of one SEARCH 3878 command can be used as input to another SEARCH command: 3880 Example 3: 3881 C: A300 SEARCH RETURN (SAVE) SINCE 1-Jan-2004 3882 NOT FROM "Smith" 3883 S: A300 OK SEARCH completed 3884 C: A301 UID SEARCH UID $ SMALLER 4096 3885 S: * ESEARCH (TAG "A301") UID ALL 17,900,901 3886 S: A301 OK completed 3888 Note that the second command in Example 3 can be replaced with: 3889 C: A301 UID SEARCH $ SMALLER 4096 3890 and the result of the command would be the same. 3892 3) The following example shows that the "$" marker can be combined 3893 with other message numbers using the OR SEARCH criterion. 3895 Example 4: 3896 C: P282 SEARCH RETURN (SAVE) SINCE 1-Feb-1994 3897 NOT FROM "Smith" 3898 S: P282 OK SEARCH completed 3899 C: P283 SEARCH CHARSET UTF-8 (OR $ 1,3000:3021) TEXT {8} 3900 C: YYYYYYYY 3901 S: * ESEARCH (TAG "P283") ALL 882,1102,3003,3005:3006 3902 S: P283 OK completed 3904 Note: Since this document format is restricted to 7-bit ASCII text, 3905 it is not possible to show actual UTF-8 data. The "YYYYYYYY" is a 3906 placeholder for what would be 8 octets of 8-bit data in an actual 3907 transaction. 3909 4) The following example demonstrates that a failed SEARCH sets the 3910 search result variable to the empty list. The server doesn't 3911 implement the KOI8-R charset. 3913 Example 5: 3914 C: B282 SEARCH RETURN (SAVE) SINCE 1-Feb-1994 3915 NOT FROM "Smith" 3916 S: B282 OK SEARCH completed 3917 C: B283 SEARCH RETURN (SAVE) CHARSET KOI8-R 3918 (OR $ 1,3000:3021) TEXT {4} 3919 C: XXXX 3920 S: B283 NO [BADCHARSET UTF-8] KOI8-R is not supported 3921 //After this command the saved result variable contains 3922 //no messages. A client that wants to reissue the B283 3923 //SEARCH command with another CHARSET would have to reissue 3924 //the B282 command as well. One possible workaround for 3925 //this is to include the desired CHARSET parameter 3926 //in the earliest SEARCH RETURN (SAVE) command in a 3927 //sequence of related SEARCH commands, to cause 3928 //the earliest SEARCH in the sequence to fail. 3929 //A better approach might be to always use CHARSET UTF-8 3930 //instead. 3932 Note: Since this document format is restricted to 7-bit ASCII text, 3933 it is not possible to show actual KOI8-R data. The "XXXX" is a 3934 placeholder for what would be 4 octets of 8-bit data in an actual 3935 transaction. 3937 5) The following example demonstrates that it is not an error to use 3938 the "$" marker when it contains no messages. 3940 Example 6: 3941 C: E282 SEARCH RETURN (SAVE) SINCE 28-Oct-2006 3942 NOT FROM "Eric" 3943 C: E283 COPY $ "Other Messages" 3944 //The "$" contains no messages 3945 S: E282 OK SEARCH completed 3946 S: E283 OK COPY completed, nothing copied 3948 Example 7: 3949 C: F282 SEARCH RETURN (SAVE) KEYWORD $Junk 3950 C: F283 COPY $ "Junk" 3951 C: F284 STORE $ +FLAGS.Silent (\Deleted) 3952 S: F282 OK SEARCH completed 3953 S: F283 OK COPY completed 3954 S: F284 OK STORE completed 3956 Example 8: 3957 C: G282 SEARCH RETURN (SAVE) KEYWORD $Junk 3958 C: G283 SEARCH RETURN (ALL) SINCE 28-Oct-2006 3959 FROM "Eric" 3960 // The server can execute the two SEARCH commands 3961 // in any order, as they don't have any dependency. 3962 // For example, it may return: 3963 S: * ESEARCH (TAG "G283") ALL 3:15,27,29:103 3964 S: G283 OK SEARCH completed 3965 S: G282 OK SEARCH completed 3967 The following example demonstrates that the result of the second 3968 SEARCH RETURN (SAVE) always overrides the result of the first. 3970 Example 9: 3971 C: H282 SEARCH RETURN (SAVE) KEYWORD $Junk 3972 C: H283 SEARCH RETURN (SAVE) SINCE 28-Oct-2006 3973 FROM "Eric" 3974 S: H282 OK SEARCH completed 3975 S: H283 OK SEARCH completed 3976 // At this point "$" would contain results of H283 3978 The following example demonstrates behavioral difference for 3979 different combinations of ESEARCH result options. 3981 Example 10: 3982 C: C282 SEARCH RETURN (ALL) SINCE 12-Feb-2006 3983 NOT FROM "Smith" 3984 S: * ESEARCH (TAG "C283") ALL 2,10:15,21 3985 //$ value hasn't changed 3986 S: C282 OK SEARCH completed 3988 C: C283 SEARCH RETURN (ALL SAVE) SINCE 12-Feb-2006 3989 NOT FROM "Smith" 3990 S: * ESEARCH (TAG "C283") ALL 2,10:15,21 3991 //$ value is 2,10:15,21 3992 S: C283 OK SEARCH completed 3994 C: C284 SEARCH RETURN (SAVE MIN) SINCE 12-Feb-2006 3995 NOT FROM "Smith" 3996 S: * ESEARCH (TAG "C284") MIN 2 3997 //$ value is 2 3998 S: C284 OK SEARCH completed 4000 C: C285 SEARCH RETURN (MAX SAVE MIN) SINCE 4001 12-Feb-2006 NOT FROM "Smith" 4002 S: * ESEARCH (TAG "C285") MIN 2 MAX 21 4003 //$ value is 2,21 4004 S: C285 OK SEARCH completed 4006 C: C286 SEARCH RETURN (MAX SAVE MIN COUNT) 4007 SINCE 12-Feb-2006 NOT FROM "Smith" 4008 S: * ESEARCH (TAG "C286") MIN 2 MAX 21 COUNT 8 4009 //$ value is 2,10:15,21 4010 S: C286 OK SEARCH completed 4012 C: C286 SEARCH RETURN (ALL SAVE MIN) SINCE 4013 12-Feb-2006 NOT FROM "Smith" 4014 S: * ESEARCH (TAG "C286") MIN 2 ALL 2,10:15,21 4015 //$ value is 2,10:15,21 4016 S: C286 OK SEARCH completed 4018 6.4.5. FETCH Command 4020 Arguments: sequence set 4021 message data item names or macro 4023 Responses: untagged responses: FETCH 4025 Result: OK - fetch completed 4026 NO - fetch error: can't fetch that data 4027 BAD - command unknown or arguments invalid 4029 The FETCH command retrieves data associated with a message in the 4030 mailbox. The data items to be fetched can be either a single atom or 4031 a parenthesized list. 4033 Most data items, identified in the formal syntax under the msg-att- 4034 static rule, are static and MUST NOT change for any particular 4035 message. Other data items, identified in the formal syntax under the 4036 msg-att-dynamic rule, MAY change, either as a result of a STORE 4037 command or due to external events. 4039 For example, if a client receives an ENVELOPE for a message when 4040 it already knows the envelope, it can safely ignore the newly 4041 transmitted envelope. 4043 There are three macros which specify commonly-used sets of data 4044 items, and can be used instead of data items. A macro must be used 4045 by itself, and not in conjunction with other macros or data items. 4047 ALL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) 4049 FAST Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE) 4051 FULL Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE 4052 BODY) 4054 Several data items reference "section" or "section-binary". See 4055 Section 6.4.5.1 for their detailed definition. 4057 The currently defined data items that can be fetched are: 4059 BINARY[]<> 4061 Requests that the specified section be transmitted after 4062 performing Content-Transfer-Encoding-related decoding. 4064 The argument, if present, requests that a subset of 4065 the data be returned. The semantics of a partial FETCH BINARY 4066 command are the same as for a partial FETCH BODY command, with 4067 the exception that the arguments refer to the DECODED 4068 section data. 4070 Note that this data item can only be requested for leaf (i.e. 4071 non multipart/*, non message/rfc822 and non message/global) 4072 body parts. 4074 BINARY.PEEK[]<> An alternate form of 4075 BINARY[] that does not implicitly set the \Seen 4076 flag. 4078 BINARY.SIZE[] 4080 Requests the decoded size of the section (i.e., the size to 4081 expect in response to the corresponding FETCH BINARY request). 4083 Note: client authors are cautioned that this might be an 4084 expensive operation for some server implementations. 4085 Needlessly issuing this request could result in degraded 4086 performance due to servers having to calculate the value every 4087 time the request is issued. 4089 Note that this data item can only be requested for leaf (i.e. 4090 non multipart/*, non message/rfc822 and non message/global) 4091 body parts. 4093 BODY Non-extensible form of BODYSTRUCTURE. 4095 BODY[
]<> 4097 The text of a particular body section. 4099 It is possible to fetch a substring of the designated text. 4100 This is done by appending an open angle bracket ("<"), the 4101 octet position of the first desired octet, a period, the 4102 maximum number of octets desired, and a close angle bracket 4103 (">") to the part specifier. If the starting octet is beyond 4104 the end of the text, an empty string is returned. 4106 Any partial fetch that attempts to read beyond the end of the 4107 text is truncated as appropriate. A partial fetch that starts 4108 at octet 0 is returned as a partial fetch, even if this 4109 truncation happened. 4111 Note: This means that BODY[]<0.2048> of a 1500-octet message 4112 will return BODY[]<0> with a literal of size 1500, not 4113 BODY[]. 4115 Note: A substring fetch of a HEADER.FIELDS or 4116 HEADER.FIELDS.NOT part specifier is calculated after 4117 subsetting the header. 4119 The \Seen flag is implicitly set; if this causes the flags to 4120 change, they SHOULD be included as part of the FETCH responses. 4122 BODY.PEEK[
]<> An alternate form of BODY[
] 4123 that does not implicitly set the \Seen flag. 4125 BODYSTRUCTURE The [MIME-IMB] body structure of the message. This is 4126 computed by the server by parsing the [MIME-IMB] header fields in 4127 the [RFC-5322] header and [MIME-IMB] headers. See Section 7.4.2 4128 for more details. 4130 ENVELOPE The envelope structure of the message. This is computed by 4131 the server by parsing the [RFC-5322] header into the component 4132 parts, defaulting various fields as necessary. See Section 7.4.2 4133 for more details. 4135 FLAGS The flags that are set for this message. 4137 INTERNALDATE The internal date of the message. 4139 RFC822.SIZE The [RFC-5322] size of the message. 4141 UID The unique identifier for the message. 4143 Example: C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)]) 4144 S: * 2 FETCH .... 4145 S: * 3 FETCH .... 4146 S: * 4 FETCH .... 4147 S: A654 OK FETCH completed 4149 6.4.5.1. FETCH section specification 4151 Several FETCH data items reference "section" or "section-binary". 4152 The section specification is a set of zero or more part specifiers 4153 delimited by periods. A part specifier is either a part number or 4154 one of the following: HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, MIME, 4155 and TEXT. (Non numeric part specifiers have to be the last specifier 4156 in a section specification.) An empty section specification refers 4157 to the entire message, including the header. 4159 Every message has at least one part number. Non-[MIME-IMB] messages, 4160 and non-multipart [MIME-IMB] messages with no encapsulated message, 4161 only have a part 1. 4163 Multipart messages are assigned consecutive part numbers, as they 4164 occur in the message. If a particular part is of type message or 4165 multipart, its parts MUST be indicated by a period followed by the 4166 part number within that nested multipart part. 4168 A part of type MESSAGE/RFC822 or MESSAGE/GLOBAL also has nested part 4169 numbers, referring to parts of the MESSAGE part's body. 4171 The HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, and TEXT part 4172 specifiers can be the sole part specifier or can be prefixed by one 4173 or more numeric part specifiers, provided that the numeric part 4174 specifier refers to a part of type MESSAGE/RFC822 or MESSAGE/GLOBAL. 4175 The MIME part specifier MUST be prefixed by one or more numeric part 4176 specifiers. 4178 The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part specifiers 4179 refer to the [RFC-5322] header of the message or of an encapsulated 4180 [MIME-IMT] MESSAGE/RFC822 or MESSAGE/GLOBAL message. HEADER.FIELDS 4181 and HEADER.FIELDS.NOT are followed by a list of field-name (as 4182 defined in [RFC-5322]) names, and return a subset of the header. The 4183 subset returned by HEADER.FIELDS contains only those header fields 4184 with a field-name that matches one of the names in the list; 4185 similarly, the subset returned by HEADER.FIELDS.NOT contains only the 4186 header fields with a non-matching field-name. The field-matching is 4187 ASCII range case-insensitive but otherwise exact. Subsetting does 4188 not exclude the [RFC-5322] delimiting blank line between the header 4189 and the body; the blank line is included in all header fetches, 4190 except in the case of a message which has no body and no blank line. 4192 The MIME part specifier refers to the [MIME-IMB] header for this 4193 part. 4195 The TEXT part specifier refers to the text body of the message, 4196 omitting the [RFC-5322] header. 4198 Here is an example of a complex message with some of its part 4199 specifiers: 4201 HEADER ([RFC-5322] header of the message) 4202 TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 4203 1 TEXT/PLAIN 4204 2 APPLICATION/OCTET-STREAM 4205 3 MESSAGE/RFC822 4206 3.HEADER ([RFC-5322] header of the message) 4207 3.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 4208 3.1 TEXT/PLAIN 4209 3.2 APPLICATION/OCTET-STREAM 4210 4 MULTIPART/MIXED 4211 4.1 IMAGE/GIF 4212 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF) 4213 4.2 MESSAGE/RFC822 4214 4.2.HEADER ([RFC-5322] header of the message) 4215 4.2.TEXT ([RFC-5322] text body of the message) MULTIPART/MIXED 4216 4.2.1 TEXT/PLAIN 4217 4.2.2 MULTIPART/ALTERNATIVE 4218 4.2.2.1 TEXT/PLAIN 4219 4.2.2.2 TEXT/RICHTEXT 4221 6.4.6. STORE Command 4223 Arguments: sequence set 4224 message data item name 4225 value for message data item 4227 Responses: untagged responses: FETCH 4229 Result: OK - store completed 4230 NO - store error: can't store that data 4231 BAD - command unknown or arguments invalid 4233 The STORE command alters data associated with a message in the 4234 mailbox. Normally, STORE will return the updated value of the data 4235 with an untagged FETCH response. A suffix of ".SILENT" in the data 4236 item name prevents the untagged FETCH, and the server SHOULD assume 4237 that the client has determined the updated value itself or does not 4238 care about the updated value. 4240 Note: Regardless of whether or not the ".SILENT" suffix was used, 4241 the server SHOULD send an untagged FETCH response if a change to a 4242 message's flags from an external source is observed. The intent 4243 is that the status of the flags is determinate without a race 4244 condition. 4246 The currently defined data items that can be stored are: 4248 FLAGS Replace the flags for the message with the 4249 argument. The new value of the flags is returned as if a FETCH of 4250 those flags was done. 4252 FLAGS.SILENT Equivalent to FLAGS, but without returning 4253 a new value. 4255 +FLAGS Add the argument to the flags for the message. 4256 The new value of the flags is returned as if a FETCH of those 4257 flags was done. 4259 +FLAGS.SILENT Equivalent to +FLAGS, but without 4260 returning a new value. 4262 -FLAGS Remove the argument from the flags for the 4263 message. The new value of the flags is returned as if a FETCH of 4264 those flags was done. 4266 -FLAGS.SILENT Equivalent to -FLAGS, but without 4267 returning a new value. 4269 Example: C: A003 STORE 2:4 +FLAGS (\Deleted) 4270 S: * 2 FETCH (FLAGS (\Deleted \Seen)) 4271 S: * 3 FETCH (FLAGS (\Deleted)) 4272 S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen)) 4273 S: A003 OK STORE completed 4275 6.4.7. COPY Command 4277 Arguments: sequence set 4278 mailbox name 4280 Responses: no specific responses for this command 4282 Result: OK - copy completed 4283 NO - copy error: can't copy those messages or to that 4284 name 4285 BAD - command unknown or arguments invalid 4287 The COPY command copies the specified message(s) to the end of the 4288 specified destination mailbox. The flags and internal date of the 4289 message(s) SHOULD be preserved in the copy. 4291 If the destination mailbox does not exist, a server SHOULD return an 4292 error. It SHOULD NOT automatically create the mailbox. Unless it is 4293 certain that the destination mailbox can not be created, the server 4294 MUST send the response code "[TRYCREATE]" as the prefix of the text 4295 of the tagged NO response. This gives a hint to the client that it 4296 can attempt a CREATE command and retry the COPY if the CREATE is 4297 successful. 4299 If the COPY command is unsuccessful for any reason, server 4300 implementations MUST restore the destination mailbox to its state 4301 before the COPY attempt. 4303 On successful completion of a COPY, the server SHOULD return a 4304 COPYUID response code (see Section 7.1). 4306 In the case of a mailbox that has permissions set so that the client 4307 can COPY to the mailbox, but not SELECT or EXAMINE it, the server 4308 SHOULD NOT send an COPYUID response code as it would disclose 4309 information about the mailbox. 4311 In the case of a mailbox that has UIDNOTSTICKY status (see 4312 Section 7.1), the server MAY omit the COPYUID response code as it is 4313 not meaningful. 4315 If the server does not return the COPYUID response code, the client 4316 can discover this information by selecting the destination mailbox. 4318 The location of messages placed in the destination mailbox by COPY 4319 can be determined by using FETCH and/or SEARCH commands (e.g., for 4320 Message-ID). 4322 Example: C: A003 COPY 2:4 MEETING 4323 S: A003 OK COPY completed 4325 6.4.8. MOVE Command 4327 Arguments: sequence set 4328 mailbox name 4330 Responses: no specific responses for this command 4332 Result: OK - move completed 4333 NO - move error: can't move those messages or to that 4334 name 4335 BAD - command unknown or arguments invalid 4337 The MOVE command moves the specified message(s) to the end of the 4338 specified destination mailbox. The flags and internal date of the 4339 message(s) SHOULD be preserved. 4341 This means that a new message is created in the target mailbox with a 4342 new UID, the original message is removed from the source mailbox, and 4343 it appears to the client as a single action. This has the same 4344 effect for each message as this sequence: 4346 1. [UID] COPY 4348 2. [UID] STORE +FLAGS.SILENT \DELETED 4350 3. UID EXPUNGE 4352 Although the effect of the MOVE is the same as the preceding steps, 4353 the semantics are not identical: The intermediate states produced by 4354 those steps do not occur, and the response codes are different. In 4355 particular, though the COPY and EXPUNGE response codes will be 4356 returned, response codes for a STORE MUST NOT be generated and the 4357 \Deleted flag MUST NOT be set for any message. 4359 Because a MOVE applies to a set of messages, it might fail partway 4360 through the set. Regardless of whether the command is successful in 4361 moving the entire set, each individual message SHOULD either be moved 4362 or unaffected. The server MUST leave each message in a state where 4363 it is in at least one of the source or target mailboxes (no message 4364 can be lost or orphaned). The server SHOULD NOT leave any message in 4365 both mailboxes (it would be bad for a partial failure to result in a 4366 bunch of duplicate messages). This is true even if the server 4367 returns a tagged NO response to the command. 4369 Because of the similarity of MOVE to COPY, extensions that affect 4370 COPY affect MOVE in the same way. Response codes such as TRYCREATE 4371 (see Section 7.1), as well as those defined by extensions, are sent 4372 as appropriate. 4374 Servers SHOULD send COPYUID in response to a UID MOVE (see 4375 Section 6.4.9) command. For additional information see Section 7.1. 4377 Servers are also advised to send the COPYUID response code in an 4378 untagged OK before sending EXPUNGE or moved responses. (Sending 4379 COPYUID in the tagged OK, as described in the UIDPLUS specification, 4380 means that clients first receive an EXPUNGE for a message and 4381 afterwards COPYUID for the same message. It can be unnecessarily 4382 difficult to process that sequence usefully.) 4384 An example: 4385 C: a UID MOVE 42:69 foo 4386 S: * OK [COPYUID 432432 42:69 1202:1229] 4387 S: * 22 EXPUNGE 4388 S: (more expunges) 4389 S: a OK Done 4391 Note that the server may send unrelated EXPUNGE responses as well, if 4392 any happen to have been expunged at the same time; this is normal 4393 IMAP operation. 4395 Note that moving a message to the currently selected mailbox (that 4396 is, where the source and target mailboxes are the same) is allowed 4397 when copying the message to the currently selected mailbox is 4398 allowed. 4400 The server may send EXPUNGE responses before the tagged response, so 4401 the client cannot safely send more commands with message sequence 4402 number arguments while the server is processing MOVE. 4404 MOVE and UID MOVE can be pipelined with other commands, but care has 4405 to be taken. Both commands modify sequence numbers and also allow 4406 unrelated EXPUNGE responses. The renumbering of other messages in 4407 the source mailbox following any EXPUNGE response can be surprising 4408 and makes it unsafe to pipeline any command that relies on message 4409 sequence numbers after a MOVE or UID MOVE. Similarly, MOVE cannot be 4410 pipelined with a command that might cause message renumbering. See 4411 Section 5.5, for more information about ambiguities as well as 4412 handling requirements for both clients and servers. 4414 6.4.9. UID Command 4416 Arguments: command name 4417 command arguments 4419 Responses: untagged responses: FETCH, ESEARCH, EXPUNGE 4421 Result: OK - UID command completed 4422 NO - UID command error 4423 BAD - command unknown or arguments invalid 4425 The UID command has three forms. In the first form, it takes as its 4426 arguments a COPY, MOVE, FETCH, or STORE command with arguments 4427 appropriate for the associated command. However, the numbers in the 4428 sequence set argument are unique identifiers instead of message 4429 sequence numbers. Sequence set ranges are permitted, but there is no 4430 guarantee that unique identifiers will be contiguous. 4432 A non-existent unique identifier is ignored without any error message 4433 generated. Thus, it is possible for a UID FETCH command to return an 4434 OK without any data or a UID COPY, UID MOVE or UID STORE to return an 4435 OK without performing any operations. 4437 In the second form, the UID command takes an EXPUNGE command with an 4438 extra parameter the specified a sequence set of UIDs to operate on. 4439 The UID EXPUNGE command permanently removes all messages that both 4440 have the \Deleted flag set and have a UID that is included in the 4441 specified sequence set from the currently selected mailbox. If a 4442 message either does not have the \Deleted flag set or has a UID that 4443 is not included in the specified sequence set, it is not affected. 4445 UID EXPUNGE is particularly useful for disconnected use clients. 4446 By using UID EXPUNGE instead of EXPUNGE when resynchronizing with 4447 the server, the client can ensure that it does not inadvertantly 4448 remove any messages that have been marked as \Deleted by other 4449 clients between the time that the client was last connected and 4450 the time the client resynchronizes. 4452 Example: C: A003 UID EXPUNGE 3000:3002 4453 S: * 3 EXPUNGE 4454 S: * 3 EXPUNGE 4455 S: * 3 EXPUNGE 4456 S: A003 OK UID EXPUNGE completed 4458 In the third form, the UID command takes a SEARCH command with SEARCH 4459 command arguments. The interpretation of the arguments is the same 4460 as with SEARCH; however, the numbers returned in a ESEARCH response 4461 for a UID SEARCH command are unique identifiers instead of message 4462 sequence numbers. Also, the corresponding ESEARCH response MUST 4463 include the UID indicator. For example, the command UID SEARCH 1:100 4464 UID 443:557 returns the unique identifiers corresponding to the 4465 intersection of two sequence sets, the message sequence number range 4466 1:100 and the UID range 443:557. 4468 Note: in the above example, the UID range 443:557 appears. The 4469 same comment about a non-existent unique identifier being ignored 4470 without any error message also applies here. Hence, even if 4471 neither UID 443 or 557 exist, this range is valid and would 4472 include an existing UID 495. 4474 Also note that a UID range of 559:* always includes the UID of the 4475 last message in the mailbox, even if 559 is higher than any 4476 assigned UID value. This is because the contents of a range are 4477 independent of the order of the range endpoints. Thus, any UID 4478 range with * as one of the endpoints indicates at least one 4479 message (the message with the highest numbered UID), unless the 4480 mailbox is empty. 4482 The number after the "*" in an untagged FETCH or EXPUNGE response is 4483 always a message sequence number, not a unique identifier, even for a 4484 UID command response. However, server implementations MUST 4485 implicitly include the UID message data item as part of any FETCH 4486 response caused by a UID command, regardless of whether a UID was 4487 specified as a message data item to the FETCH. 4489 Note: The rule about including the UID message data item as part of a 4490 FETCH response primarily applies to the UID FETCH and UID STORE 4491 commands, including a UID FETCH command that does not include UID as 4492 a message data item. Although it is unlikely that the other UID 4493 commands will cause an untagged FETCH, this rule applies to these 4494 commands as well. 4496 Example: C: A999 UID FETCH 4827313:4828442 FLAGS 4497 S: * 23 FETCH (FLAGS (\Seen) UID 4827313) 4498 S: * 24 FETCH (FLAGS (\Seen) UID 4827943) 4499 S: * 25 FETCH (FLAGS (\Seen) UID 4828442) 4500 S: A999 OK UID FETCH completed 4502 6.5. Client Commands - Experimental/Expansion 4504 6.5.1. X Command 4506 Arguments: implementation defined 4508 Responses: implementation defined 4509 Result: OK - command completed 4510 NO - failure 4511 BAD - command unknown or arguments invalid 4513 Any command prefixed with an X is an experimental command. Commands 4514 which are not part of this specification, a standard or standards- 4515 track revision of this specification, or an IESG-approved 4516 experimental protocol, MUST use the X prefix. 4518 Any added untagged responses issued by an experimental command MUST 4519 also be prefixed with an X. Server implementations MUST NOT send any 4520 such untagged responses, unless the client requested it by issuing 4521 the associated experimental command. 4523 Example: C: a441 CAPABILITY 4524 S: * CAPABILITY IMAP4rev2 XPIG-LATIN 4525 S: a441 OK CAPABILITY completed 4526 C: A442 XPIG-LATIN 4527 S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay 4528 S: A442 OK XPIG-LATIN ompleted-cay 4530 7. Server Responses 4532 Server responses are in three forms: status responses, server data, 4533 and command continuation request. The information contained in a 4534 server response, identified by "Contents:" in the response 4535 descriptions below, is described by function, not by syntax. The 4536 precise syntax of server responses is described in the Formal Syntax 4537 section. 4539 The client MUST be prepared to accept any response at all times. 4541 Status responses can be tagged or untagged. Tagged status responses 4542 indicate the completion result (OK, NO, or BAD status) of a client 4543 command, and have a tag matching the command. 4545 Some status responses, and all server data, are untagged. An 4546 untagged response is indicated by the token "*" instead of a tag. 4547 Untagged status responses indicate server greeting, or server status 4548 that does not indicate the completion of a command (for example, an 4549 impending system shutdown alert). For historical reasons, untagged 4550 server data responses are also called "unsolicited data", although 4551 strictly speaking, only unilateral server data is truly 4552 "unsolicited". 4554 Certain server data MUST be recorded by the client when it is 4555 received; this is noted in the description of that data. Such data 4556 conveys critical information which affects the interpretation of all 4557 subsequent commands and responses (e.g., updates reflecting the 4558 creation or destruction of messages). 4560 Other server data SHOULD be recorded for later reference; if the 4561 client does not need to record the data, or if recording the data has 4562 no obvious purpose (e.g., a SEARCH response when no SEARCH command is 4563 in progress), the data SHOULD be ignored. 4565 An example of unilateral untagged server data occurs when the IMAP 4566 connection is in the selected state. In the selected state, the 4567 server checks the mailbox for new messages as part of command 4568 execution. Normally, this is part of the execution of every command; 4569 hence, a NOOP command suffices to check for new messages. If new 4570 messages are found, the server sends untagged EXISTS response 4571 reflecting the new size of the mailbox. Server implementations that 4572 offer multiple simultaneous access to the same mailbox SHOULD also 4573 send appropriate unilateral untagged FETCH and EXPUNGE responses if 4574 another agent changes the state of any message flags or expunges any 4575 messages. 4577 Command continuation request responses use the token "+" instead of a 4578 tag. These responses are sent by the server to indicate acceptance 4579 of an incomplete client command and readiness for the remainder of 4580 the command. 4582 7.1. Server Responses - Status Responses 4584 Status responses are OK, NO, BAD, PREAUTH and BYE. OK, NO, and BAD 4585 can be tagged or untagged. PREAUTH and BYE are always untagged. 4587 Status responses MAY include an OPTIONAL "response code". A response 4588 code consists of data inside square brackets in the form of an atom, 4589 possibly followed by a space and arguments. The response code 4590 contains additional information or status codes for client software 4591 beyond the OK/NO/BAD condition, and are defined when there is a 4592 specific action that a client can take based upon the additional 4593 information. 4595 The currently defined response codes are: 4597 ALERT 4599 The human-readable text contains a special alert that MUST be 4600 presented to the user in a fashion that calls the user's 4601 attention to the message. 4603 ALREADYEXISTS 4604 The operation attempts to create something that already exists, 4605 such as when the CREATE or RENAME directories attempt to create 4606 a mailbox and there is already one of that name. 4608 C: o356 RENAME this that 4609 S: o356 NO [ALREADYEXISTS] Mailbox "that" already exists 4611 APPENDUID 4613 Followed by the UIDVALIDITY of the destination mailbox and the 4614 UID assigned to the appended message in the destination 4615 mailbox, indicates that the message has been appended to the 4616 destination mailbox with that UID. 4618 If the server also supports the [MULTIAPPEND] extension, and if 4619 multiple messages were appended in the APPEND command, then the 4620 second value is a UID set containing the UIDs assigned to the 4621 appended messages, in the order they were transmitted in the 4622 APPEND command. This UID set may not contain extraneous UIDs 4623 or the symbol "*". 4625 Note: the UID set form of the APPENDUID response code MUST 4626 NOT be used if only a single message was appended. In 4627 particular, a server MUST NOT send a range such as 123:123. 4628 This is because a client that does not support [MULTIAPPEND] 4629 expects only a single UID and not a UID set. 4631 UIDs are assigned in strictly ascending order in the mailbox 4632 (refer to Section 2.3.1.1); note that a range of 12:10 is 4633 exactly equivalent to 10:12 and refers to the sequence 4634 10,11,12. 4636 This response code is returned in a tagged OK response to the 4637 APPEND command. 4639 AUTHENTICATIONFAILED 4641 Authentication failed for some reason on which the server is 4642 unwilling to elaborate. Typically, this includes "unknown 4643 user" and "bad password". 4645 This is the same as not sending any response code, except that 4646 when a client sees AUTHENTICATIONFAILED, it knows that the 4647 problem wasn't, e.g., UNAVAILABLE, so there's no point in 4648 trying the same login/password again later. 4650 C: b LOGIN "fred" "foo" 4651 S: b NO [AUTHENTICATIONFAILED] Authentication failed 4653 AUTHORIZATIONFAILED 4655 Authentication succeeded in using the authentication identity, 4656 but the server cannot or will not allow the authentication 4657 identity to act as the requested authorization identity. This 4658 is only applicable when the authentication and authorization 4659 identities are different. 4661 C: c1 AUTHENTICATE PLAIN 4662 [...] 4663 S: c1 NO [AUTHORIZATIONFAILED] No such authorization-ID 4665 C: c2 AUTHENTICATE PLAIN 4666 [...] 4667 S: c2 NO [AUTHORIZATIONFAILED] Authenticator is not an admin 4669 BADCHARSET 4671 Optionally followed by a parenthesized list of charsets. A 4672 SEARCH failed because the given charset is not supported by 4673 this implementation. If the optional list of charsets is 4674 given, this lists the charsets that are supported by this 4675 implementation. 4677 CANNOT 4679 The operation violates some invariant of the server and can 4680 never succeed. 4682 C: l create "///////" 4683 S: l NO [CANNOT] Adjacent slashes are not supported 4685 CAPABILITY 4687 Followed by a list of capabilities. This can appear in the 4688 initial OK or PREAUTH response to transmit an initial 4689 capabilities list. It can also appear in tagged responses to 4690 LOGIN or AUTHENTICATE commands. This makes it unnecessary for 4691 a client to send a separate CAPABILITY command if it recognizes 4692 this response. 4694 CLIENTBUG 4695 The server has detected a client bug. This can accompany all 4696 of OK, NO, and BAD, depending on what the client bug is. 4698 C: k1 select "/archive/projects/experiment-iv" 4699 [...] 4700 S: k1 OK [READ-ONLY] Done 4701 C: k2 status "/archive/projects/experiment-iv" (messages) 4702 [...] 4703 S: k2 OK [CLIENTBUG] Done 4705 CLOSED 4707 The CLOSED response code has no parameters. A server return 4708 the CLOSED response code when the currently selected mailbox is 4709 closed implicitly using the SELECT/EXAMINE command on another 4710 mailbox. The CLOSED response code serves as a boundary between 4711 responses for the previously opened mailbox (which was closed) 4712 and the newly selected mailbox; all responses before the CLOSED 4713 response code relate to the mailbox that was closed, and all 4714 subsequent responses relate to the newly opened mailbox. 4716 There is no need to return the CLOSED response code on 4717 completion of the CLOSE or the UNSELECT command (or similar), 4718 whose purpose is to close the currently selected mailbox 4719 without opening a new one. 4721 CONTACTADMIN 4723 The user should contact the system administrator or support 4724 desk. 4726 C: e login "fred" "foo" 4727 S: e OK [CONTACTADMIN] 4729 COPYUID 4731 Followed by the UIDVALIDITY of the destination mailbox, a UID 4732 set containing the UIDs of the message(s) in the source mailbox 4733 that were copied to the destination mailbox and containing the 4734 UIDs assigned to the copied message(s) in the destination 4735 mailbox, indicates that the message(s) have been copied to the 4736 destination mailbox with the stated UID(s). 4738 The source UID set is in the order the message(s) were copied; 4739 the destination UID set corresponds to the source UID set and 4740 is in the same order. Neither of the UID sets may contain 4741 extraneous UIDs or the symbol "*". 4743 UIDs are assigned in strictly ascending order in the mailbox 4744 (refer to Section 2.3.1.1); note that a range of 12:10 is 4745 exactly equivalent to 10:12 and refers to the sequence 4746 10,11,12. 4748 This response code is returned in a tagged OK response to the 4749 COPY command. 4751 CORRUPTION 4753 The server discovered that some relevant data (e.g., the 4754 mailbox) are corrupt. This response code does not include any 4755 information about what's corrupt, but the server can write that 4756 to its logfiles. 4758 C: i select "/archive/projects/experiment-iv" 4759 S: i NO [CORRUPTION] Cannot open mailbox 4761 EXPIRED 4763 Either authentication succeeded or the server no longer had the 4764 necessary data; either way, access is no longer permitted using 4765 that passphrase. The client or user should get a new 4766 passphrase. 4768 C: d login "fred" "foo" 4769 S: d NO [EXPIRED] That password isn't valid any more 4771 EXPUNGEISSUED 4773 Someone else has issued an EXPUNGE for the same mailbox. The 4774 client may want to issue NOOP soon. [IMAP-MULTIACCESS] 4775 discusses this subject in depth. 4777 C: h search from fred@example.com 4778 S: * ESEARCH (TAG "h") ALL 1:3,5,8,13,21,42 4779 S: h OK [EXPUNGEISSUED] Search completed 4781 HASCHILDREN 4783 The mailbox delete operation failed because the mailbox has one 4784 or more children and the server doesn't allow deletion of 4785 mailboxes with children. 4787 C: m356 DELETE Notes 4788 S: o356 NO [HASCHILDREN] Mailbox "Notes" has children that need 4789 to be deleted first 4791 INUSE 4793 An operation has not been carried out because it involves 4794 sawing off a branch someone else is sitting on. Someone else 4795 may be holding an exclusive lock needed for this operation, or 4796 the operation may involve deleting a resource someone else is 4797 using, typically a mailbox. 4799 The operation may succeed if the client tries again later. 4801 C: g delete "/archive/projects/experiment-iv" 4802 S: g NO [INUSE] Mailbox in use 4804 LIMIT 4806 The operation ran up against an implementation limit of some 4807 kind, such as the number of flags on a single message or the 4808 number of flags used in a mailbox. 4810 C: m STORE 42 FLAGS f1 f2 f3 f4 f5 ... f250 4811 S: m NO [LIMIT] At most 32 flags in one mailbox supported 4813 NONEXISTENT 4815 The operation attempts to delete something that does not exist. 4816 Similar to ALREADYEXISTS. 4818 C: p RENAME this that 4819 S: p NO [NONEXISTENT] No such mailbox 4821 NOPERM 4823 The access control system (e.g., Access Control List (ACL), see 4824 [RFC4314] does not permit this user to carry out an operation, 4825 such as selecting or creating a mailbox. 4827 C: f select "/archive/projects/experiment-iv" 4828 S: f NO [NOPERM] Access denied 4830 OVERQUOTA 4832 The user would be over quota after the operation. (The user 4833 may or may not be over quota already.) 4835 Note that if the server sends OVERQUOTA but doesn't support the 4836 IMAP QUOTA extension defined by [RFC2087], then there is a 4837 quota, but the client cannot find out what the quota is. 4839 C: n1 uid copy 1:* oldmail 4840 S: n1 NO [OVERQUOTA] Sorry 4842 C: n2 uid copy 1:* oldmail 4843 S: n2 OK [OVERQUOTA] You are now over your soft quota 4845 PARSE 4847 The human-readable text represents an error in parsing the 4848 [RFC-5322] header or [MIME-IMB] headers of a message in the 4849 mailbox. 4851 PERMANENTFLAGS 4853 Followed by a parenthesized list of flags, indicates which of 4854 the known flags the client can change permanently. Any flags 4855 that are in the FLAGS untagged response, but not the 4856 PERMANENTFLAGS list, can not be set permanently. The 4857 PERMANENTFLAGS list can also include the special flag \*, which 4858 indicates that it is possible to create new keywords by 4859 attempting to store those keywords in the mailbox. If the 4860 client attempts to STORE a flag that is not in the 4861 PERMANENTFLAGS list, the server will either ignore the change 4862 or store the state change for the remainder of the current 4863 session only. 4865 There is no need for a server that included the special flag \* 4866 to return a new PERMANENTFLAGS response code when a new keyword 4867 was successfully set on a message upon client request. However 4868 if the server has a limit on the number of different keywords 4869 that can be stored in a mailbox and that limit is reached, the 4870 server MUST send a new PERMANENTFLAGS response code without the 4871 special flag \*. 4873 PRIVACYREQUIRED 4875 The operation is not permitted due to a lack of privacy. If 4876 Transport Layer Security (TLS) is not in use, the client could 4877 try STARTTLS (see Section 6.2.1) and then repeat the operation. 4879 C: d login "fred" "foo" 4880 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 4882 C: d select inbox 4883 S: d NO [PRIVACYREQUIRED] Connection offers no privacy 4885 READ-ONLY 4887 The mailbox is selected read-only, or its access while selected 4888 has changed from read-write to read-only. 4890 READ-WRITE 4892 The mailbox is selected read-write, or its access while 4893 selected has changed from read-only to read-write. 4895 SERVERBUG 4897 The server encountered a bug in itself or violated one of its 4898 own invariants. 4900 C: j select "/archive/projects/experiment-iv" 4901 S: j NO [SERVERBUG] This should not happen 4903 TRYCREATE 4905 An APPEND or COPY attempt is failing because the target mailbox 4906 does not exist (as opposed to some other reason). This is a 4907 hint to the client that the operation can succeed if the 4908 mailbox is first created by the CREATE command. 4910 UIDNEXT 4912 Followed by a decimal number, indicates the next unique 4913 identifier value. Refer to Section 2.3.1.1 for more 4914 information. 4916 UIDNOTSTICKY 4918 The selected mailbox is supported by a mail store that does not 4919 support persistent UIDs; that is, UIDVALIDITY will be different 4920 each time the mailbox is selected. Consequently, APPEND or 4921 COPY to this mailbox will not return an APPENDUID or COPYUID 4922 response code. 4924 This response code is returned in an untagged NO response to 4925 the SELECT command. 4927 Note: servers SHOULD NOT have any UIDNOTSTICKY mail stores. 4928 This facility exists to support legacy mail stores in which 4929 it is technically infeasible to support persistent UIDs. 4930 This should be avoided when designing new mail stores. 4932 UIDVALIDITY 4934 Followed by a decimal number, indicates the unique identifier 4935 validity value. Refer to Section 2.3.1.1 for more information. 4937 UNAVAILABLE 4939 Temporary failure because a subsystem is down. For example, an 4940 IMAP server that uses a Lightweight Directory Access Protocol 4941 (LDAP) or Radius server for authentication might use this 4942 response code when the LDAP/Radius server is down. 4944 C: a LOGIN "fred" "foo" 4945 S: a NO [UNAVAILABLE] User's backend down for maintenance 4947 UNKNOWN-CTE 4949 The server does not know how to decode the section's Content- 4950 Transfer-Encoding. 4952 Client implementations MUST ignore response codes that they do not 4953 recognize. 4955 7.1.1. OK Response 4957 Contents: OPTIONAL response code 4958 human-readable text 4960 The OK response indicates an information message from the server. 4961 When tagged, it indicates successful completion of the associated 4962 command. The human-readable text MAY be presented to the user as an 4963 information message. The untagged form indicates an information-only 4964 message; the nature of the information MAY be indicated by a response 4965 code. 4967 The untagged form is also used as one of three possible greetings at 4968 connection startup. It indicates that the connection is not yet 4969 authenticated and that a LOGIN or an AUTHENTICATE command is needed. 4971 Example: S: * OK IMAP4rev2 server ready 4972 C: A001 LOGIN fred blurdybloop 4973 S: * OK [ALERT] System shutdown in 10 minutes 4974 S: A001 OK LOGIN Completed 4976 7.1.2. NO Response 4978 Contents: OPTIONAL response code 4979 human-readable text 4981 The NO response indicates an operational error message from the 4982 server. When tagged, it indicates unsuccessful completion of the 4983 associated command. The untagged form indicates a warning; the 4984 command can still complete successfully. The human-readable text 4985 describes the condition. 4987 Example: C: A222 COPY 1:2 owatagusiam 4988 S: * NO Disk is 98% full, please delete unnecessary data 4989 S: A222 OK COPY completed 4990 C: A223 COPY 3:200 blurdybloop 4991 S: * NO Disk is 98% full, please delete unnecessary data 4992 S: * NO Disk is 99% full, please delete unnecessary data 4993 S: A223 NO COPY failed: disk is full 4995 7.1.3. BAD Response 4997 Contents: OPTIONAL response code 4998 human-readable text 5000 The BAD response indicates an error message from the server. When 5001 tagged, it reports a protocol-level error in the client's command; 5002 the tag indicates the command that caused the error. The untagged 5003 form indicates a protocol-level error for which the associated 5004 command can not be determined; it can also indicate an internal 5005 server failure. The human-readable text describes the condition. 5007 Example: C: ...very long command line... 5008 S: * BAD Command line too long 5009 C: ...empty line... 5010 S: * BAD Empty command line 5011 C: A443 EXPUNGE 5012 S: * BAD Disk crash, attempting salvage to a new disk! 5013 S: * OK Salvage successful, no data lost 5014 S: A443 OK Expunge completed 5016 7.1.4. PREAUTH Response 5018 Contents: OPTIONAL response code 5019 human-readable text 5021 The PREAUTH response is always untagged, and is one of three possible 5022 greetings at connection startup. It indicates that the connection 5023 has already been authenticated by external means; thus no LOGIN/ 5024 AUTHENTICATE command is needed. 5026 Example: S: * PREAUTH IMAP4rev2 server logged in as Smith 5028 7.1.5. BYE Response 5030 Contents: OPTIONAL response code 5031 human-readable text 5033 The BYE response is always untagged, and indicates that the server is 5034 about to close the connection. The human-readable text MAY be 5035 displayed to the user in a status report by the client. The BYE 5036 response is sent under one of four conditions: 5038 1. as part of a normal logout sequence. The server will close the 5039 connection after sending the tagged OK response to the LOGOUT 5040 command. 5042 2. as a panic shutdown announcement. The server closes the 5043 connection immediately. 5045 3. as an announcement of an inactivity autologout. The server 5046 closes the connection immediately. 5048 4. as one of three possible greetings at connection startup, 5049 indicating that the server is not willing to accept a connection 5050 from this client. The server closes the connection immediately. 5052 The difference between a BYE that occurs as part of a normal LOGOUT 5053 sequence (the first case) and a BYE that occurs because of a failure 5054 (the other three cases) is that the connection closes immediately in 5055 the failure case. In all cases the client SHOULD continue to read 5056 response data from the server until the connection is closed; this 5057 will ensure that any pending untagged or completion responses are 5058 read and processed. 5060 Example: S: * BYE Autologout; idle for too long 5062 7.2. Server Responses - Server and Mailbox Status 5064 These responses are always untagged. This is how server and mailbox 5065 status data are transmitted from the server to the client. Many of 5066 these responses typically result from a command with the same name. 5068 7.2.1. The ENABLED Response 5070 Contents: capability listing 5072 The ENABLED response occurs as a result of an ENABLE command. The 5073 capability listing contains a space-separated listing of capability 5074 names that the server supports and that were successfully enabled. 5075 The ENABLED response may contain no capabilities, which means that no 5076 extensions listed by the client were successfully enabled. 5078 7.2.2. CAPABILITY Response 5080 Contents: capability listing 5082 The CAPABILITY response occurs as a result of a CAPABILITY command. 5083 The capability listing contains a space-separated listing of 5084 capability names that the server supports. The capability listing 5085 MUST include the atom "IMAP4rev2". 5087 In addition, client and server implementations MUST implement the 5088 STARTTLS, LOGINDISABLED, and AUTH=PLAIN (described in [PLAIN]) 5089 capabilities. See the Security Considerations section for important 5090 information. 5092 A capability name which begins with "AUTH=" indicates that the server 5093 supports that particular authentication mechanism. 5095 The LOGINDISABLED capability indicates that the LOGIN command is 5096 disabled, and that the server will respond with a tagged NO response 5097 to any attempt to use the LOGIN command even if the user name and 5098 password are valid. An IMAP client MUST NOT issue the LOGIN command 5099 if the server advertises the LOGINDISABLED capability. 5101 Other capability names indicate that the server supports an 5102 extension, revision, or amendment to the IMAP4rev2 protocol. Server 5103 responses MUST conform to this document until the client issues a 5104 command that uses the associated capability. 5106 Capability names MUST either begin with "X" or be informational, 5107 experimental or standards-track IMAP4rev2 extensions, revisions, or 5108 amendments registered with IANA. A server SHOULD NOT offer 5109 unregistered or non-standard capability names, unless such names are 5110 prefixed with an "X". 5112 Client implementations SHOULD NOT require any capability name other 5113 than "IMAP4rev2", and MUST ignore any unknown capability names. 5115 A server MAY send capabilities automatically, by using the CAPABILITY 5116 response code in the initial PREAUTH or OK responses, and by sending 5117 an updated CAPABILITY response code in the tagged OK response as part 5118 of a successful authentication. It is unnecessary for a client to 5119 send a separate CAPABILITY command if it recognizes these automatic 5120 capabilities. 5122 Example: S: * CAPABILITY IMAP4rev2 STARTTLS AUTH=GSSAPI XPIG-LATIN 5124 7.2.3. LIST Response 5126 Contents: name attributes 5127 hierarchy delimiter 5128 name 5129 OPTIONAL extension data 5131 The LIST response occurs as a result of a LIST command. It returns a 5132 single name that matches the LIST specification. There can be 5133 multiple LIST responses for a single LIST command. 5135 The following base mailbox name attributes are defined: 5137 \NonExistent The "\NonExistent" attribute indicates that a mailbox 5138 name does not refer to an existing mailbox. Note that this 5139 attribute is not meaningful by itself, as mailbox names that match 5140 the canonical LIST pattern but don't exist must not be returned 5141 unless one of the two conditions listed below is also satisfied: 5143 1. The mailbox name also satisfies the selection criteria (for 5144 example, it is subscribed and the "SUBSCRIBED" selection 5145 option has been specified). 5147 2. "RECURSIVEMATCH" has been specified, and the mailbox name has 5148 at least one descendant mailbox name that does not match the 5149 LIST pattern and does match the selection criteria. 5151 In practice, this means that the "\NonExistent" attribute is 5152 usually returned with one or more of "\Subscribed", "\Remote", 5153 "\HasChildren", or the CHILDINFO extended data item. 5155 The "\NonExistent" attribute implies "\NoSelect". 5157 \Noinferiors It is not possible for any child levels of hierarchy to 5158 exist under this name; no child levels exist now and none can be 5159 created in the future. 5161 \Noselect It is not possible to use this name as a selectable 5162 mailbox. 5164 \HasChildren The presence of this attribute indicates that the 5165 mailbox has child mailboxes. A server SHOULD NOT set this 5166 attribute if there are child mailboxes and the user does not have 5167 permission to access any of them. In this case, \HasNoChildren 5168 SHOULD be used. In many cases, however, a server may not be able 5169 to efficiently compute whether a user has access to any child 5170 mailbox. Note that even though the \HasChildren attribute for a 5171 mailbox must be correct at the time of processing of the mailbox, 5172 a client must be prepared to deal with a situation when a mailbox 5173 is marked with the \HasChildren attribute, but no child mailbox 5174 appears in the response to the LIST command. This might happen, 5175 for example, due to children mailboxes being deleted or made 5176 inaccessible to the user (using access control) by another client 5177 before the server is able to list them. 5179 \HasNoChildren The presence of this attribute indicates that the 5180 mailbox has NO child mailboxes that are accessible to the 5181 currently authenticated user. 5183 \Marked The mailbox has been marked "interesting" by the server; the 5184 mailbox probably contains messages that have been added since the 5185 last time the mailbox was selected. 5187 \Unmarked The mailbox does not contain any additional messages since 5188 the last time the mailbox was selected. 5190 \Subscribed The mailbox name was subscribed to using the SUBSCRIBE 5191 command. 5193 \Remote The mailbox is a remote mailbox. 5195 It is an error for the server to return both a \HasChildren and a 5196 \HasNoChildren attribute in the same LIST response. A client that 5197 encounters a LIST response with both \HasChildren and \HasNoChildren 5198 attributes present should act as if both are absent in the LIST 5199 response. 5201 Note: the \HasNoChildren attribute should not be confused with the 5202 \NoInferiors attribute, which indicates that no child mailboxes 5203 exist now and none can be created in the future. 5205 If it is not feasible for the server to determine whether or not the 5206 mailbox is "interesting", the server SHOULD NOT send either \Marked 5207 or \Unmarked. The server MUST NOT send more than one of \Marked, 5208 \Unmarked, and \Noselect for a single mailbox, and MAY send none of 5209 these. 5211 In addition to the base mailbox name attributes defined above, an 5212 IMAP server MAY also include any or all of the following attributes 5213 that denote "role" (or "special-use") of a mailbox. These attributes 5214 are included along with base attributes defined above. A given 5215 mailbox may have none, one, or more than one of these attributes. In 5216 some cases, a special use is advice to a client about what to put in 5217 that mailbox. In other cases, it's advice to a client about what to 5218 expect to find there. 5220 \All This mailbox presents all messages in the user's message store. 5221 Implementations MAY omit some messages, such as, perhaps, those in 5222 \Trash and \Junk. When this special use is supported, it is 5223 almost certain to represent a virtual mailbox. 5225 \Archive This mailbox is used to archive messages. The meaning of 5226 an "archival" mailbox is server-dependent; typically, it will be 5227 used to get messages out of the inbox, or otherwise keep them out 5228 of the user's way, while still making them accessible. 5230 \Drafts This mailbox is used to hold draft messages -- typically, 5231 messages that are being composed but have not yet been sent. In 5232 some server implementations, this might be a virtual mailbox, 5233 containing messages from other mailboxes that are marked with the 5234 "\Draft" message flag. Alternatively, this might just be advice 5235 that a client put drafts here. 5237 \Flagged This mailbox presents all messages marked in some way as 5238 "important". When this special use is supported, it is likely to 5239 represent a virtual mailbox collecting messages (from other 5240 mailboxes) that are marked with the "\Flagged" message flag. 5242 \Junk This mailbox is where messages deemed to be junk mail are 5243 held. Some server implementations might put messages here 5244 automatically. Alternatively, this might just be advice to a 5245 client-side spam filter. 5247 \Sent This mailbox is used to hold copies of messages that have been 5248 sent. Some server implementations might put messages here 5249 automatically. Alternatively, this might just be advice that a 5250 client save sent messages here. 5252 \Trash This mailbox is used to hold messages that have been deleted 5253 or marked for deletion. In some server implementations, this 5254 might be a virtual mailbox, containing messages from other 5255 mailboxes that are marked with the "\Deleted" message flag. 5256 Alternatively, this might just be advice that a client that 5257 chooses not to use the IMAP "\Deleted" model should use this as 5258 its trash location. In server implementations that strictly 5259 expect the IMAP "\Deleted" model, this special use is likely not 5260 to be supported. 5262 All of special-use attributes are OPTIONAL, and any given server or 5263 message store may support any combination of the attributes, or none 5264 at all. In most cases, there will likely be at most one mailbox with 5265 a given attribute for a given user, but in some server or message 5266 store implementations it might be possible for multiple mailboxes to 5267 have the same special-use attribute. 5269 Special-use attributes are likely to be user-specific. User Adam 5270 might share his \Sent mailbox with user Barb, but that mailbox is 5271 unlikely to also serve as Barb's \Sent mailbox. 5273 Other mailbox name attributes can be found in the "IMAP Mailbox Name 5274 Attributes" registry [IMAP-MAILBOX-NAME-ATTRS-REG]. 5276 The hierarchy delimiter is a character used to delimit levels of 5277 hierarchy in a mailbox name. A client can use it to create child 5278 mailboxes, and to search higher or lower levels of naming hierarchy. 5279 All children of a top-level hierarchy node MUST use the same 5280 separator character. A NIL hierarchy delimiter means that no 5281 hierarchy exists; the name is a "flat" name. 5283 The name represents an unambiguous left-to-right hierarchy, and MUST 5284 be valid for use as a reference in LIST command. Unless \Noselect or 5285 \NonExistent is indicated, the name MUST also be valid as an argument 5286 for commands, such as SELECT, that accept mailbox names. 5288 The name might be followed by an OPTIONAL series of extended fields, 5289 a parenthesized list of tagged data (also referred to as "extended 5290 data item"). The first element of an extended field is a string, 5291 which identifies the type of data. [RFC5258] specified requirements 5292 on string registration (which are called "tags" there; such tags are 5293 not to be confused with IMAP command tags), in particular it said 5294 that "Tags MUST be registered with IANA". This document doesn't 5295 change that. See Section 9.5 of [RFC5258] for the registration 5296 template. The server MAY return data in the extended fields that was 5297 not directly solicited by the client in the corresponding LIST 5298 command. For example, the client can enable extra extended fields by 5299 using another IMAP extension that make use of the extended LIST 5300 responses. The client MUST ignore all extended fields it doesn't 5301 recognize. 5303 Example: S: * LIST (\Noselect) "/" ~/Mail/foo 5305 Example: S: * LIST (\Marked) ":" Tables (tablecloth (("edge" "lacy") 5306 ("color" "red")) Sample "text") 5307 S: * LIST () ":" Tables:new (tablecloth ("edge" "lacy") 5308 Sample ("text" "more text")) 5310 7.2.4. NAMESPACE Response 5312 Contents: the prefix and hierarchy delimiter to the server's 5313 Personal Namespace(s), Other Users' Namespace(s), and 5314 Shared Namespace(s) 5316 The NAMESPACE response occurs as a result of a NAMESPACE command. It 5317 contains the prefix and hierarchy delimiter to the server's Personal 5318 Namespace(s), Other Users' Namespace(s), and Shared Namespace(s) that 5319 the server wishes to expose. The response will contain a NIL for any 5320 namespace class that is not available. Namespace-Response-Extensions 5321 ABNF non terminal is defined for extensibility and MAY be included in 5322 the response. 5324 Example: S: * NAMESPACE (("" "/")) (("~" "/")) NIL 5326 7.2.5. STATUS Response 5328 Contents: name 5329 status parenthesized list 5331 The STATUS response occurs as a result of an STATUS command. It 5332 returns the mailbox name that matches the STATUS specification and 5333 the requested mailbox status information. 5335 Example: S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292) 5337 7.2.6. ESEARCH Response 5339 Contents: one or more search-return-data pairs 5341 The ESEARCH response occurs as a result of a SEARCH or UID SEARCH 5342 command. 5344 The ESEARCH response starts with an optional search correlator. If 5345 it is missing, then the response was not caused by a particular IMAP 5346 command, whereas if it is present, it contains the tag of the command 5347 that caused the response to be returned. 5349 The search correlator is followed by an optional UID indicator. If 5350 this indicator is present, all data in the ESEARCH response refers to 5351 UIDs, otherwise all returned data refers to message numbers. 5353 The rest of the ESEARCH response contains one or more search data 5354 pairs. Each pair starts with unique return item name, followed by a 5355 space and the corresponding data. Search data pairs may be returned 5356 in any order. Unless specified otherwise by an extension, any return 5357 item name SHOULD appear only once in an ESEARCH response. 5359 [[TBD: describe the most common search data pairs returned.]] 5361 Example: S: * ESEARCH UID COUNT 5 ALL 4:19,21,28 5363 Example: S: * ESEARCH (TAG "a567") UID COUNT 5 ALL 4:19,21,28 5365 Example: S: * ESEARCH COUNT 5 ALL 1:17,21 5367 7.2.7. FLAGS Response 5369 Contents: flag parenthesized list 5371 The FLAGS response occurs as a result of a SELECT or EXAMINE command. 5372 The flag parenthesized list identifies the flags (at a minimum, the 5373 system-defined flags) that are applicable for this mailbox. Flags 5374 other than the system flags can also exist, depending on server 5375 implementation. 5377 The update from the FLAGS response MUST be recorded by the client. 5379 Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 5381 7.3. Server Responses - Mailbox Size 5383 These responses are always untagged. This is how changes in the size 5384 of the mailbox are transmitted from the server to the client. 5385 Immediately following the "*" token is a number that represents a 5386 message count. 5388 7.3.1. EXISTS Response 5390 Contents: none 5392 The EXISTS response reports the number of messages in the mailbox. 5393 This response occurs as a result of a SELECT or EXAMINE command, and 5394 if the size of the mailbox changes (e.g., new messages). 5396 The update from the EXISTS response MUST be recorded by the client. 5398 Example: S: * 23 EXISTS 5400 7.4. Server Responses - Message Status 5402 These responses are always untagged. This is how message data are 5403 transmitted from the server to the client, often as a result of a 5404 command with the same name. Immediately following the "*" token is a 5405 number that represents a message sequence number. 5407 7.4.1. EXPUNGE Response 5409 Contents: none 5411 The EXPUNGE response reports that the specified message sequence 5412 number has been permanently removed from the mailbox. The message 5413 sequence number for each successive message in the mailbox is 5414 immediately decremented by 1, and this decrement is reflected in 5415 message sequence numbers in subsequent responses (including other 5416 untagged EXPUNGE responses). 5418 The EXPUNGE response also decrements the number of messages in the 5419 mailbox; it is not necessary to send an EXISTS response with the new 5420 value. 5422 As a result of the immediate decrement rule, message sequence numbers 5423 that appear in a set of successive EXPUNGE responses depend upon 5424 whether the messages are removed starting from lower numbers to 5425 higher numbers, or from higher numbers to lower numbers. For 5426 example, if the last 5 messages in a 9-message mailbox are expunged, 5427 a "lower to higher" server will send five untagged EXPUNGE responses 5428 for message sequence number 5, whereas a "higher to lower server" 5429 will send successive untagged EXPUNGE responses for message sequence 5430 numbers 9, 8, 7, 6, and 5. 5432 An EXPUNGE response MUST NOT be sent when no command is in progress, 5433 nor while responding to a FETCH, STORE, or SEARCH command. This rule 5434 is necessary to prevent a loss of synchronization of message sequence 5435 numbers between client and server. A command is not "in progress" 5436 until the complete command has been received; in particular, a 5437 command is not "in progress" during the negotiation of command 5438 continuation. 5440 Note: UID FETCH, UID STORE, and UID SEARCH are different commands 5441 from FETCH, STORE, and SEARCH. An EXPUNGE response MAY be sent 5442 during a UID command. 5444 The update from the EXPUNGE response MUST be recorded by the client. 5446 Example: S: * 44 EXPUNGE 5448 7.4.2. FETCH Response 5450 Contents: message data 5452 The FETCH response returns data about a message to the client. The 5453 data are pairs of data item names and their values in parentheses. 5454 This response occurs as the result of a FETCH or STORE command, as 5455 well as by unilateral server decision (e.g., flag updates). 5457 The current data items are: 5459 BINARY[]<> 5461 An or expressing the content of the 5462 specified section after removing any Content-Transfer-Encoding- 5463 related encoding. If is present it refers to the 5464 offset within the DECODED section data. 5466 If the domain of the decoded data is "8bit" and the data does 5467 not contain the NUL octet, the server SHOULD return the data in 5468 a instead of a ; this allows the client to 5469 determine if the "8bit" data contains the NUL octet without 5470 having to explicitly scan the data stream for for NULs. 5472 Messaging clients and servers have been notoriously lax in 5473 their adherence to the Internet CRLF convention for terminating 5474 lines of textual data (text/* media types) in Internet 5475 protocols. When sending data in BINARY[...] FETCH data item, 5476 servers MUST ensure that textual line-oriented sections are 5477 always transmitted using the IMAP4 CRLF line termination 5478 syntax, regardless of the underlying storage representation of 5479 the data on the server. 5481 If the server does not know how to decode the section's 5482 Content-Transfer-Encoding, it MUST fail the request and issue a 5483 "NO" response that contains the "UNKNOWN-CTE" response code. 5485 BINARY.SIZE[] 5487 The size of the section after removing any Content-Transfer- 5488 Encoding-related encoding. The value returned MUST match the 5489 size of the or that will be returned by 5490 the corresponding FETCH BINARY request. 5492 If the server does not know how to decode the section's 5493 Content-Transfer-Encoding, it MUST fail the request and issue a 5494 "NO" response that contains the "UNKNOWN-CTE" response code. 5496 BODY A form of BODYSTRUCTURE without extension data. 5498 BODY[
]<> 5500 A string expressing the body contents of the specified section. 5501 The string SHOULD be interpreted by the client according to the 5502 content transfer encoding, body type, and subtype. 5504 If the origin octet is specified, this string is a substring of 5505 the entire body contents, starting at that origin octet. This 5506 means that BODY[]<0> MAY be truncated, but BODY[] is NEVER 5507 truncated. 5509 Note: The origin octet facility MUST NOT be used by a server 5510 in a FETCH response unless the client specifically requested 5511 it by means of a FETCH of a BODY[
]<> data 5512 item. 5514 8-bit textual data is permitted if a [CHARSET] identifier is 5515 part of the body parameter parenthesized list for this section. 5516 Note that headers (part specifiers HEADER or MIME, or the 5517 header portion of a MESSAGE/RFC822 or MESSAGE/GLOBAL part), MAY 5518 be in UTF-8. Note also that the [RFC-5322] delimiting blank 5519 line between the header and the body is not affected by header 5520 line subsetting; the blank line is always included as part of 5521 header data, except in the case of a message which has no body 5522 and no blank line. 5524 Non-textual data such as binary data MUST be transfer encoded 5525 into a textual form, such as BASE64, prior to being sent to the 5526 client. To derive the original binary data, the client MUST 5527 decode the transfer encoded string. 5529 BODYSTRUCTURE 5531 A parenthesized list that describes the [MIME-IMB] body 5532 structure of a message. This is computed by the server by 5533 parsing the [MIME-IMB] header fields, defaulting various fields 5534 as necessary. 5536 For example, a simple text message of 48 lines and 2279 octets 5537 can have a body structure of: ("TEXT" "PLAIN" ("CHARSET" "US- 5538 ASCII") NIL NIL "7BIT" 2279 48) 5540 Multiple parts are indicated by parenthesis nesting. Instead 5541 of a body type as the first element of the parenthesized list, 5542 there is a sequence of one or more nested body structures. The 5543 second element of the parenthesized list is the multipart 5544 subtype (mixed, digest, parallel, alternative, etc.). 5546 For example, a two part message consisting of a text and a 5547 BASE64-encoded text attachment can have a body structure of: 5548 (("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1152 5549 23)("TEXT" "PLAIN" ("CHARSET" "US-ASCII" "NAME" "cc.diff") 5550 "<960723163407.20117h@cac.washington.edu>" "Compiler diff" 5551 "BASE64" 4554 73) "MIXED") 5553 Extension data follows the multipart subtype. Extension data 5554 is never returned with the BODY fetch, but can be returned with 5555 a BODYSTRUCTURE fetch. Extension data, if present, MUST be in 5556 the defined order. The extension data of a multipart body part 5557 are in the following order: 5559 body parameter parenthesized list A parenthesized list of 5560 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 5561 "bar" is the value of "foo", and "rag" is the value of 5562 "baz"] as defined in [MIME-IMB]. Servers SHOULD decode 5563 parameter value continuations and parameter value character 5564 sets as described in [RFC2231], for example, if the message 5565 contains parameters "baz*0", "baz*1" and "baz*2", the server 5566 should RFC2231-decode them, concatenate and return the 5567 resulting value as a parameter "baz". Similarly, if the 5568 message contains parameters "foo*0*" and "foo*1*", the 5569 server should RFC2231-decode them, convert to UTF-8, 5570 concatenate and return the resulting value as a parameter 5571 "foo*". 5573 body disposition A parenthesized list, consisting of a 5574 disposition type string, followed by a parenthesized list of 5575 disposition attribute/value pairs as defined in 5576 [DISPOSITION]. Servers SHOULD decode parameter value 5577 continuations as described in [RFC2231]. 5579 body language A string or parenthesized list giving the body 5580 language value as defined in [LANGUAGE-TAGS]. 5582 body location A string giving the body content URI as defined 5583 in [LOCATION]. 5585 Any following extension data are not yet defined in this 5586 version of the protocol. Such extension data can consist of 5587 zero or more NILs, strings, numbers, or potentially nested 5588 parenthesized lists of such data. Client implementations that 5589 do a BODYSTRUCTURE fetch MUST be prepared to accept such 5590 extension data. Server implementations MUST NOT send such 5591 extension data until it has been defined by a revision of this 5592 protocol. 5594 The basic fields of a non-multipart body part are in the 5595 following order: 5597 body type A string giving the content media type name as 5598 defined in [MIME-IMB]. 5600 body subtype A string giving the content subtype name as 5601 defined in [MIME-IMB]. 5603 body parameter parenthesized list A parenthesized list of 5604 attribute/value pairs [e.g., ("foo" "bar" "baz" "rag") where 5605 "bar" is the value of "foo" and "rag" is the value of "baz"] 5606 as defined in [MIME-IMB]. 5608 body id A string giving the Content-ID header field value as 5609 defined in Section 7 of [MIME-IMB]. 5611 body description A string giving the Content-Description 5612 header field value as defined in Section 8 of [MIME-IMB]. 5614 body encoding A string giving the content transfer encoding as 5615 defined in Section 6 of [MIME-IMB]. 5617 body size A number giving the size of the body in octets. 5618 Note that this size is the size in its transfer encoding and 5619 not the resulting size after any decoding. 5621 A body type of type MESSAGE and subtype RFC822 contains, 5622 immediately after the basic fields, the envelope structure, 5623 body structure, and size in text lines of the encapsulated 5624 message. 5626 A body type of type TEXT contains, immediately after the basic 5627 fields, the size of the body in text lines. Note that this 5628 size is the size in its content transfer encoding and not the 5629 resulting size after any decoding. 5631 Extension data follows the basic fields and the type-specific 5632 fields listed above. Extension data is never returned with the 5633 BODY fetch, but can be returned with a BODYSTRUCTURE fetch. 5634 Extension data, if present, MUST be in the defined order. 5636 The extension data of a non-multipart body part are in the 5637 following order: 5639 body MD5 A string giving the body MD5 value as defined in 5640 [MD5]. 5642 body disposition A parenthesized list with the same content 5643 and function as the body disposition for a multipart body 5644 part. 5646 body language A string or parenthesized list giving the body 5647 language value as defined in [LANGUAGE-TAGS]. 5649 body location A string giving the body content URI as defined 5650 in [LOCATION]. 5652 Any following extension data are not yet defined in this 5653 version of the protocol, and would be as described above under 5654 multipart extension data. 5656 ENVELOPE 5658 A parenthesized list that describes the envelope structure of a 5659 message. This is computed by the server by parsing the 5660 [RFC-5322] header into the component parts, defaulting various 5661 fields as necessary. 5663 The fields of the envelope structure are in the following 5664 order: date, subject, from, sender, reply-to, to, cc, bcc, in- 5665 reply-to, and message-id. The date, subject, in-reply-to, and 5666 message-id fields are strings. The from, sender, reply-to, to, 5667 cc, and bcc fields are parenthesized lists of address 5668 structures. 5670 An address structure is a parenthesized list that describes an 5671 electronic mail address. The fields of an address structure 5672 are in the following order: personal name, [SMTP] at-domain- 5673 list (source route, obs-route), mailbox name, and host name. 5675 [RFC-5322] group syntax is indicated by a special form of 5676 address structure in which the host name field is NIL. If the 5677 mailbox name field is also NIL, this is an end of group marker 5678 (semi-colon in RFC 822 syntax). If the mailbox name field is 5679 non-NIL, this is a start of group marker, and the mailbox name 5680 field holds the group name phrase. 5682 If the Date, Subject, In-Reply-To, and Message-ID header lines 5683 are absent in the [RFC-5322] header, the corresponding member 5684 of the envelope is NIL; if these header lines are present but 5685 empty the corresponding member of the envelope is the empty 5686 string. 5688 Note: some servers may return a NIL envelope member in the 5689 "present but empty" case. Clients SHOULD treat NIL and 5690 empty string as identical. 5692 Note: [RFC-5322] requires that all messages have a valid 5693 Date header. Therefore, for a well-formed message the date 5694 member in the envelope can not be NIL or the empty string. 5695 However it can be NIL for a malformed or a draft message. 5697 Note: [RFC-5322] requires that the In-Reply-To and Message- 5698 ID headers, if present, have non-empty content. Therefore, 5699 for a well-formed message the in-reply-to and message-id 5700 members in the envelope can not be the empty string. 5701 However they can still be the empty string for a malformed 5702 message. 5704 If the From, To, Cc, and Bcc header lines are absent in the 5705 [RFC-5322] header, or are present but empty, the corresponding 5706 member of the envelope is NIL. 5708 If the Sender or Reply-To lines are absent in the [RFC-5322] 5709 header, or are present but empty, the server sets the 5710 corresponding member of the envelope to be the same value as 5711 the from member (the client is not expected to know to do 5712 this). 5714 Note: [RFC-5322] requires that all messages have a valid 5715 From header. Therefore, for a well-formed message the from, 5716 sender, and reply-to members in the envelope can not be NIL. 5717 However they can be NIL for a malformed or a draft message. 5719 FLAGS A parenthesized list of flags that are set for this message. 5721 INTERNALDATE A string representing the internal date of the message. 5723 RFC822.SIZE A number expressing the [RFC-5322] size of the message. 5725 UID A number expressing the unique identifier of the message. 5727 If the server chooses to send unsolicited FETCH responses, they MUST 5728 include UID FETCH item. Note that this is a new requirement when 5729 compared to RFC 3501. 5731 Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827) 5733 7.5. Server Responses - Command Continuation Request 5735 The command continuation request response is indicated by a "+" token 5736 instead of a tag. This form of response indicates that the server is 5737 ready to accept the continuation of a command from the client. The 5738 remainder of this response is a line of text. 5740 This response is used in the AUTHENTICATE command to transmit server 5741 data to the client, and request additional client data. This 5742 response is also used if an argument to any command is a 5743 synchronizing literal. 5745 The client is not permitted to send the octets of the synchronizing 5746 literal unless the server indicates that it is expected. This 5747 permits the server to process commands and reject errors on a line- 5748 by-line basis. The remainder of the command, including the CRLF that 5749 terminates a command, follows the octets of the literal. If there 5750 are any additional command arguments, the literal octets are followed 5751 by a space and those arguments. 5753 Example: C: A001 LOGIN {11} 5754 S: + Ready for additional command text 5755 C: FRED FOOBAR {7} 5756 S: + Ready for additional command text 5757 C: fat man 5758 S: A001 OK LOGIN completed 5759 C: A044 BLURDYBLOOP {102856} 5760 S: A044 BAD No such command as "BLURDYBLOOP" 5762 8. Sample IMAP4rev2 connection 5764 The following is a transcript of an IMAP4rev2 connection. A long 5765 line in this sample is broken for editorial clarity. 5767 S: * OK IMAP4rev2 Service Ready 5768 C: a001 login mrc secret 5769 S: a001 OK LOGIN completed 5770 C: a002 select inbox 5771 S: * 18 EXISTS 5772 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 5773 S: * OK [UIDVALIDITY 3857529045] UIDs valid 5774 S: * LIST () "/" INBOX ("OLDNAME" ("inbox")) 5775 S: a002 OK [READ-WRITE] SELECT completed 5776 C: a003 fetch 12 full 5777 S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" 5778 RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" 5779 "IMAP4rev2 WG mtg summary and minutes" 5780 (("Terry Gray" NIL "gray" "cac.washington.edu")) 5781 (("Terry Gray" NIL "gray" "cac.washington.edu")) 5782 (("Terry Gray" NIL "gray" "cac.washington.edu")) 5783 ((NIL NIL "imap" "cac.washington.edu")) 5784 ((NIL NIL "minutes" "CNRI.Reston.VA.US") 5785 ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL 5786 "") 5787 BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 5788 92)) 5789 S: a003 OK FETCH completed 5790 C: a004 fetch 12 body[header] 5791 S: * 12 FETCH (BODY[HEADER] {342} 5792 S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT) 5793 S: From: Terry Gray 5794 S: Subject: IMAP4rev2 WG mtg summary and minutes 5795 S: To: imap@cac.washington.edu 5796 S: cc: minutes@CNRI.Reston.VA.US, John Klensin 5797 S: Message-Id: 5798 S: MIME-Version: 1.0 5799 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII 5800 S: 5801 S: ) 5802 S: a004 OK FETCH completed 5803 C: a005 store 12 +flags \deleted 5804 S: * 12 FETCH (FLAGS (\Seen \Deleted)) 5805 S: a005 OK +FLAGS completed 5806 C: a006 logout 5807 S: * BYE IMAP4rev2 server terminating connection 5808 S: a006 OK LOGOUT completed 5810 9. Formal Syntax 5812 The following syntax specification uses the Augmented Backus-Naur 5813 Form (ABNF) notation as specified in [ABNF]. 5815 In the case of alternative or optional rules in which a later rule 5816 overlaps an earlier rule, the rule which is listed earlier MUST take 5817 priority. For example, "\Seen" when parsed as a flag is the \Seen 5818 flag name and not a flag-extension, even though "\Seen" can be parsed 5819 as a flag-extension. Some, but not all, instances of this rule are 5820 noted below. 5822 Note: [ABNF] rules MUST be followed strictly; in particular: 5824 (1) Except as noted otherwise, all alphabetic characters are case- 5825 insensitive. The use of upper or lower case characters to define 5826 token strings is for editorial clarity only. Implementations MUST 5827 accept these strings in a case-insensitive fashion. 5829 (2) In all cases, SP refers to exactly one space. It is NOT 5830 permitted to substitute TAB, insert additional spaces, or 5831 otherwise treat SP as being equivalent to LWSP. 5833 (3) The ASCII NUL character, %x00, MUST NOT be used at any time. 5835 address = "(" addr-name SP addr-adl SP addr-mailbox SP 5836 addr-host ")" 5838 addr-adl = nstring 5839 ; Holds route from [RFC-5322] obs-route if 5840 ; non-NIL 5842 addr-host = nstring 5843 ; NIL indicates [RFC-5322] group syntax. 5844 ; Otherwise, holds [RFC-5322] domain name 5846 addr-mailbox = nstring 5847 ; NIL indicates end of [RFC-5322] group; if 5848 ; non-NIL and addr-host is NIL, holds 5849 ; [RFC-5322] group name. 5850 ; Otherwise, holds [RFC-5322] local-part 5851 ; after removing [RFC-5322] quoting 5853 addr-name = nstring 5854 ; If non-NIL, holds phrase from [RFC-5322] 5855 ; mailbox after removing [RFC-5322] quoting 5857 append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP 5858 literal 5860 append-uid = uniqueid 5862 astring = 1*ASTRING-CHAR / string 5863 ASTRING-CHAR = ATOM-CHAR / resp-specials 5865 atom = 1*ATOM-CHAR 5867 ATOM-CHAR = 5869 atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / 5870 quoted-specials / resp-specials 5872 authenticate = "AUTHENTICATE" SP auth-type [SP initial-resp] 5873 *(CRLF base64) 5875 auth-type = atom 5876 ; Defined by [SASL] 5878 base64 = *(4base64-char) [base64-terminal] 5880 base64-char = ALPHA / DIGIT / "+" / "/" 5881 ; Case-sensitive 5883 base64-terminal = (2base64-char "==") / (3base64-char "=") 5885 body = "(" (body-type-1part / body-type-mpart) ")" 5887 body-extension = nstring / number / number64 / 5888 "(" body-extension *(SP body-extension) ")" 5889 ; Future expansion. Client implementations 5890 ; MUST accept body-extension fields. Server 5891 ; implementations MUST NOT generate 5892 ; body-extension fields except as defined by 5893 ; future standard or standards-track 5894 ; revisions of this specification. 5896 body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang 5897 [SP body-fld-loc *(SP body-extension)]]] 5898 ; MUST NOT be returned on non-extensible 5899 ; "BODY" fetch 5901 body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang 5902 [SP body-fld-loc *(SP body-extension)]]] 5903 ; MUST NOT be returned on non-extensible 5904 ; "BODY" fetch 5906 body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP 5907 body-fld-enc SP body-fld-octets 5909 body-fld-desc = nstring 5910 body-fld-dsp = "(" string SP body-fld-param ")" / nil 5912 body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ 5913 "QUOTED-PRINTABLE") DQUOTE) / string 5914 ; Content-Transfer-Encoding header field value. 5915 ; Defaults to "7BIT" (as per RFC 2045) 5916 ; if not present in the body part. 5918 body-fld-id = nstring 5920 body-fld-lang = nstring / "(" string *(SP string) ")" 5922 body-fld-loc = nstring 5924 body-fld-lines = number64 5926 body-fld-md5 = nstring 5928 body-fld-octets = number 5930 body-fld-param = "(" string SP string *(SP string SP string) ")" / nil 5932 body-type-1part = (body-type-basic / body-type-msg / body-type-text) 5933 [SP body-ext-1part] 5935 body-type-basic = media-basic SP body-fields 5936 ; MESSAGE subtype MUST NOT be "RFC822" or "GLOBAL" 5938 body-type-mpart = 1*body SP media-subtype 5939 [SP body-ext-mpart] 5940 ; MULTIPART body part 5942 body-type-msg = media-message SP body-fields SP envelope 5943 SP body SP body-fld-lines 5945 body-type-text = media-text SP body-fields SP body-fld-lines 5947 capability = ("AUTH=" auth-type) / atom 5948 ; New capabilities MUST begin with "X" or be 5949 ; registered with IANA in 5950 ; a standards-track, an experimental 5951 ; or an informational RFC. 5953 capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev2" 5954 *(SP capability) 5955 ; Servers MUST implement the STARTTLS, AUTH=PLAIN, 5956 ; and LOGINDISABLED capabilities. 5957 ; Servers which offer RFC 1730 compatibility MUST 5958 ; list "IMAP4" as the first capability. 5959 ; Servers which offer RFC 3501 compatibility MUST 5960 ; list "IMAP4rev1" as one of capabilities. 5962 CHAR = 5964 CHAR8 = %x01-ff 5965 ; any OCTET except NUL, %x00 5967 charset = atom / quoted 5969 childinfo-extended-item = "CHILDINFO" SP "(" 5970 list-select-base-opt-quoted 5971 *(SP list-select-base-opt-quoted) ")" 5972 ; Extended data item (mbox-list-extended-item) 5973 ; returned when the RECURSIVEMATCH 5974 ; selection option is specified. 5975 ; Note 1: the CHILDINFO extended data item tag can be 5976 ; returned with and without surrounding quotes, as per 5977 ; mbox-list-extended-item-tag production. 5978 ; Note 2: The selection options are always returned 5979 ; quoted, unlike their specification in 5980 ; the extended LIST command. 5982 child-mbox-flag = "\HasChildren" / "\HasNoChildren" 5983 ; attributes for CHILDREN return option, at most one 5984 ; possible per LIST response 5986 command = tag SP (command-any / command-auth / command-nonauth / 5987 command-select) CRLF 5988 ; Modal based on state 5990 command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / enable / x-command 5991 ; Valid in all states 5993 command-auth = append / create / delete / examine / list / 5994 Namespace-Command / 5995 rename / select / status / subscribe / unsubscribe / 5996 idle 5997 ; Valid only in Authenticated or Selected state 5999 command-nonauth = login / authenticate / "STARTTLS" 6000 ; Valid only when in Not Authenticated state 6002 command-select = "CLOSE" / "UNSELECT" / "EXPUNGE" / copy / 6003 move / fetch / store / search / uid 6004 ; Valid only when in Selected state 6006 continue-req = "+" SP (resp-text / base64) CRLF 6008 copy = "COPY" SP sequence-set SP mailbox 6010 create = "CREATE" SP mailbox 6011 ; Use of INBOX gives a NO error 6013 date = date-text / DQUOTE date-text DQUOTE 6015 date-day = 1*2DIGIT 6016 ; Day of month 6018 date-day-fixed = (SP DIGIT) / 2DIGIT 6019 ; Fixed-format version of date-day 6021 date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / 6022 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" 6024 date-text = date-day "-" date-month "-" date-year 6026 date-year = 4DIGIT 6028 date-time = DQUOTE date-day-fixed "-" date-month "-" date-year 6029 SP time SP zone DQUOTE 6031 delete = "DELETE" SP mailbox 6032 ; Use of INBOX gives a NO error 6034 digit-nz = %x31-39 6035 ; 1-9 6037 eitem-standard-tag = atom 6038 ; a tag for LIST extended data item defined in a Standard 6039 ; Track or Experimental RFC. 6041 eitem-vendor-tag = vendor-token "-" atom 6042 ; a vendor-specific tag for LIST extended data item 6044 enable = "ENABLE" 1*(SP capability) 6046 enable-data = "ENABLED" *(SP capability) 6048 envelope = "(" env-date SP env-subject SP env-from SP 6049 env-sender SP env-reply-to SP env-to SP env-cc SP 6050 env-bcc SP env-in-reply-to SP env-message-id ")" 6052 env-bcc = "(" 1*address ")" / nil 6053 env-cc = "(" 1*address ")" / nil 6055 env-date = nstring 6057 env-from = "(" 1*address ")" / nil 6059 env-in-reply-to = nstring 6061 env-message-id = nstring 6063 env-reply-to = "(" 1*address ")" / nil 6065 env-sender = "(" 1*address ")" / nil 6067 env-subject = nstring 6069 env-to = "(" 1*address ")" / nil 6071 esearch-response = "ESEARCH" [search-correlator] [SP "UID"] 6072 *(SP search-return-data) 6073 ; ESEARCH response replaces SEARCH response 6074 ; from IMAP4rev1. 6076 examine = "EXAMINE" SP mailbox 6078 fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" / 6079 fetch-att / "(" fetch-att *(SP fetch-att) ")") 6081 fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" / 6082 "RFC822.SIZE" / 6083 "BODY" ["STRUCTURE"] / "UID" / 6084 "BODY" section [partial] / 6085 "BODY.PEEK" section [partial] / 6086 "BINARY" [".PEEK"] section-binary [partial] / 6087 "BINARY.SIZE" section-binary 6089 flag = "\Answered" / "\Flagged" / "\Deleted" / 6090 "\Seen" / "\Draft" / flag-keyword / flag-extension 6091 ; Does not include "\Recent" 6093 flag-extension = "\" atom 6094 ; Future expansion. Client implementations 6095 ; MUST accept flag-extension flags. Server 6096 ; implementations MUST NOT generate 6097 ; flag-extension flags except as defined by 6098 ; future standard or standards-track 6099 ; revisions of this specification. 6100 ; "\Recent" was defined in RFC 3501 6101 ; and is now deprecated. 6103 flag-fetch = flag 6105 flag-keyword = "$MDNSent" / "$Forwarded" / "$Junk" / 6106 "$NotJunk" / "$Phishing" / atom 6108 flag-list = "(" [flag *(SP flag)] ")" 6110 flag-perm = flag / "\*" 6112 greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF 6114 header-fld-name = astring 6116 header-list = "(" header-fld-name *(SP header-fld-name) ")" 6118 idle = "IDLE" CRLF "DONE" 6120 initial-resp = (base64 / "=") 6121 ; "initial response" defined in 6122 ; Section 5.1 of [RFC4422] 6124 list = "LIST" [SP list-select-opts] SP mailbox SP mbox-or-pat 6125 [SP list-return-opts] 6127 list-mailbox = 1*list-char / string 6129 list-char = ATOM-CHAR / list-wildcards / resp-specials 6131 list-return-opts = "RETURN" SP 6132 "(" [return-option *(SP return-option)] ")" 6133 ; list return options, e.g., CHILDREN 6135 list-select-base-opt = "SUBSCRIBED" / option-extension 6136 ; options that can be used by themselves 6138 list-select-base-opt-quoted = DQUOTE list-select-base-opt DQUOTE 6140 list-select-independent-opt = "REMOTE" / option-extension 6141 ; options that do not syntactically interact with 6142 ; other options 6144 list-select-mod-opt = "RECURSIVEMATCH" / option-extension 6145 ; options that require a list-select-base-opt 6146 ; to also be present 6148 list-select-opt = list-select-base-opt / list-select-independent-opt 6149 / list-select-mod-opt 6150 ; An option registration template is described in 6151 ; Section 9.3 of this document. 6153 list-select-opts = "(" [ 6154 (*(list-select-opt SP) list-select-base-opt 6155 *(SP list-select-opt)) 6156 / (list-select-independent-opt 6157 *(SP list-select-independent-opt)) 6158 ] ")" 6159 ; Any number of options may be in any order. 6160 ; If a list-select-mod-opt appears, then a 6161 ; list-select-base-opt must also appear. 6162 ; This allows these: 6163 ; () 6164 ; (REMOTE) 6165 ; (SUBSCRIBED) 6166 ; (SUBSCRIBED REMOTE) 6167 ; (SUBSCRIBED RECURSIVEMATCH) 6168 ; (SUBSCRIBED REMOTE RECURSIVEMATCH) 6169 ; But does NOT allow these: 6170 ; (RECURSIVEMATCH) 6171 ; (REMOTE RECURSIVEMATCH) 6173 list-wildcards = "%" / "*" 6175 literal = "{" number64 ["+"] "}" CRLF *CHAR8 6176 ; represents the number of CHAR8s. 6177 ; A non-synchronizing literal is distinguished from 6178 ; a synchronizing literal by presence of the "+" 6179 ; before the closing "}". 6180 ; Non synchronizing literals are not allowed when 6181 ; sent from server to the client. 6183 literal8 = "~{" number64 "}" CRLF *OCTET 6184 ; represents the number of OCTETs 6185 ; in the response string. 6187 login = "LOGIN" SP userid SP password 6189 mailbox = "INBOX" / astring 6190 ; INBOX is case-insensitive. All case variants of 6191 ; INBOX (e.g., "iNbOx") MUST be interpreted as INBOX 6192 ; not as an astring. An astring which consists of 6193 ; the case-insensitive sequence "I" "N" "B" "O" "X" 6194 ; is considered to be INBOX and not an astring. 6195 ; Refer to section 5.1 for further 6196 ; semantic details of mailbox names. 6198 mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list / 6199 esearch-response / 6200 "STATUS" SP mailbox SP "(" [status-att-list] ")" / 6201 number SP "EXISTS" / Namespace-Response 6203 mailbox-list = "(" [mbx-list-flags] ")" SP 6204 (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox 6205 [SP mbox-list-extended] 6206 ; This is the list information pointed to by the ABNF 6207 ; item "mailbox-data", which is defined in [IMAP4] 6209 mbox-list-extended = "(" [mbox-list-extended-item 6210 *(SP mbox-list-extended-item)] ")" 6212 mbox-list-extended-item = mbox-list-extended-item-tag SP 6213 tagged-ext-val 6215 mbox-list-extended-item-tag = astring 6216 ; The content MUST conform to either "eitem-vendor-tag" 6217 ; or "eitem-standard-tag" ABNF productions. 6219 mbox-or-pat = list-mailbox / patterns 6221 mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag 6222 *(SP mbx-list-oflag) / 6223 mbx-list-oflag *(SP mbx-list-oflag) 6225 mbx-list-oflag = "\Noinferiors" / child-mbox-flag / 6226 "\Subscribed" / "\Remote" / flag-extension 6227 ; Other flags; multiple possible per LIST response 6229 mbx-list-sflag = "\NonExistent" / "\Noselect" / "\Marked" / "\Unmarked" 6230 ; Selectability flags; only one per LIST response 6232 media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / 6233 "FONT" / "MESSAGE" / "MODEL" / "VIDEO" ) DQUOTE) 6234 / string) 6235 SP media-subtype 6236 ; Defined in [MIME-IMT]. 6237 ; FONT defined in RFC 8081. 6239 media-message = DQUOTE "MESSAGE" DQUOTE SP 6240 DQUOTE ("RFC822" / "GLOBAL") DQUOTE 6241 ; Defined in [MIME-IMT] 6243 media-subtype = string 6244 ; Defined in [MIME-IMT] 6246 media-text = DQUOTE "TEXT" DQUOTE SP media-subtype 6247 ; Defined in [MIME-IMT] 6249 message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) 6251 move = "MOVE" SP sequence-set SP mailbox 6253 msg-att = "(" (msg-att-dynamic / msg-att-static) 6254 *(SP (msg-att-dynamic / msg-att-static)) ")" 6256 msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")" 6257 ; MAY change for a message 6259 msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time / 6260 "RFC822.SIZE" SP number64 / 6261 "BODY" ["STRUCTURE"] SP body / 6262 "BODY" section ["<" number ">"] SP nstring / 6263 "BINARY" section-binary SP (nstring / literal8) / 6264 "BINARY.SIZE" section-binary SP number / 6265 "UID" SP uniqueid 6266 ; MUST NOT change for a message 6268 name-component = 1*UTF8-CHAR 6269 ; MUST NOT contain ".", "/", "%", or "*" 6271 Namespace = nil / "(" 1*Namespace-Descr ")" 6273 Namespace-Command = "NAMESPACE" 6275 Namespace-Descr = "(" string SP 6276 (DQUOTE QUOTED-CHAR DQUOTE / nil) 6277 [Namespace-Response-Extensions] ")" 6279 Namespace-Response-Extensions = *Namespace-Response-Extension 6281 Namespace-Response-Extension = SP string SP 6282 "(" string *(SP string) ")" 6284 Namespace-Response = "NAMESPACE" SP Namespace 6285 SP Namespace SP Namespace 6286 ; The first Namespace is the Personal Namespace(s). 6287 ; The second Namespace is the Other Users' 6288 ; Namespace(s). 6289 ; The third Namespace is the Shared Namespace(s). 6291 nil = "NIL" 6292 nstring = string / nil 6294 number = 1*DIGIT 6295 ; Unsigned 32-bit integer 6296 ; (0 <= n < 4,294,967,296) 6298 number64 = 1*DIGIT 6299 ; Unsigned 63-bit integer 6300 ; (0 <= n <= 9,223,372,036,854,775,807) 6302 nz-number = digit-nz *DIGIT 6303 ; Non-zero unsigned 32-bit integer 6304 ; (0 < n < 4,294,967,296) 6306 nz-number64 = digit-nz *DIGIT 6307 ; Unsigned 63-bit integer 6308 ; (0 < n <= 9,223,372,036,854,775,807) 6310 oldname-extended-item = "OLDNAME" SP "(" mailbox ")" 6311 ; Extended data item (mbox-list-extended-item) 6312 ; returned in a LIST response when a mailbox is 6313 ; renamed or deleted. Also returned when 6314 ; the server canonicalized the provided mailbox 6315 ; name. 6316 ; Note 1: the OLDNAME tag can be returned 6317 ; with or without surrounding quotes, as per 6318 ; mbox-list-extended-item-tag production. 6320 option-extension = (option-standard-tag / option-vendor-tag) 6321 [SP option-value] 6323 option-standard-tag = atom 6324 ; an option defined in a Standards Track or 6325 ; Experimental RFC 6327 option-val-comp = astring / 6328 option-val-comp *(SP option-val-comp) / 6329 "(" option-val-comp ")" 6331 option-value = "(" option-val-comp ")" 6333 option-vendor-tag = vendor-token "-" atom 6334 ; a vendor-specific option, non-standard 6336 partial-range = number64 ["." nz-number64] 6337 ; Copied from RFC 5092 (IMAP URL) 6338 ; and updated to support 64bit sizes. 6340 partial = "<" number64 "." nz-number64 ">" 6341 ; Partial FETCH request. 0-based offset of 6342 ; the first octet, followed by the number of octets 6343 ; in the fragment. 6345 password = astring 6347 patterns = "(" list-mailbox ")" 6348 ; [RFC5258] supports multiple patterns, 6349 ; but this document only requires one 6350 ; to be supported. 6351 ; If the server is also implementing 6352 ; [RFC5258], "patterns" syntax from that 6353 ; document must be followed. 6355 quoted = DQUOTE *QUOTED-CHAR DQUOTE 6357 QUOTED-CHAR = / 6358 "\" quoted-specials / UTF8-2 / UTF8-3 / UTF8-4 6360 quoted-specials = DQUOTE / "\" 6362 rename = "RENAME" SP mailbox SP mailbox 6363 ; Use of INBOX as a destination gives a NO error 6365 response = *(continue-req / response-data) response-done 6367 response-data = "*" SP (resp-cond-state / resp-cond-bye / 6368 mailbox-data / message-data / capability-data / 6369 enable-data) CRLF 6371 response-done = response-tagged / response-fatal 6373 response-fatal = "*" SP resp-cond-bye CRLF 6374 ; Server closes connection immediately 6376 response-tagged = tag SP resp-cond-state CRLF 6378 resp-code-apnd = "APPENDUID" SP nz-number SP append-uid 6380 resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set 6382 resp-cond-auth = ("OK" / "PREAUTH") SP resp-text 6383 ; Authentication condition 6385 resp-cond-bye = "BYE" SP resp-text 6387 resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text 6388 ; Status condition 6390 resp-specials = "]" 6392 resp-text = ["[" resp-text-code "]" SP] [text] 6394 resp-text-code = "ALERT" / 6395 "BADCHARSET" [SP "(" charset *(SP charset) ")" ] / 6396 capability-data / "PARSE" / 6397 "PERMANENTFLAGS" SP 6398 "(" [flag-perm *(SP flag-perm)] ")" / 6399 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / 6400 "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number / 6401 resp-code-apnd / resp-code-copy / "UIDNOTSTICKY" / 6402 "UNAVAILABLE" / "AUTHENTICATIONFAILED" / 6403 "AUTHORIZATIONFAILED" / "EXPIRED" / 6404 "PRIVACYREQUIRED" / "CONTACTADMIN" / "NOPERM" / 6405 "INUSE" / "EXPUNGEISSUED" / "CORRUPTION" / 6406 "SERVERBUG" / "CLIENTBUG" / "CANNOT" / 6407 "LIMIT" / "OVERQUOTA" / "ALREADYEXISTS" / 6408 "NONEXISTENT" / "NOTSAVED" / "HASCHILDREN" / 6409 "CLOSED" / 6410 "UNKNOWN-CTE" / 6411 atom [SP 1*] 6413 return-option = "SUBSCRIBED" / "CHILDREN" / status-option / 6414 option-extension 6416 search = "SEARCH" [search-return-opts] 6417 SP search-program 6419 search-correlator = SP "(" "TAG" SP tag-string ")" 6421 search-key = "ALL" / "ANSWERED" / "BCC" SP astring / 6422 "BEFORE" SP date / "BODY" SP astring / 6423 "CC" SP astring / "DELETED" / "FLAGGED" / 6424 "FROM" SP astring / "KEYWORD" SP flag-keyword / 6425 "ON" SP date / "SEEN" / 6426 "SINCE" SP date / "SUBJECT" SP astring / 6427 "TEXT" SP astring / "TO" SP astring / 6428 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" / 6429 "UNKEYWORD" SP flag-keyword / "UNSEEN" / 6430 ; Above this line were in [IMAP2] 6431 "DRAFT" / "HEADER" SP header-fld-name SP astring / 6432 "LARGER" SP number64 / "NOT" SP search-key / 6433 "OR" SP search-key SP search-key / 6434 "SENTBEFORE" SP date / "SENTON" SP date / 6435 "SENTSINCE" SP date / "SMALLER" SP number64 / 6436 "UID" SP sequence-set / "UNDRAFT" / sequence-set / 6437 "(" search-key *(SP search-key) ")" 6439 search-modifier-name = tagged-ext-label 6441 search-mod-params = tagged-ext-val 6442 ; This non-terminal shows recommended syntax 6443 ; for future extensions. 6445 search-program = ["CHARSET" SP charset SP] 6446 search-key *(SP search-key) 6447 ; CHARSET argument to SEARCH MUST be 6448 ; registered with IANA. 6450 search-ret-data-ext = search-modifier-name SP search-return-value 6451 ; Note that not every SEARCH return option 6452 ; is required to have the corresponding 6453 ; ESEARCH return data. 6455 search-return-data = "MIN" SP nz-number / 6456 "MAX" SP nz-number / 6457 "ALL" SP sequence-set / 6458 "COUNT" SP number / 6459 search-ret-data-ext 6460 ; All return data items conform to 6461 ; search-ret-data-ext syntax. 6462 ; Note that "$" marker is not allowed 6463 ; after the ALL return data item. 6465 search-return-opts = SP "RETURN" SP "(" [search-return-opt 6466 *(SP search-return-opt)] ")" 6468 search-return-opt = "MIN" / "MAX" / "ALL" / "COUNT" / 6469 "SAVE" / 6470 search-ret-opt-ext 6471 ; conforms to generic search-ret-opt-ext 6472 ; syntax 6474 search-ret-opt-ext = search-modifier-name [SP search-mod-params] 6476 search-return-value = tagged-ext-val 6477 ; Data for the returned search option. 6478 ; A single "nz-number"/"number"/"number64" value 6479 ; can be returned as an atom (i.e., without 6480 ; quoting). A sequence-set can be returned 6481 ; as an atom as well. 6483 section = "[" [section-spec] "]" 6484 section-binary = "[" [section-part] "]" 6486 section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list / 6487 "TEXT" 6488 ; top-level or MESSAGE/RFC822 or MESSAGE/GLOBAL part 6490 section-part = nz-number *("." nz-number) 6491 ; body part reference. 6492 ; Allows for accessing nested body parts. 6494 section-spec = section-msgtext / (section-part ["." section-text]) 6496 section-text = section-msgtext / "MIME" 6497 ; text other than actual body part (headers, etc.) 6499 select = "SELECT" SP mailbox 6501 seq-number = nz-number / "*" 6502 ; message sequence number (COPY, FETCH, STORE 6503 ; commands) or unique identifier (UID COPY, 6504 ; UID FETCH, UID STORE commands). 6505 ; * represents the largest number in use. In 6506 ; the case of message sequence numbers, it is 6507 ; the number of messages in a non-empty mailbox. 6508 ; In the case of unique identifiers, it is the 6509 ; unique identifier of the last message in the 6510 ; mailbox or, if the mailbox is empty, the 6511 ; mailbox's current UIDNEXT value. 6512 ; The server should respond with a tagged BAD 6513 ; response to a command that uses a message 6514 ; sequence number greater than the number of 6515 ; messages in the selected mailbox. This 6516 ; includes "*" if the selected mailbox is empty. 6518 seq-range = seq-number ":" seq-number 6519 ; two seq-number values and all values between 6520 ; these two regardless of order. 6521 ; Example: 2:4 and 4:2 are equivalent and indicate 6522 ; values 2, 3, and 4. 6523 ; Example: a unique identifier sequence range of 6524 ; 3291:* includes the UID of the last message in 6525 ; the mailbox, even if that value is less than 3291. 6527 sequence-set = (seq-number / seq-range) ["," sequence-set] 6528 ; set of seq-number values, regardless of order. 6529 ; Servers MAY coalesce overlaps and/or execute the 6530 ; sequence in any order. 6531 ; Example: a message sequence number set of 6532 ; 2,4:7,9,12:* for a mailbox with 15 messages is 6533 ; equivalent to 2,4,5,6,7,9,12,13,14,15 6534 ; Example: a message sequence number set of *:4,5:7 6535 ; for a mailbox with 10 messages is equivalent to 6536 ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and 6537 ; overlap coalesced to be 4,5,6,7,8,9,10. 6539 sequence-set =/ seq-last-command 6540 ; Allow for "result of the last command" indicator. 6542 seq-last-command = "$" 6544 status = "STATUS" SP mailbox SP 6545 "(" status-att *(SP status-att) ")" 6547 status-att = "MESSAGES" / "UIDNEXT" / "UIDVALIDITY" / 6548 "UNSEEN" / "DELETED" / "SIZE" 6550 status-att-val = ("MESSAGES" SP number) / 6551 ("UIDNEXT" SP nz-number) / 6552 ("UIDVALIDITY" SP nz-number) / 6553 ("UNSEEN" SP number) / 6554 ("DELETED" SP number) / 6555 ("SIZE" SP number64) 6556 ; Extensions to the STATUS responses 6557 ; should extend this production. 6558 ; Extensions should use the generic 6559 ; syntax defined by tagged-ext. 6561 status-att-list = status-att-val *(SP status-att-val) 6563 status-option = "STATUS" SP "(" status-att *(SP status-att) ")" 6564 ; This ABNF production complies with 6565 ; syntax. 6567 store = "STORE" SP sequence-set SP store-att-flags 6569 store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP 6570 (flag-list / (flag *(SP flag))) 6572 string = quoted / literal 6574 subscribe = "SUBSCRIBE" SP mailbox 6576 tag = 1* 6578 tag-string = astring 6579 ; represented as 6581 tagged-ext-label = tagged-label-fchar *tagged-label-char 6582 ; Is a valid RFC 3501 "atom". 6584 tagged-label-fchar = ALPHA / "-" / "_" / "." 6586 tagged-label-char = tagged-label-fchar / DIGIT / ":" 6588 tagged-ext-comp = astring / 6589 tagged-ext-comp *(SP tagged-ext-comp) / 6590 "(" tagged-ext-comp ")" 6591 ; Extensions that follow this general 6592 ; syntax should use nstring instead of 6593 ; astring when appropriate in the context 6594 ; of the extension. 6595 ; Note that a message set or a "number" 6596 ; can always be represented as an "atom". 6597 ; An URL should be represented as 6598 ; a "quoted" string. 6600 tagged-ext-simple = sequence-set / number / number64 6602 tagged-ext-val = tagged-ext-simple / 6603 "(" [tagged-ext-comp] ")" 6605 text = 1*(TEXT-CHAR / UTF8-2 / UTF8-3 / UTF8-4) 6606 ; Non ASCII text can only be returned 6607 ; after ENABLE IMAP4rev2 command 6609 TEXT-CHAR = 6611 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 6612 ; Hours minutes seconds 6614 uid = "UID" SP 6615 (copy / move / fetch / search / store / uid-expunge) 6616 ; Unique identifiers used instead of message 6617 ; sequence numbers 6619 uid-expunge = "EXPUNGE" SP sequence-set 6620 ; Unique identifiers used instead of message 6621 ; sequence numbers 6623 uid-set = (uniqueid / uid-range) *("," uid-set) 6625 uid-range = (uniqueid ":" uniqueid) 6626 ; two uniqueid values and all values 6627 ; between these two regards of order. 6628 ; Example: 2:4 and 4:2 are equivalent. 6630 uniqueid = nz-number 6631 ; Strictly ascending 6633 unsubscribe = "UNSUBSCRIBE" SP mailbox 6635 userid = astring 6637 UTF8-2 = 6639 UTF8-3 = 6641 UTF8-4 = 6643 vendor-token = "vendor." name-component 6644 ; Definition copied from RFC 2244. 6645 ; MUST be registered with IANA 6647 x-command = "X" atom 6649 zone = ("+" / "-") 4DIGIT 6650 ; Signed four-digit value of hhmm representing 6651 ; hours and minutes east of Greenwich (that is, 6652 ; the amount that the given time differs from 6653 ; Universal Time). Subtracting the timezone 6654 ; from the given time will give the UT form. 6655 ; The Universal Time zone is "+0000". 6657 10. Author's Note 6659 This document is a revision or rewrite of earlier documents, and 6660 supercedes the protocol specification in those documents: RFC 3501, 6661 RFC 2060, RFC 1730, unpublished IMAP2bis.TXT document, RFC 1176, and 6662 RFC 1064. 6664 11. Security Considerations 6666 IMAP4rev2 protocol transactions, including electronic mail data, are 6667 sent in the clear over the network unless protection from snooping is 6668 negotiated. This can be accomplished either by the use of IMAPS 6669 service, STARTTLS command, negotiated privacy protection in the 6670 AUTHENTICATE command, or some other protection mechanism. 6672 11.1. STARTTLS Security Considerations 6674 IMAP client and server implementations MUST comply with relevant TLS 6675 recommendations from [RFC8314]. 6677 Clients and servers MUST implement TLS 1.2 [TLS-1.2] or newer. Use 6678 of TLS 1.3 [TLS-1.3] is RECOMMENDED. TLS 1.2 may be used only in 6679 cases where the other party has not yet implemented TLS 1.3. 6680 Additionally, when using TLS 1.2, IMAP implementations MUST implement 6681 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite, and SHOULD 6682 implement the TLS_RSA_WITH_AES_128_CBC_SHA [TLS-1.2] cipher suite. 6683 This is important as it assures that any two compliant 6684 implementations can be configured to interoperate. Other TLS cipher 6685 suites recommended in RFC 7525 are RECOMMENDED: 6686 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 6687 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 and 6688 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384. All other cipher suites are 6689 OPTIONAL. Note that this is a change from section 2.1 of [IMAP-TLS]. 6691 The list of mandatory-to-implement TLS 1.3 cipher suites is described 6692 in Section 9.1 of [TLS-1.3]. 6694 During the TLS negotiation [TLS-1.3][TLS-1.2], the client MUST check 6695 its understanding of the server hostname against the server's 6696 identity as presented in the server Certificate message, in order to 6697 prevent man-in-the-middle attacks. This procedure is described in 6698 [RFC7817]. 6700 Both the client and server MUST check the result of the STARTTLS 6701 command and subsequent TLS ([TLS-1.3][TLS-1.2]) negotiation to see 6702 whether acceptable authentication and/or privacy was achieved. 6704 11.2. COPYUID and APPENDUID response codes 6706 The COPYUID and APPENDUID response codes return information about the 6707 mailbox, which may be considered sensitive if the mailbox has 6708 permissions set that permit the client to COPY or APPEND to the 6709 mailbox, but not SELECT or EXAMINE it. 6711 Consequently, these response codes SHOULD NOT be issued if the client 6712 does not have access to SELECT or EXAMINE the mailbox. 6714 11.3. LIST command and Other Users' namespace 6716 In response to a LIST command containing an argument of the Other 6717 Users' Namespace prefix, a server SHOULD NOT list users that have not 6718 granted list access to their personal mailboxes to the currently 6719 authenticated user. Providing such a list, could compromise security 6720 by potentially disclosing confidential information of who is located 6721 on the server, or providing a starting point of a list of user 6722 accounts to attack. 6724 11.4. Other Security Considerations 6726 A server error message for an AUTHENTICATE command which fails due to 6727 invalid credentials SHOULD NOT detail why the credentials are 6728 invalid. 6730 Use of the LOGIN command sends passwords in the clear. This can be 6731 avoided by using the AUTHENTICATE command with a [SASL] mechanism 6732 that does not use plaintext passwords, by first negotiating 6733 encryption via STARTTLS or some other protection mechanism. 6735 A server implementation MUST implement a configuration that, at the 6736 time of authentication, requires: 6737 (1) The STARTTLS command has been negotiated. 6738 OR 6739 (2) Some other mechanism that protects the session from password 6740 snooping has been provided. 6741 OR 6742 (3) The following measures are in place: 6743 (a) The LOGINDISABLED capability is advertised, and [SASL] mechanisms 6744 (such as PLAIN) using plaintext passwords are NOT advertised in the 6745 CAPABILITY list. 6746 AND 6747 (b) The LOGIN command returns an error even if the password is 6748 correct. 6749 AND 6750 (c) The AUTHENTICATE command returns an error with all [SASL] 6751 mechanisms that use plaintext passwords, even if the password is 6752 correct. 6754 A server error message for a failing LOGIN command SHOULD NOT specify 6755 that the user name, as opposed to the password, is invalid. 6757 A server SHOULD have mechanisms in place to limit or delay failed 6758 AUTHENTICATE/LOGIN attempts. 6760 Additional security considerations are discussed in the section 6761 discussing the AUTHENTICATE (see Section 6.2.2) and LOGIN (see 6762 Section 6.2.3) commands. 6764 12. IANA Considerations 6766 IANA is requested to update "Service Names and Transport Protocol 6767 Port Numbers" registry as follows: 6769 1. Registration for TCP port 143 and the corresponding "imap" 6770 service name should be updated to point to this document and RFC 6771 3501. 6773 2. Registration for TCP port 993 and the corresponding "imaps" 6774 service name should be updated to point to this document, RFC 6775 8314 and RFC 3501. 6777 3. Both UDP port 143 and UDP port 993 should be marked as "Reserved" 6778 in the registry. 6780 Additional IANA actions are specified in subsection of this section. 6782 12.1. Updates to IMAP4 Capabilities registry 6784 IMAP4 capabilities are registered by publishing a standards track or 6785 IESG approved informational or experimental RFC. The registry is 6786 currently located at: https://www.iana.org/assignments/ 6787 imap4-capabilities 6789 As this specification revises the AUTH= prefix, STARTTLS and 6790 LOGINDISABLED extensions, IANA is requested to update registry 6791 entries for these 3 extensions to point to this document. 6793 12.2. GSSAPI/SASL service name 6795 GSSAPI/Kerberos/SASL service names are registered by publishing a 6796 standards track or IESG approved experimental RFC. The registry is 6797 currently located at: https://www.iana.org/assignments/gssapi- 6798 service-names 6800 IANA is requested to update the "imap" service name previously 6801 registered in RFC 3501, to point to this document. 6803 12.3. LIST Selection Options, LIST Return Options, LIST extended data 6804 items 6806 [RFC5258] specifies IANA registration procedures for LIST Selection 6807 Options, LIST Return Options, LIST extended data items. This 6808 document doesn't change these registration procedures. In particular 6809 LIST selection options Section 6.3.9.1 and LIST return options 6810 Section 6.3.9.2 are registered using the procedure specified in 6811 Section 9 of [RFC5258] (and using the registration template from 6812 Section 9.3 of [RFC5258]). LIST Extended Data Items are registered 6813 using the registration template from Section 9.6 of [RFC5258]). 6815 IANA is requested to add a reference to [RFCXXXX] for the "OLDNAME" 6816 LIST-EXTENDED extended data item entry. This is in addition to the 6817 existing reference to [RFC5465]. 6819 13. References 6821 13.1. Normative References 6823 [RFC5258] Leiba, B. and A. Melnikov, "Internet Message Access 6824 Protocol version 4 - LIST Command Extensions", RFC 5258, 6825 DOI 10.17487/RFC5258, June 2008, 6826 . 6828 [RFC5788] Melnikov, A. and D. Cridland, "IMAP4 Keyword Registry", 6829 RFC 5788, DOI 10.17487/RFC5788, March 2010, 6830 . 6832 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 6833 Specifications: ABNF", STD 68, RFC 5234, January 2008, 6834 . 6836 [ANONYMOUS] 6837 Zeilenga, K., "Anonymous Simple Authentication and 6838 Security Layer (SASL) Mechanism", RFC 4505, June 2006, 6839 . 6841 [CHARSET] Freed, N. and J. Postel, "IANA Charset Registration 6842 Procedures", BCP 19, RFC 2978, October 2000, 6843 . 6845 [SCRAM-SHA-256] 6846 Hansen, T., "SCRAM-SHA-256 and SCRAM-SHA-256-PLUS Simple 6847 Authentication and Security Layer (SASL) Mechanisms", 6848 RFC 7677, DOI 10.17487/RFC7677, November 2015, 6849 . 6851 [DISPOSITION] 6852 Troost, R., Dorner, S., and K. Moore, Ed., "Communicating 6853 Presentation Information in Internet Messages: The 6854 Content-Disposition Header Field", RFC 2183, August 1997, 6855 . 6857 [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 6858 Security Layer (SASL) Mechanism", RFC 4616, August 2006, 6859 . 6861 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6862 Requirement Levels", BCP 14, RFC 2119, 6863 DOI 10.17487/RFC2119, March 1997, 6864 . 6866 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 6867 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 6868 May 2017, . 6870 [LANGUAGE-TAGS] 6871 Alvestrand, H., "Content Language Headers", RFC 3282, May 6872 2002, . 6874 [LOCATION] 6875 Palme, J., Hopmann, A., and N. Shelness, "MIME 6876 Encapsulation of Aggregate Documents, such as HTML 6877 (MHTML)", RFC 2557, March 1999, 6878 . 6880 [MD5] Myers, J. and M. Rose, "The Content-MD5 Header Field", 6881 RFC 1864, October 1995, 6882 . 6884 [MIME-HDRS] 6885 Moore, K., "MIME (Multipurpose Internet Mail Extensions) 6886 Part Three: Message Header Extensions for Non-ASCII Text", 6887 RFC 2047, November 1996, 6888 . 6890 [MIME-IMB] 6891 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 6892 Extensions (MIME) Part One: Format of Internet Message 6893 Bodies", RFC 2045, November 1996, 6894 . 6896 [MIME-IMT] 6897 Freed, N. and N. Borenstein, "Multipurpose Internet Mail 6898 Extensions (MIME) Part Two: Media Types", RFC 2046, 6899 November 1996, . 6901 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 6902 Word Extensions: Character Sets, Languages, and 6903 Continuations", RFC 2231, DOI 10.17487/RFC2231, November 6904 1997, . 6906 [RFC-5322] 6907 Resnick, P., Ed., "Internet Message Format", RFC 5322, 6908 October 2008, . 6910 [SASL] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 6911 Authentication and Security Layer (SASL)", RFC 4422, June 6912 2006, . 6914 [TLS-1.2] Dierks, T. and E. Rescorla, "The Transport Layer Security 6915 (TLS) Protocol Version 1.2", RFC 5246, August 2008, 6916 . 6918 [TLS-1.3] Rescorla, E., "The Transport Layer Security (TLS) Protocol 6919 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 6920 . 6922 [UTF-7] Goldsmith, D. and M. Davis, "UTF-7 A Mail-Safe 6923 Transformation Format of Unicode", RFC 2152, May 1997, 6924 . 6926 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 6927 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 6928 2003, . 6930 [MULTIAPPEND] 6931 Crispin, M., "Internet Message Access Protocol (IMAP) - 6932 MULTIAPPEND Extension", RFC 3502, March 2003, 6933 . 6935 [NET-UNICODE] 6936 Klensin, J. and M. Padlipsky, "Unicode Format for Network 6937 Interchange", RFC 5198, DOI 10.17487/RFC5198, March 2008, 6938 . 6940 [I18N-HDRS] 6941 Yang, A., Steele, S., and N. Freed, "Internationalized 6942 Email Headers", RFC 6532, DOI 10.17487/RFC6532, February 6943 2012, . 6945 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6946 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 6947 . 6949 [RFC7817] Melnikov, A., "Updated Transport Layer Security (TLS) 6950 Server Identity Check Procedure for Email-Related 6951 Protocols", RFC 7817, DOI 10.17487/RFC7817, March 2016, 6952 . 6954 [RFC8098] Hansen, T., Ed. and A. Melnikov, Ed., "Message Disposition 6955 Notification", STD 85, RFC 8098, DOI 10.17487/RFC8098, 6956 February 2017, . 6958 [RFC8314] Moore, K. and C. Newman, "Cleartext Considered Obsolete: 6959 Use of Transport Layer Security (TLS) for Email Submission 6960 and Access", RFC 8314, DOI 10.17487/RFC8314, January 2018, 6961 . 6963 [IMAP-IMPLEMENTATION] 6964 Leiba, B., "IMAP4 Implementation Recommendations", 6965 RFC 2683, September 1999, 6966 . 6968 [IMAP-MULTIACCESS] 6969 Gahrns, M., "IMAP4 Multi-Accessed Mailbox Practice", 6970 RFC 2180, July 1997, 6971 . 6973 13.2. Informative References (related protocols) 6975 [RFC3503] Melnikov, A., "Message Disposition Notification (MDN) 6976 profile for Internet Message Access Protocol (IMAP)", 6977 RFC 3503, DOI 10.17487/RFC3503, March 2003, 6978 . 6980 [RFC5256] Crispin, M. and K. Murchison, "Internet Message Access 6981 Protocol - SORT and THREAD Extensions", RFC 5256, 6982 DOI 10.17487/RFC5256, June 2008, 6983 . 6985 [RFC2193] Gahrns, M., "IMAP4 Mailbox Referrals", RFC 2193, 6986 DOI 10.17487/RFC2193, September 1997, 6987 . 6989 [RFC3348] Gahrns, M. and R. Cheng, "The Internet Message Action 6990 Protocol (IMAP4) Child Mailbox Extension", RFC 3348, 6991 DOI 10.17487/RFC3348, July 2002, 6992 . 6994 [RFC5465] Gulbrandsen, A., King, C., and A. Melnikov, "The IMAP 6995 NOTIFY Extension", RFC 5465, DOI 10.17487/RFC5465, 6996 February 2009, . 6998 [RFC7888] Melnikov, A., Ed., "IMAP4 Non-synchronizing Literals", 6999 RFC 7888, DOI 10.17487/RFC7888, May 2016, 7000 . 7002 [IMAP-DISC] 7003 Melnikov, A., Ed., "Synchronization Operations for 7004 Disconnected IMAP4 Clients", RFC 4549, June 2006, 7005 . 7007 [IMAP-I18N] 7008 Newman, C., Gulbrandsen, A., and A. Melnikov, "Internet 7009 Message Access Protocol Internationalization", RFC 5255, 7010 DOI 10.17487/RFC5255, June 2008, 7011 . 7013 [IMAP-MODEL] 7014 Crispin, M., "Distributed Electronic Mail Models in 7015 IMAP4", RFC 1733, December 1994, 7016 . 7018 [IMAP-UTF-8] 7019 Resnick, P., Ed., Newman, C., Ed., and S. Shen, Ed., "IMAP 7020 Support for UTF-8", RFC 6855, DOI 10.17487/RFC6855, March 7021 2013, . 7023 [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 7024 October 2008, . 7026 [RFC3516] Nerenberg, L., "IMAP4 Binary Content Extension", RFC 3516, 7027 DOI 10.17487/RFC3516, April 2003, 7028 . 7030 [RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", 7031 RFC 4314, December 2005, 7032 . 7034 [RFC2087] Myers, J., "IMAP4 QUOTA extension", RFC 2087, January 7035 1997, . 7037 [IMAP-URL] 7038 Melnikov, A., Ed. and C. Newman, "IMAP URL Scheme", 7039 RFC 5092, DOI 10.17487/RFC5092, November 2007, 7040 . 7042 [IMAP-KEYWORDS-REG] 7043 IANA, "IMAP and JMAP Keywords", December 2009, 7044 . 7047 [IMAP-MAILBOX-NAME-ATTRS-REG] 7048 IANA, "IMAP Mailbox Name Attributes", June 2018, 7049 . 7052 [CHARSET-REG] 7053 IANA, "Character Set Registrations", May 2015, 7054 . 7057 13.3. Informative References (historical aspects of IMAP and related 7058 protocols) 7060 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 7061 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, 7062 . 7064 [IMAP-COMPAT] 7065 Crispin, M., "IMAP4 Compatibility with IMAP2bis", 7066 RFC 2061, December 1996, 7067 . 7069 [IMAP-HISTORICAL] 7070 Crispin, M., "IMAP4 Compatibility with IMAP2 and 7071 IMAP2bis", RFC 1732, December 1994, 7072 . 7074 [IMAP-OBSOLETE] 7075 Crispin, M., "Internet Message Access Protocol - Obsolete 7076 Syntax", RFC 2062, December 1996, 7077 . 7079 [IMAP2] Crispin, M., "Interactive Mail Access Protocol: Version 7080 2", RFC 1176, August 1990, 7081 . 7083 [RFC-822] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 7084 TEXT MESSAGES", STD 11, RFC 822, August 1982, 7085 . 7087 [IMAP-TLS] 7088 Newman, C., "Using TLS with IMAP, POP3 and ACAP", 7089 RFC 2595, June 1999, 7090 . 7092 Appendix A. Backward compatibility with IMAP4rev1 7094 An implementation that wants to remain compatible with IMAP4rev1 can 7095 advertise both IMAP4rev1 and IMAP4rev2 in its CAPABILITY response/ 7096 response code. While some IMAP4rev1 responses were removed in 7097 IMAP4rev2, their presence will not break IMAP4rev2-only clients. 7099 If both IMAP4rev1 and IMAP4rev2 are advertised, an IMAP client that 7100 wants to use IMAP4rev2 MUST issue an "ENABLE IMAP4rev2" command. 7102 Servers advertising both IMAP4rev1 and IMAP4rev2 MUST NOT generate 7103 UTF-8 quoted strings unless the client has issued "ENABLE IMAP4rev2". 7104 Consider implementation of mechanisms described or referenced in 7105 [IMAP-UTF-8] to achieve this goal. 7107 Servers advertising both IMAP4rev1 and IMAP4rev2, and clients 7108 intending to be compatible with IMAP4rev1 servers MUST be compatible 7109 with the international mailbox naming convention described in the 7110 following subsection. 7112 Also see Appendix D for special considerations for servers that 7113 support 63 bit body part/message sizes and want to advertise support 7114 for both IMAP4rev1 and IMAP4rev2. 7116 A.1. Mailbox International Naming Convention for compatibility with 7117 IMAP4rev1 7119 Support for the Mailbox International Naming Convention described in 7120 this section is not required for IMAP4rev2-only clients and servers. 7121 It is only used for backward compatibility with IMAP4rev1 7122 implementations. 7124 By convention, international mailbox names in IMAP4rev1 are specified 7125 using a modified version of the UTF-7 encoding described in [UTF-7]. 7126 Modified UTF-7 may also be usable in servers that implement an 7127 earlier version of this protocol. 7129 In modified UTF-7, printable US-ASCII characters, except for "&", 7130 represent themselves; that is, characters with octet values 0x20-0x25 7131 and 0x27-0x7e. The character "&" (0x26) is represented by the two- 7132 octet sequence "&-". 7134 All other characters (octet values 0x00-0x1f and 0x7f-0xff) are 7135 represented in modified BASE64, with a further modification from 7136 [UTF-7] that "," is used instead of "/". Modified BASE64 MUST NOT be 7137 used to represent any printing US-ASCII character which can represent 7138 itself. Only characters inside the modified BASE64 alphabet are 7139 permitted in modified BASE64 text. 7141 "&" is used to shift to modified BASE64 and "-" to shift back to US- 7142 ASCII. There is no implicit shift from BASE64 to US-ASCII, and null 7143 shifts ("-&" while in BASE64; note that "&-" while in US-ASCII means 7144 "&") are not permitted. However, all names start in US-ASCII, and 7145 MUST end in US-ASCII; that is, a name that ends with a non-ASCII 7146 ISO-10646 character MUST end with a "-"). 7148 The purpose of these modifications is to correct the following 7149 problems with UTF-7: 7151 1. UTF-7 uses the "+" character for shifting; this conflicts with 7152 the common use of "+" in mailbox names, in particular USENET 7153 newsgroup names. 7155 2. UTF-7's encoding is BASE64 which uses the "/" character; this 7156 conflicts with the use of "/" as a popular hierarchy delimiter. 7158 3. UTF-7 prohibits the unencoded usage of "\"; this conflicts with 7159 the use of "\" as a popular hierarchy delimiter. 7161 4. UTF-7 prohibits the unencoded usage of "~"; this conflicts with 7162 the use of "~" in some servers as a home directory indicator. 7164 5. UTF-7 permits multiple alternate forms to represent the same 7165 string; in particular, printable US-ASCII characters can be 7166 represented in encoded form. 7168 Although modified UTF-7 is a convention, it establishes certain 7169 requirements on server handling of any mailbox name with an embedded 7170 "&" character. In particular, server implementations MUST preserve 7171 the exact form of the modified BASE64 portion of a modified UTF-7 7172 name and treat that text as case-sensitive, even if names are 7173 otherwise case-insensitive or case-folded. 7175 Server implementations SHOULD verify that any mailbox name with an 7176 embedded "&" character, used as an argument to CREATE, is: in the 7177 correctly modified UTF-7 syntax, has no superfluous shifts, and has 7178 no encoding in modified BASE64 of any printing US-ASCII character 7179 which can represent itself. However, client implementations MUST NOT 7180 depend upon the server doing this, and SHOULD NOT attempt to create a 7181 mailbox name with an embedded "&" character unless it complies with 7182 the modified UTF-7 syntax. 7184 Server implementations which export a mail store that does not follow 7185 the modified UTF-7 convention MUST convert to modified UTF-7 any 7186 mailbox name that contains either non-ASCII characters or the "&" 7187 character. 7189 For example, here is a mailbox name which mixes English, Chinese, 7190 and Japanese text: ~peter/mail/&U,BTFw-/&ZeVnLIqe- 7192 For example, the string "&Jjo!" is not a valid mailbox name 7193 because it does not contain a shift to US-ASCII before the "!". 7194 The correct form is "&Jjo-!". The string "&U,BTFw-&ZeVnLIqe-" is 7195 not permitted because it contains a superfluous shift. The 7196 correct form is "&U,BTF2XlZyyKng-". 7198 Appendix B. Backward compatibility with BINARY extension 7200 IMAP4rev2 incorporates subset of functionality provided by the BINARY 7201 extension [RFC3516], in particular it includes additional FETCH items 7202 (BINARY, BINARY.PEEK and BINARY.SIZE), but not extensions to the 7203 APPEND command. IMAP4rev2 implementations that supports full RFC 7204 3516 functionality need to also advertise the BINARY capability in 7205 the CAPABILITY response/response code. 7207 Appendix C. Backward compatibility with LIST-EXTENDED extension 7209 IMAP4rev2 incorporates most of functionality provided by the LIST- 7210 EXTENDED extension [RFC5258]. In particular, multiple mailbox 7211 patterns syntax is not supported in IMAP4rev2, unless LIST-EXTENDED 7212 capability is also advertised in the CAPABILITY response/response 7213 code. 7215 Appendix D. 63 bit body part and message sizes 7217 IMAP4rev2 increases allowed body part and message sizes that servers 7218 can support from 32 to 63 bits. Server implementations don't have to 7219 support 63 bit long body parts/message sizes, however client 7220 implementations have to expect them. 7222 As IMAP4rev1 didn't support 63 bit long body part/message sizes, 7223 there is an interoperability issue exposed by 63 bit capable servers 7224 that are accessible by both IMAP4rev1 and IMAP4rev2 email clients. 7225 As IMAP4rev1 would be unable to retrieve full content of messages 7226 bigger than 4Gb, it is RECOMMENDED that such servers hide messages 7227 bigger than 4Gb from IMAP4rev1 clients. 7229 For example, image that a mailbox has 3 messages with UIDs 1, 17, 21. 7230 These messages have the following sizes (respectively): 32Kb, 5Gb, 7231 60Mb. When such mailbox is accessed by an IMAP4rev2 client that 7232 issued "ENABLE IMAP4rev2", it will see all 3 messages. When such 7233 mailbox is accessed by an IMAP4rev1 client, it will only see messages 7234 with UIDs 1 and 21. 7236 Appendix E. Changes from RFC 3501 / IMAP4rev1 7238 Below is the summary of changes since RFC 3501: 7240 1. Support for 64bit message and body part sizes. 7242 2. Folded in IMAP NAMESPACE (RFC 2342), UNSELECT (RFC 3691), 7243 UIDPLUS (RFC 4315), ESEARCH (RFC 4731), SEARCHRES (RFC 5182), 7244 ENABLE (RFC 5161), IDLE (RFC 2177), SASL-IR (RFC 4959), LIST- 7245 EXTENDED (RFC 5258), LIST-STATUS (RFC 5819), MOVE (RFC 6851) and 7246 LITERAL- (RFC 7888) extensions. Also folded RFC 4466 (IMAP ABNF 7247 extensions), RFC 5530 (response codes), the FETCH side of the 7248 BINARY extension (RFC 3516) and the list of new mailbox 7249 attributes from SPECIAL-USE (RFC 6154). 7251 3. Added STATUS SIZE (RFC 8438) and STATUS DELETED. 7253 4. SEARCH command now requires to return ESEARCH response (SEARCH 7254 response is now deprecated). 7256 5. Clarified which SEARCH keys has to use substring match and which 7257 don't. 7259 6. Clarified that server should decode parameter value 7260 continuations as described in [RFC2231]. This requirement was 7261 hidden in RFC 2231 itself. 7263 7. Added CLOSED response code from RFC 7162. SELECT/EXAMINE when a 7264 mailbox is already selected now require for the CLOSED response 7265 code to be returned. 7267 8. SELECT/EXAMINE are now required to return untagged LIST 7268 response. 7270 9. UNSEEN response code on SELECT/EXAMINE is now deprecated. 7272 10. RECENT response on SELECT/EXAMINE, \Recent flag, RECENT STATUS, 7273 SEARCH NEW items are now deprecated. 7275 11. Clarified that the server doesn't need to send a new 7276 PERMANENTFLAGS response code when a new keyword was successfully 7277 added and the server advertised \* earlier for the same mailbox. 7279 12. For future extensibility extended ABNF for tagged-ext-simple to 7280 allow for bare number64. 7282 13. Added SHOULD level requirement on IMAP servers to support 7283 $MDNSent, $Forwarded, $Junk, $NonJunk and $Phishing keywords. 7285 14. Mailbox names and message headers now allow for UTF-8. Support 7286 for Modified UTF-7 in mailbox names is not required, unless 7287 compatibility with IMAP4rev1 is desired. 7289 15. Removed the CHECK command. Clients should use NOOP instead. 7291 16. RFC822, RFC822.HEADER and RFC822.TEXT FETCH data items were 7292 deprecated. Clients should use the corresponding BODY[] 7293 variants instead. 7295 17. LSUB command was deprecated. Clients should use LIST 7296 (SUBSCRIBED) instead. 7298 18. IDLE command can now return updates not related to the currently 7299 selected mailbox state. 7301 19. All unsolicited FETCH updates are required to include UID. 7303 20. Clarified that client implementations MUST ignore response codes 7304 that they do not recognize. (Change from a SHOULD to a MUST.) 7306 21. resp-text ABNF non terminal was updated to allow for empty text. 7308 22. After ENABLE IMAP4rev2 human readable response text can include 7309 non ASCII encoded in UTF-8. 7311 23. Updated to use modern TLS-related recommendations as per RFC 7312 8314, RFC 7817, RFC 7525. 7314 24. Replaced DIGEST-MD5 SASL mechanism with SCRAM-SHA-256. DIGEST- 7315 MD5 was deprecated. 7317 Appendix F. Other Recommended IMAP Extensions 7319 Support for the following extensions is recommended for all IMAP 7320 client and servers. Why they significantly reduce bandwidth and/or 7321 number of round trips used by IMAP in certain situations, the EXTRA 7322 WG decided that requiring them as a part of IMAP4rev2 would push the 7323 bar to implement too high for new implementations. Also note that 7324 absence of any IMAP extension from this list doesn't make it somehow 7325 deficient or not recommended for use with IMAP4rev2. 7327 1. QRESYNC and CONDSTORE extensions (RFC 7162). They make 7328 discovering changes to IMAP mailboxes more efficient, at the 7329 expense of storing a bit more state. 7331 2. OBJECTID extension (RFC 8474) helps with preserving IMAP client 7332 cache when messages moved/copied or mailboxes are renamed. 7334 Appendix G. Acknowledgement 7336 Earlier versions of this document were edited by Mark Crispin. 7337 Sadly, he is no longer available to help with this work. Editors of 7338 this revisions are hoping that Mark would have approved. 7340 Chris Newman has contributed text on I18N and use of UTF-8 in 7341 messages and mailbox names. 7343 Thank you to Tony Hansen for helping with the index generation. 7344 Thank you to Timo Sirainen, Bron Gondwana, Stephan Bosch and Arnt 7345 Gulbrandsen for extensive feedback. 7347 This document incorporate text from RFC 4315 (by Mark Crispin), RFC 7348 4466 (by Cyrus Daboo), RFC 4731 (by Dave Cridland), RFC 5161 (by Arnt 7349 Gulbrandsen), RFC 5465 (by Arnt Gulbrandsen and Curtis King), RFC 7350 5530 (by Arnt Gulbrandsen), RFC 5819 (by Timo Sirainen), RFC 6154 (by 7351 Jamie Nicolson), RFC 8438 (by Stephan Bosch) so work done by authors/ 7352 editors of these documents is appreciated. Note that editors of this 7353 document were redacted from the above list. 7355 The CHILDREN return option was originally proposed by Mike Gahrns and 7356 Raymond Cheng in [RFC3348]. Most of the information in 7357 Section 6.3.9.5 is taken directly from their original specification 7358 [RFC3348]. 7360 Index 7362 $ 7363 $Forwarded (predefined flag) 12 7364 $Junk (predefined flag) 12 7365 $MDNSent (predefined flag) 12 7366 $NotJunk (predefined flag) 12 7367 $Phishing (predefined flag) 13 7369 + 7370 +FLAGS 92 7371 +FLAGS.SILENT 92 7373 - 7374 -FLAGS 92 7375 -FLAGS.SILENT 92 7377 A 7378 ALERT (response code) 99 7379 ALL (fetch item) 88 7380 ALL (search key) 78 7381 ALL (search result option) 76 7382 ALREADYEXISTS (response code) 99 7383 ANSWERED (search key) 78 7384 APPEND (command) 68 7385 APPENDUID (response code) 100 7386 AUTHENTICATE (command) 29 7387 AUTHENTICATIONFAILED (response code) 100 7388 AUTHORIZATIONFAILED (response code) 101 7390 B 7391 BAD (response) 108 7392 BADCHARSET (response code) 101 7393 BCC (search key) 78 7394 BEFORE (search key) 78 7395 BINARY.PEEK[]<> (fetch item) 88 7396 BINARY.SIZE[] (fetch item) 89 7397 BINARY.SIZE[] (fetch result) 118 7398 BINARY[]<> (fetch result) 118 7399 BINARY[]<> (fetch item) 88 7400 BODY (fetch item) 89 7401 BODY (fetch result) 119 7402 BODY (search key) 78 7403 BODY.PEEK[
]<> (fetch item) 89 7404 BODYSTRUCTURE (fetch item) 90 7405 BODYSTRUCTURE (fetch result) 119 7406 BODY[
]<> (fetch result) 119 7407 BODY[
]<> (fetch item) 89 7408 BYE (response) 109 7409 Body Structure (message attribute) 14 7411 C 7412 CANNOT (response code) 101 7413 CAPABILITY (command) 25 7414 CAPABILITY (response code) 101 7415 CAPABILITY (response) 110 7416 CC (search key) 78 7417 CLIENTBUG (response code) 101 7418 CLOSE (command) 74 7419 CLOSED (response code) 102 7420 CONTACTADMIN (response code) 102 7421 COPY (command) 93 7422 COPYUID (response code) 102 7423 CORRUPTION (response code) 103 7424 COUNT (search result option) 76 7425 CREATE (command) 38 7427 D 7428 DELETE (command) 39 7429 DELETED (search key) 78 7430 DELETED (status item) 68 7431 DRAFT (search key) 78 7433 E 7434 ENABLE (command) 33 7435 ENVELOPE (fetch item) 90 7436 ENVELOPE (fetch result) 122 7437 ESEARCH (response) 115 7438 EXAMINE (command) 37 7439 EXPIRED (response code) 103 7440 EXPUNGE (command) 75 7441 EXPUNGE (response) 117 7442 EXPUNGEISSUED (response code) 103 7443 Envelope Structure (message attribute) 14 7445 F 7446 FAST (fetch item) 88 7447 FETCH (command) 87 7448 FETCH (response) 118 7449 FLAGGED (search key) 78 7450 FLAGS (fetch item) 90 7451 FLAGS (fetch result) 123 7452 FLAGS (response) 116 7453 FLAGS (store command data item) 92 7454 FLAGS.SILENT (store command data item) 92 7455 FROM (search key) 79 7456 FULL (fetch item) 88 7457 Flags (message attribute) 11 7459 H 7460 HASCHILDREN (response code) 103 7461 HEADER (part specifier) 90 7462 HEADER (search key) 79 7463 HEADER.FIELDS (part specifier) 90 7464 HEADER.FIELDS.NOT (part specifier) 90 7466 I 7467 IDLE (command) 71 7468 INTERNALDATE (fetch item) 90 7469 INTERNALDATE (fetch result) 123 7470 INUSE (response code) 104 7471 Internal Date (message attribute) 13 7473 K 7474 KEYWORD (search key) 79 7475 Keyword (type of flag) 12 7477 L 7478 LARGER (search key) 79 7479 LIMIT (response code) 104 7480 LIST (command) 44 7481 LIST (response) 111 7482 LOGOUT (command) 27 7484 M 7485 MAX (search result option) 76 7486 MAY (specification requirement term) 5 7487 MESSAGES (status item) 68 7488 MIME (part specifier) 91 7489 MIN (search result option) 76 7490 MOVE (command) 94 7491 MUST (specification requirement term) 5 7492 MUST NOT (specification requirement term) 5 7493 Message Sequence Number (message attribute) 11 7495 N 7496 NAMESPACE (command) 62 7497 NAMESPACE (response) 115 7498 NO (response) 108 7499 NONEXISTENT (response code) 104 7500 NOOP (command) 26 7501 NOPERM (response code) 104 7502 NOT (search key) 79 7503 NOT RECOMMENDED (specification requirement term) 5 7505 O 7506 OK (response) 107 7507 ON (search key) 79 7508 OPTIONAL (specification requirement term) 5 7509 OR (search key) 79 7510 OVERQUOTA (response code) 104 7512 P 7513 PARSE (response code) 105 7514 PERMANENTFLAGS (response code) 105 7515 PREAUTH (response) 108 7516 PRIVACYREQUIRED (response code) 105 7517 Permanent Flag (class of flag) 13 7518 Predefined keywords 12 7520 R 7521 READ-ONLY (response code) 106 7522 READ-WRITE (response code) 106 7523 RECOMMENDED (specification requirement term) 5 7524 RENAME (command) 41 7525 REQUIRED (specification requirement term) 5 7526 RFC822.SIZE (fetch item) 90 7527 RFC822.SIZE (fetch result) 123 7529 S 7530 SAVE (search result option) 76 7531 SEARCH (command) 75 7532 SEEN (search key) 79 7533 SELECT (command) 35 7534 SENTBEFORE (search key) 79 7535 SENTON (search key) 79 7536 SENTSINCE (search key) 79 7537 SERVERBUG (response code) 106 7538 SHOULD (specification requirement term) 5 7539 SHOULD NOT (specification requirement term) 5 7540 SINCE (search key) 79 7541 SIZE (status item) 68 7542 SMALLER (search key) 79 7543 STARTTLS (command) 28 7544 STATUS (command) 67 7545 STATUS (response) 115 7546 STORE (command) 92 7547 SUBJECT (search key) 80 7548 SUBSCRIBE (command) 43 7549 Session Flag (class of flag) 13 7550 System Flag (type of flag) 11 7552 T 7553 TEXT (part specifier) 90 7554 TEXT (search key) 80 7555 TO (search key) 80 7556 TRYCREATE (response code) 106 7558 U 7559 UID (command) 96 7560 UID (fetch item) 90 7561 UID (fetch result) 123 7562 UID (search key) 80 7563 UIDNEXT (response code) 106 7564 UIDNEXT (status item) 68 7565 UIDNOTSTICKY (response code) 106 7566 UIDVALIDITY (response code) 107 7567 UIDVALIDITY (status item) 68 7568 UNANSWERED (search key) 80 7569 UNAVAILABLE (response code) 107 7570 UNDELETED (search key) 80 7571 UNDRAFT (search key) 80 7572 UNFLAGGED (search key) 80 7573 UNKEYWORD (search key) 80 7574 UNKNOWN-CTE (response code) 107 7575 UNSEEN (search key) 80 7576 UNSEEN (status item) 68 7577 UNSELECT (command) 74 7578 UNSUBSCRIBE (command) 44 7579 Unique Identifier (UID) (message attribute) 9 7581 X 7582 X (command) 97 7584 [ 7585 [RFC-5322] Size (message attribute) 14 7587 \ 7588 \All (mailbox name attribute) 113 7589 \Answered (system flag) 12 7590 \Archive (mailbox name attribute) 113 7591 \Deleted (system flag) 12 7592 \Draft (system flag) 12 7593 \Drafts (mailbox name attribute) 113 7594 \Flagged (mailbox name attribute) 113 7595 \Flagged (system flag) 12 7596 \HasChildren (mailbox name attribute) 112 7597 \HasNoChildren (mailbox name attribute) 112 7598 \Junk (mailbox name attribute) 113 7599 \Marked (mailbox name attribute) 112 7600 \Noinferiors (mailbox name attribute) 111 7601 \NonExistent (mailbox name attribute) 111 7602 \Noselect (mailbox name attribute) 111 7603 \Recent (system flag) 12 7604 \Remote (mailbox name attribute) 112 7605 \Seen (system flag) 12 7606 \Sent (mailbox name attribute) 113 7607 \Subscribed (mailbox name attribute) 112 7608 \Trash (mailbox name attribute) 113 7609 \Unmarked (mailbox name attribute) 112 7611 Authors' Addresses 7613 Alexey Melnikov (editor) 7614 Isode Ltd 7615 14 Castle Mews 7616 Hampton, Middlesex TW12 2NP 7617 UK 7619 Email: Alexey.Melnikov@isode.com 7621 Barry Leiba (editor) 7622 Futurewei Technologies 7624 Phone: +1 646 827 0648 7625 Email: barryleiba@computer.org 7626 URI: http://internetmessagingtechnology.org/