📄 rfc2060.txt
字号:
Network Working Group M. CrispinRequest for Comments: 2060 University of WashingtonObsoletes: 1730 December 1996Category: Standards Track INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.Abstract The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server. IMAP4rev1 permits manipulation of remote message folders, called "mailboxes", in a way that is functionally equivalent to local mailboxes. IMAP4rev1 also provides the capability for an offline client to resynchronize with the server (see also [IMAP-DISC]). IMAP4rev1 includes operations for creating, deleting, and renaming mailboxes; checking for new messages; permanently removing messages; setting and clearing flags; [RFC-822] and [MIME-IMB] parsing; searching; and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4rev1 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers. IMAP4rev1 supports a single server. A mechanism for accessing configuration information to support multiple IMAP4rev1 servers is discussed in [ACAP]. IMAP4rev1 does not specify a means of posting mail; this function is handled by a mail transfer protocol such as [SMTP]. IMAP4rev1 is designed to be upwards compatible from the [IMAP2] and unpublished IMAP2bis protocols. In the course of the evolution of IMAP4rev1, some aspects in the earlier protocol have become obsolete. Obsolete commands, responses, and data formats which an IMAP4rev1 implementation may encounter when used with an earlier implementation are described in [IMAP-OBSOLETE].Crispin Standards Track [Page 1]RFC 2060 IMAP4rev1 December 1996 Other compatibility issues with IMAP2bis, the most common variant of the earlier protocol, are discussed in [IMAP-COMPAT]. A full discussion of compatibility issues with rare (and presumed extinct) variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is primarily of historical interest.Table of ContentsIMAP4rev1 Protocol Specification .................................. 41. How to Read This Document ................................. 41.1. Organization of This Document ............................. 41.2. Conventions Used in This Document ......................... 42. Protocol Overview ......................................... 52.1. Link Level ................................................ 52.2. Commands and Responses .................................... 62.2.1. Client Protocol Sender and Server Protocol Receiver ....... 62.2.2. Server Protocol Sender and Client Protocol Receiver ....... 72.3. Message Attributes ........................................ 72.3.1. Message Numbers ........................................... 72.3.1.1. Unique Identifier (UID) Message Attribute ......... 72.3.1.2. Message Sequence Number Message Attribute ......... 92.3.2. Flags Message Attribute .................................... 92.3.3. Internal Date Message Attribute ........................... 102.3.4. [RFC-822] Size Message Attribute .......................... 112.3.5. Envelope Structure Message Attribute ...................... 112.3.6. Body Structure Message Attribute .......................... 112.4. Message Texts ............................................. 113. State and Flow Diagram .................................... 113.1. Non-Authenticated State ................................... 113.2. Authenticated State ....................................... 113.3. Selected State ............................................ 123.4. Logout State .............................................. 124. Data Formats .............................................. 124.1. Atom ...................................................... 134.2. Number .................................................... 134.3. String ..................................................... 134.3.1. 8-bit and Binary Strings .................................. 134.4. Parenthesized List ........................................ 144.5. NIL ....................................................... 145. Operational Considerations ................................ 145.1. Mailbox Naming ............................................ 145.1.1. Mailbox Hierarchy Naming .................................. 145.1.2. Mailbox Namespace Naming Convention ....................... 145.1.3. Mailbox International Naming Convention ................... 155.2. Mailbox Size and Message Status Updates ................... 165.3. Response when no Command in Progress ...................... 165.4. Autologout Timer .......................................... 165.5. Multiple Commands in Progress ............................. 17Crispin Standards Track [Page 2]RFC 2060 IMAP4rev1 December 19966. Client Commands ........................................... 176.1. Client Commands - Any State ............................... 186.1.1. CAPABILITY Command ........................................ 186.1.2. NOOP Command .............................................. 196.1.3. LOGOUT Command ............................................ 206.2. Client Commands - Non-Authenticated State ................. 206.2.1. AUTHENTICATE Command ...................................... 216.2.2. LOGIN Command ............................................. 226.3. Client Commands - Authenticated State ..................... 226.3.1. SELECT Command ............................................ 236.3.2. EXAMINE Command ........................................... 246.3.3. CREATE Command ............................................ 256.3.4. DELETE Command ............................................ 266.3.5. RENAME Command ............................................ 276.3.6. SUBSCRIBE Command ......................................... 296.3.7. UNSUBSCRIBE Command ....................................... 306.3.8. LIST Command .............................................. 306.3.9. LSUB Command .............................................. 326.3.10. STATUS Command ............................................ 336.3.11. APPEND Command ............................................ 346.4. Client Commands - Selected State .......................... 356.4.1. CHECK Command ............................................. 366.4.2. CLOSE Command ............................................. 366.4.3. EXPUNGE Command ........................................... 376.4.4. SEARCH Command ............................................ 376.4.5. FETCH Command ............................................. 416.4.6. STORE Command ............................................. 456.4.7. COPY Command .............................................. 466.4.8. UID Command ............................................... 476.5. Client Commands - Experimental/Expansion .................. 486.5.1. X<atom> Command ........................................... 487. Server Responses .......................................... 487.1. Server Responses - Status Responses ....................... 497.1.1. OK Response ............................................... 517.1.2. NO Response ............................................... 517.1.3. BAD Response .............................................. 527.1.4. PREAUTH Response .......................................... 527.1.5. BYE Response .............................................. 527.2. Server Responses - Server and Mailbox Status .............. 537.2.1. CAPABILITY Response ....................................... 537.2.2. LIST Response .............................................. 547.2.3. LSUB Response ............................................. 557.2.4 STATUS Response ........................................... 557.2.5. SEARCH Response ........................................... 557.2.6. FLAGS Response ............................................ 567.3. Server Responses - Mailbox Size ........................... 567.3.1. EXISTS Response ........................................... 567.3.2. RECENT Response ........................................... 57Crispin Standards Track [Page 3]RFC 2060 IMAP4rev1 December 19967.4. Server Responses - Message Status ......................... 577.4.1. EXPUNGE Response .......................................... 577.4.2. FETCH Response ............................................ 587.5. Server Responses - Command Continuation Request ........... 638. Sample IMAP4rev1 connection ............................... 639. Formal Syntax ............................................. 6410. Author's Note ............................................. 7411. Security Considerations ................................... 7412. Author's Address .......................................... 75Appendices ........................................................ 76A. References ................................................ 76B. Changes from RFC 1730 ..................................... 77C. Key Word Index ............................................ 79IMAP4rev1 Protocol Specification1. How to Read This Document1.1. Organization of This Document This document is written from the point of view of the implementor of an IMAP4rev1 client or server. Beyond the protocol overview in section 2, it is not optimized for someone trying to understand the operation of the protocol. The material in sections 3 through 5 provides the general context and definitions with which IMAP4rev1 operates. Sections 6, 7, and 9 describe the IMAP commands, responses, and syntax, respectively. The relationships among these are such that it is almost impossible to understand any of them separately. In particular, do not attempt to deduce command syntax from the command section alone; instead refer to the Formal Syntax section.1.2. Conventions Used in This Document In examples, "C:" and "S:" indicate lines sent by the client and server respectively. The following terms are used in this document to signify the requirements of this specification. 1) MUST, or the adjective REQUIRED, means that the definition is an absolute requirement of the specification. 2) MUST NOT that the definition is an absolute prohibition of the specification.Crispin Standards Track [Page 4]RFC 2060 IMAP4rev1 December 1996 3) SHOULD means that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications MUST be understood and carefully weighed before choosing a different course. 4) SHOULD NOT means that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications SHOULD be understood and the case carefully weighed before implementing any behavior described with this label. 5) MAY, or the adjective OPTIONAL, means that an item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because the vendor feels that it enhances the product while another vendor may omit the same item. An implementation which does not include a particular option MUST be prepared to interoperate with another implementation which does include the option. "Can" is used instead of "may" when referring to a possible circumstance or situation, as opposed to an optional facility of the protocol. "User" is used to refer to a human user, whereas "client" refers to the software being run by the user. "Connection" refers to the entire sequence of client/server interaction from the initial establishment of the network connection until its termination. "Session" refers to the sequence of client/server interaction from the time that a mailbox is selected (SELECT or EXAMINE command) until the time that selection ends (SELECT or EXAMINE of another mailbox, CLOSE command, or connection termination). Characters are 7-bit US-ASCII unless otherwise specified. Other character sets are indicated using a "CHARSET", as described in [MIME-IMT] and defined in [CHARSET]. CHARSETs have important additional semantics in addition to defining character set; refer to these documents for more detail.2. Protocol Overview2.1. Link Level The IMAP4rev1 protocol assumes a reliable data stream such as provided by TCP. When TCP is used, an IMAP4rev1 server listens on port 143.Crispin Standards Track [Page 5]RFC 2060 IMAP4rev1 December 19962.2. Commands and Responses An IMAP4rev1 connection consists of the establishment of a client/server network connection, an initial greeting from the server, and client/server interactions. These client/server interactions consist of a client command, server data, and a server completion result response. All interactions transmitted by client and server are in the form of lines; that is, strings that end with a CRLF. The protocol receiver of an IMAP4rev1 client or server is either reading a line, or is reading a sequence of octets with a known count followed by a line.2.2.1. Client Protocol Sender and Server Protocol Receiver The client command begins an operation. Each client command is prefixed with an identifier (typically a short alphanumeric string, e.g. A0001, A0002, etc.) called a "tag". A different tag is generated by the client for each command. There are two cases in which a line from the client does not represent a complete command. In one case, a command argument is quoted with an octet count (see the description of literal in String under Data Formats); in the other case, the command arguments require server feedback (see the AUTHENTICATE command). In either case, the server sends a command continuation request response if it is ready for the octets (if appropriate) and the remainder of the command. This response is prefixed with the token "+".
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -