Saturday, September 22, 2012

Learn about POP3 and IMAP Protocols : Computer Networks

Article contributed by :

The pre-requisite to understand these two protocols is to know what an E-mail is and how it works. So, we would first take a short tour of E-mail.

Electronic Mail or e-mail, as it is often called, is one of the best forms of communication. Several innovations and researches to the field of Computer Networks have brought about many modifications to the traditional e-mail and today E-mail has become the fastest and most efficient way to communicate.

Working of E-mail

An e-mail system supports five basic functions:

Composition (generation of email),
Transfer (sending of email from sender to receiver), 
Reporting (delivery status of the mail at the receiver’s end), 
Displaying (the mail in the receiver’s mailbox) and
Disposition (what does the receiver does with the mail).

But for now, let us make the long story short, and just discuss about the message transfer phase.

To transfer an email from the source machine (say, A) to destination machine (say, B); the source machine establishes a TCP connection to port 25 of the destination machine. The actual transfer is done by a protocol named SMTP (Simple Mail Transfer Protocol)

This protocol accepts incoming connections and copies them in to the destination machine with the help of a message transfer agent. If the message cannot be delivered, an error report is sent to the source machine.

Final delivery protocols (POP3 & IMAP)

Now that we have seen the basic idea of how a mail is transferred, now it is the optimal time to learn about the delivery protocols.
As we have seen, sending an email needs the source machine to establish a TCP connection with the destination machine. But suppose A wants to send an email to B, but B is offline. In this case, A cannot establish a TCP connection with B and thus, The SMTP protocol fails.

One solution to this problem is to have a message transfer agent residing on an ISP (Internet Service Provider) between the source and destination machines. This agent can remain online 24x7, and thus the source machine can establish a TCP connection with this agent anytime.


POP3 (Post Office Protocol Version 3)

Now, the problem establishing TCP connection is solved. But, does it solve all the problems in delivering the mail? Certainly not. The problem now arising is how to connect the destination machine to the ISP (on which the message transfer agent resides). Note that this ISP is online throughout, but the destination machine is not. So, there must be a protocol to connect the mail transfer agent’s ISP to the destination machine. This is what POP (Post Office Protocol) is all about. This protocol deals with delivering the mail to the destination. But how? Let’s see.

First, the source establishes a TCP connection with the mail transfer agent’s ISP. The agent copies the mail to the ISP’s mailbox. Now, the role of the source machine is over. Delivering the mail to destination is up to the message transfer agent’s ISP.  Whenever the destination machine comes online, it establishes a TCP connection with the mail transfer agent at port 110. Then the message transfer agent gives the control to the POP3 server and this server completely copies the message to the mailbox of the destination machine. Once this is done, the message is deleted from the message transfer agent’s ISP.

IMAP (Internet Message Access Protocol)

The above protocol works well if there is a single user in the receiver’s ISP. But that must not be the case all the time. Quite often, in big companies or organizations, a single ISP is shared by many users. The mail sent by a source might be important for all the users sharing the ISP. So, in this case, definitely POP3 won’t work. To solve this problem, another protocol named IMAP (Internet Message Access Protocol) is used. Here, whenever a user in the destination ISP comes online, the user establishes a TCP connection to port 110 of the message transfer agent’s ISP.

  The agent approaches the IMAP server which now displays the whole message to the user. The user can either delete after reading, delete before reading, fully or partially download file(s) (if the message contains any files), and so on. Whatever the user does with the message is not the concern of the message transfer agent’s ISP. The agent does not delete the message from its ISP mailbox. So that, if a new user sharing the same destination ISP logs in, the message is displayed to that user too, after the TCP connection is established.


Key Differences

The key difference between both the protocols is the role of the message transfer agent and the corresponding protocol server. In POP3, the agent deletes the message (file) from its mailbox after the user PC downloads the file. In the contrary, in IMAP, the agent does not delete the message after displaying it to the user.

Another difference is that, in POP3, the only option left with the destination PC is to completely download the file to its PC. But, IMAP provides additional features- the destination user PC can partially/fully download the file, delete before/after reading the message, without loss of data as the message will always remain in the agent’s ISP mailbox.


Article contributed by :

ManojPisharody (BE – IT)



Post a Comment