Friday, January 2, 2009

How to read POP3 logs

·

POP3 Session Explained. When an email client opens a connection to receive email it connects to a predefined hostname or IP address and connects to a listening mail server on port 110 (default port for POP3). The mail server greets the connecting client with domain and possibly mail server type and version. The POP3 mail session continues with single responses from the mail server and client. For example, after the mail server responds with the server greeting message the client is required to respond with the next allowed command for POP3. Once the client and server have negotiated authentication the POP3 client will request how many messages are on the server and retrieve and/or delete messages from the server.

Here's a simplified version of server/client POP3 conversation:

S: = Server

C: = POP3 Client

S: +OK test.com Mail Server
C: USER test
S: +OK
C: PASS ****
S: +OK 2 messages waiting
C: LIST
S: +OK 2 messages (34567890) octets
C: RETR 1
S: +OK
C: DELE 1
S: +OK
C: RETR 2
S: +OK
C: DELE 2
S: +OK
C: QUIT
S: +OK test.com

How POP3 Client Controls Session. As you can see the client controls what happens during the POP3 session. The POP3 client can retrieve any message in any order (although most will retrieve in order) and the POP3 client is in control of telling the POP3 server to delete messages. Only after the POP3 client has requested to delete messages from the server and after the QUIT command will the server actually delete the messages from the server.

Detailed POP3 Session. Typically your mail server will log the simplified version of a POP3 session, however, there can be a lot more going on in the background than what's logged. For example, the client and server may negotiate SSL certificate or different authentication types. Here's a more detailed POP3 log.

Server = »

Client = «

192.168.1.1 = the IP of the connecting POP3 client.

192.168.1.1 » +OK test.com Mail Server v1 POP3
192.168.1.1 « AUTH
192.168.1.1 » +OK List of supported mechanisms follows
192.168.1.1 » CRAM-MD5
192.168.1.1 » PLAIN
192.168.1.1 » LOGIN
192.168.1.1 » DIGEST-MD5
192.168.1.1 « CAPA
192.168.1.1 » +OK Capability list follows
192.168.1.1 » TOP
192.168.1.1 » USER
192.168.1.1 » APOP
192.168.1.1 » EXPIRE NEVER
192.168.1.1 » UIDL
192.168.1.1 » SASL CRAM-MD5 PLAIN LOGIN DIGEST-MD5
192.168.1.1 » STLS
192.168.1.1 « USER test
192.168.1.1 » +OK
192.168.1.1 « PASS *******
192.168.1.1 » +OK 7 messages (2379188) octets
192.168.1.1 « STAT
192.168.1.1 » +OK 7 2379188
192.168.1.1 « LIST
192.168.1.1 » +OK 7 messages (2379188) octets
192.168.1.1 « UIDL
192.168.1.1 » +OK 7 messages (2379188) octets
192.168.1.1 « RETR 1
192.168.1.1 » +OK 594172 octets
192.168.1.1 « DELE 1
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 2
192.168.1.1 » +OK 594355 octets
192.168.1.1 « DELE 2
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 3
192.168.1.1 » +OK 594404 octets
192.168.1.1 « DELE 3
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 4
192.168.1.1 » +OK 595109 octets
192.168.1.1 « DELE 4
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 5
192.168.1.1 » +OK 387 octets
192.168.1.1 « DELE 5
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 6
192.168.1.1 » +OK 383 octets
192.168.1.1 « DELE 6
192.168.1.1 » +OK Message deleted
192.168.1.1 « RETR 7
192.168.1.1 » +OK 378 octets
192.168.1.1 « DELE 7
192.168.1.1 » +OK Message deleted
192.168.1.1 « QUIT
192.168.1.1 » +OK test.com closing connection
192.168.1.1 *** test@test.com 7 2379188 00:00:29 OK
192.168.1.1 Disconnected



Understanding How POP3 Works.
Although in my experience POP3 issues are not that numerous, understanding how the POP3 protocol works and using the logs to isolate POP3 message collection problems can save you lots of time. Some of the more common problems are desktop virus scanners on the mail server computer, and more likely, on the POP3 client computer. Virus scanners will scan the message as it arrives and if not configured properly can give errors that may appear to be a mail server problem, for example, some desktop virus scanners use POP3 proxy to act as a middle man for the email client and the mail server, misconfiguration of proxy use can result in POP3 errors.

POP3 References:

POP3 Protocol RFC
http://www.faqs.org/rfcs/rfc1939.html

POP3 Extensions RFC
http://tools.ietf.org/html/rfc2449

Archive

Tweets