When using ISP-based or corporate email services, users are often seeking (asking peers) the address of the POP3 server, which has to be set in email clients like Outlook, Incredi-Mail and Eudora.
Recently, with GMail, POP has again come into action, as the Google guys provide free POP access along with the web interface. So what is this POP and how does it work?
POP stands for Post Office Protocol and currently its version 3 is in use, thus the name POP3. Email clients exchange POP3 commands to get emails and display error messages to the end user. POP servers listen for connections on the port, 110.
Hitting “Send/Receive” in an email utility results in a connection attempt to the defined POP server on this port. To perform the same activity manually, (checking your emails without a mail program), we will make use of Telnet. Telnet is a terminal emulation program that comes with Windows and can be used to connect with any host on any given port number.
Go to Start>Run. Type “Telnet POPServer 110”. Here the “POPServer” could be the IP address or host name of your POP server as set in an email client, and 110 specifies the port number. Once the connection is successful, a welcome message will be shown displaying the mail server name and version.
Authorization
Throughout the connection time, the POP3 session goes through a number of states performing various operations. Initially, when the connection is established, the session is said to be in an Authorization state. In this state, a user is identified as a valid mailbox user. Once this is done, the session progresses to the Transaction state, in which information is requested by the user and returned by the server. Thus, the server acquires a resource to handle the transaction. Upon receiving the QUIT command, the session goes into the Update state and then releases the resources to end the session.
After a successful connection with the server, there is a positive reply. This could be “+OK Sample Server Version 1.0.0. Ready”. At this point, the first command will identify the user. Type “USER username” and press Enter, where username is the part of email address before the @ sign. The server will respond with a positive answer saying “+OK Password required for username” or give a negative answer in case of an error, for example, plain text password is not allowed for the user.
Next, type “PASS password” and press Enter to complete the authorization process. If the password is correct, the server will provide a positive response (“+OK Mailbox ready”) or give you a negative response, stating that the password is not correct (“-ERR Invalid password”). If both the username and password are correct, but another POP3 session is active, the server responds with an error, like “-ERR Mailbox is currently locked”. Note that the server may not indicate error if an incorrect username is provided.
The mailbox is now locked for exclusive usage by the logged-in user’s session. All emails are numbered starting from one and sizes are calculated for each. Let’s briefly go through the commands which can be sent to the server. Type “STAT” and press Enter. The server returns “+OK N S” where N is number of messages and S is the combined size in bytes. For example, “+OK 2 2878”.
To view sizes of mails individually, type “LIST” and press Enter. The server responds with a numeric listing of emails followed by their sizes. This command can be followed by an argument to specify a single email by its number, for example “LIST 1”.
To read an email, type “RETR N” and press Enter, where N is the sequence number of the email. The server displays the entire content of an email on screen including a detailed header.
For deleting an email, issue the “DELE N” command where N indicates mail to be deleted. The server responds with a positive reply. Note that emails are initially marked for deletion and actually deleted in the Update state. To unmark messages (all at once), use the “RSET” command.
Update
Type “QUIT” and press Enter. The server deletes the messages marked for deletion. If this command is issued in the Transaction state, the session doesn’t go to the Update state. Also, if a connection is being terminated without the QUIT command, the update state is not called and messages are not deleted.
Keep digging through the protocols to learn more.
The writer works as an analyst for a software house in Karachi. His email address is nizar.ali@gmail.com