The POP Protocol (Part 2):
The POP3 protocol is simple enough to be done by hand over a telnet connection. The following listing shows a sample POP3 session that demonstrates the function of several of the protocol commands.
$ telnet localhost 110
Trying 127.0.0.1...
Connected to ani.foobirds.org.
Escape character is '^]'.
+OK POP3 ani.foobirds.org v2000.70rh server ready
USER craig
+OK User name accepted, password please
PASS Wats?Watt?
+OK Mailbox open, 4 messages
STAT
+OK 4 8184
LIST
+OK Mailbox scan listing follows
1 1951
2 1999
3 2100
4 2134
.
RETR 1
+OK 1951 octets
... an e-mail message 1951 bytes long ...
.
DELE 1
+OK Message deleted
QUIT
+OK Sayonara
Connection closed by foreign host.
The first three lines after the telnet command (Trying, Connected, and Escape) are output from the telnet command, as is the very last line (Connection closed). All of the other lines in the previous listing are POP3 commands and responses. Positive responses start with the string +OK, which indicates that the command executed successfully. When a command fails, the response begins with the string -ERR. The first +OK response in the previous listing is in reply to the connection request from telnet. The response indicates that the POP server is ready.
The user then logs in with the USER and PASS commands. The username and password provided
here must match a valid username and password found in the /etc/passwd
file. Notice that the
password is sent as clear text. POP3 provides a more secure MD5 login mechanism through the
APOP command.