IMAP protocol

The IMAP protocol does not download messages to your computer—both the messages and the folders that we have created are kept on the server.

The IMAP protocol is the most advisable when we access our emails from various devices, or when we are mobile. As a precaution, we must periodically delete the contents of our account so that it does not exceed the space that's granted. The drawback of this protocol is that we must always have an internet connection, even to access and work with old messages.

This protocol has the advantage that, when we connect to read our emails from different devices, for example, our laptop or smartphone, we know that we can always access all of our messages, and that the mailbox will be updated. It is also interesting to preserve our privacy when we read our emails from a public or shared computer, as it does not store information on the local machine.

For starters, like POP, this protocol is only intended to read emails, not to send them. The main advantage over this is that you are also prepared to manage them: being able to organize them in folders or search in the server are inherent capabilities of the protocol.

Another differential aspect is the architecture that's designed to be accessed from different computers while keeping copies of our emails synchronized. If, in POP, we said that the common thing was to erase the messages as we downloaded them, in IMAP, those messages are kept on the server until we request their deletion explicitly.

This distributed synchronization is based on the UID that represents a unique identifier for a given message sequence number, which allows several clients to access it simultaneously and understand what messages they are manipulating. To round off this distributed support, clients can access any of the following connection modes:

  • Offline mode: It periodically connects to the server to download new messages and synchronize any changes that may have happened in the different folders. We have the ability to delete the messages as we download them, following a function that's very similar to POP3.
  • Online mode: It has access to the copy of the server messages exactly when we need to, synchronizing the changes practically on the fly.
  • Disconnected mode: Do not confuse this with offline mode. In this case, the client works with a local copy while they do not have access to the internet, where they can create/delete/read their emails. The next time you connect to the internet, these changes will be synchronized with the master copy of the server.

Since it is based on a model in which messages are normally stored on the server after being read, IMAP defines an easy way to manage them—with mail trays, that is, with folders. These follow a tree-like hierarchy, which we are used to in conventional filesystems. Following the standard we always have, the inbox will be the main source, but we can create other folders with different attributes. For example, there are attributes to specify that a folder contains only emails, (Noinferiors), or only folders, (Noselect), but they can also have other attributes that indicate whether or not new messages exist since the last time we opened it with (Marked) and (Unmarked).

A similar kind of label can have the emails we receive or send. One of the most used is the one that indicates whether it has been read or not (Seen), but there are also others that indicate that the message has been answered (Answered), that the message has been highlighted (Flagged), which is a draft ( Draft), and so on. All of this information is saved directly on the server and not on the client as we are used to, which allows you to perfectly synchronize this metadata between several clients.

Technically, at a low level, IMAP works very similarly to POP3—a connection is opened to port 143 of the server, and a conversation begins in ASCII. Following the custom, Gmail uses another port 993, which is the alternative port of IMAP if we want the connection to be encrypted under SSL. Once that connection is created, the client starts sending commands and receiving responses.

On an IMAP server, email messages are grouped into folders, some of which will come predefined by an IMAP provider. Once a folder has been selected, messages can be listed and fetched. Instead of having to download every message, the client can ask for particular information from a message, such as a few headers and its message structure, to build a display or summary for the user to click on, hence pulling message parts and downloading attachments from the server on demand.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset