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 ...