Retrieving the Mail
The SMTP delivery process described in the preceding section is not designed to deliver mail to a user but only to deliver mail to the user's mailbox. The user must then access the mailbox and download the mail. This additional step might complicate the process, but it offers the following advantages:
The latter advantage is a feature with which many email users are well acquainted. This feature enables the user to check an email from multiple locations. Theoretically, any computer with access to the Internet and an email reader application can be configured to check the user's mailbox for messages. You can check your mail from home, from an office, or from a hotel room. This process of accessing the mailbox and downloading messages requires a mail retrieval protocol. In the following sections, you'll learn about Post Office Protocol (POP) and Internet Message Access Protocol (IMAP).
By the Way
In reality, network security structures such as firewalls sometimes prevent the user from checking email from any random spot on the Internet.
The email server that holds user mailboxes typically must support both the SMTP service (for receiving incoming messages) and a mail retrieval protocol service (for giving users access to the mailbox). This process is depicted in Figure 18.3. This interaction requires coordination and compatibility between the SMTP service and the mail retrieval service so that data doesn't become lost or corrupt when the services access the same mailbox simultaneously.
Figure 18.3. The SMTP service application and the mail retrieval service application must coordinate access to the mailbox.
POP3 is described in RFC 1939. The client initiates a TCP connection to the POP3 server application on the email server. The POP3 server listens for connections on TCP port 110. After the connection has been established, the client application must send username and password information to the email server. If the login credentials are accepted, the user can access the mailbox to download or delete messages.
Like the SMTP client, the POP3 client uses a series of four-character commands for communicating with the server. The server responds with a very small number of alphabetic responses, such as +OK (indicating that the command was executed) and -ERR (indicating that the command resulted in an error). The responses might also include additional arguments or parameters. Each message in the mailbox is referenced by a message number. The client sends a RETR (retrieve) command to the server to download a message. The DELE command deletes a message from the server.
The messages sent between the POP3 client and server are invisible to the user. These commands are issued by the email reader application as a response to the user's activities within the email reader user interface.
One disadvantage of POP3 is the limited number of functions that can take place at the server. The user can only list the messages in the mailbox, delete messages, and download messages. Any manipulation of the message contents must occur on the client side. This limitation can cause delays and increase network traffic as messages are downloaded from the server to the client. The newer and more sophisticated IMAP protocol was developed to address some of these shortcomings.
Internet Message Access Protocol version 4 (IMAP4) is a message retrieval protocol similar to POP3. IMAP4, however, offers several new features that aren't available with POP3. With IMAP4, you can browse server-based folders and move, delete, and view messages without first copying the messages to your local computer. IMAP4 also allows you to save certain settings such as client window appearance or search messages on the server for a specified search string. You can also create, remove, and rename mailboxes on the server computer.
Most recent email readers support both POP3 and IMAP4. Although POP3 currently has a wider user base, the many advantages of IMAP ensure that email installations will continue converting to the IMAP4 protocol.