1. Computing

Discuss in my forum

POP Inside Out

How Fetching Mail Through the Post Office Protocol Works

By

The Post Office Protocol (POP) used to retrieve mail from a remote server is a very simple protocol. It defines the basic functionality in a straight forward manner and is easy to implement. Of course, it is also easy to understand.

Let's find out what happens behind the scenes when your email program fetches mail in a POP account. First, it needs to connect to the server.

Hi, It's Me

Usually the POP server listens to port 110 for incoming connections. Upon connection from a POP client (your email program) it will hopefully respond with +OK pop.philo.org ready or something similar. The +OK indicates that everything is — OK. Its negative equivalent is -ERR, which means something has gone wrong. Maybe your email client has already shown you one of these negative server replies.

Now that the server has greeted us, we need to log on using our username (let's suppose the user name is "platoon"; what the server says is printed in italics):

+OK pop.philo.org ready
USER platoon

Since a user with this name does exist, the POP server responds with +OK and maybe some gibberish we don't really care about. Were there no such user at the server, it would of course make us panic with -ERR user unknown.

To make the authentication complete we also need to give our password. This is done with the "pass" command:

+OK send your password
pass noplato

If we type the password correctly, the server responds with +OK great password or whatever the programmer of the POP server had in mind. The important part again is the +OK. Unfortunately, passwords can also be wrong. The server notes this with a dry -ERR username and password don't match (as if you'd use your user name as your password).

If everything went okay, though, we are connected to the server and it knows who we are, thus we're ready to peek the newly arrived mail.

©2014 About.com. All rights reserved.