IMAP Commands

Because IMAP is a complex protocol, it has many more commands than the simple POP protocols. This section provides a reference for all IMAP commands in the proposed standard. Each command and its possible server responses are described in detail.

IMAP usage for a mobile user
Figure 11-1. IMAP usage for a mobile user

Just like the other protocols, any nonstandard commands, such as those proprietary commands that might be created by a particular vendor, are required to begin with an “X”.

Like POP, an IMAP consists of several distinct states. Some commands are only valid in a given state. Before detailing the commands themselves, a high-level look at the states is appropriate.

IMAP sessions may be in one of four states at any one time. These states are:

  • Nonauthenticated State

  • Authenticated State

  • Selected State

  • Logout State

Upon initial connection to an IMAP server, a client is in the Nonauthenticated State. A client enters the Authenticated State when a user log into the server, providing an appropriate type of authentication credentials.

Once logged in, a client may select a mailbox on which to operate. Selecting a mailbox puts the client in the Selected State and allows access to commands that operate on a mailbox.

The Logout State is entered when a client logs out, a server refuses service, or a connection is otherwise interrupted. This state lasts just long enough for the client and server to close a connection. ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.