IMAP Components

Here we discuss the components of IMAP to prepare us for our blow-by-blow protocol trace later in the chapter.


As we saw in Chapter 2, What Is IMAP? , IMAP clients can operate in one of three modes: offline mode, online mode, or disconnected mode. While you’re not likely to see any IMAP operations take place between the client and server that say, “I’m an online session” or “I’m on offline session,” these modes are quite an important part of IMAP.


First of all, the session can be in one of four states. Commands and responses are, in most cases, valid only in certain states (e.g., you can’t issue the command to select a mailbox unless you’re in the authenticated state). Although two or more sessions with a given mailbox can each be in different states, no single session can be in more than one state simultaneously. For example, when your client initially connects to the server and you’re in the non-authenticated state, you authenticate successfully, leave the non-authenticated state, and enter the authenticated state. Here’s a description of the four states. A diagram of the relationship between the states is shown in Figure 3-2 .

Non-authenticated state

The non-authenticated state begins immediately when a connection starts.

Authenticated state

The authenticated state begins when the client authenticates successfully. It may also begin after an error in selecting a mailbox.

Selected state

The selected state begins once a mailbox has been selected successfully. ...

Get Managing IMAP 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.