POP3: A protocol to recieve mail
The POP3 protocol is the third version of POP (Post Office Protocol),
a protocol that is used to transfer mail saved for a user to the user's
computer. POP3 has an assigned port of 110. In order to manipulate mail
on a POP server, we will need to authenticate first. We can do this using the
USER and PASS commands together. Following is part of a complete session,
in which we just authenticate. It is edited slightly to remove my username
and password on the remote system. User Input is Italicized.
$ telnet pop.foo.bar 110
Trying 192.168.1.1...
Connected to pop.foo.bar.
Escape character is '^]'.
+OK QPOP (version 2.4) at pop.foo.bar starting.
USER user.123
+OK Password required for user.123.
PASS foo
+OK user.123 has 3 messages (1548 octets).
This example will not exactly match that on your server, but it will be fairly similar.
Now that we have authenticated on the server, we have access to a wide range of POP3 commands:
- STAT - Displays number of messages and space taken by mailspool
- LIST - Displays space taken by each message
- RETR message_number - Displays message message_number
- DELE message_number - Deletes message message_number
- QUIT - Closes connection
- TOP message_number lines - Displays lines from message message_number
Note that the TOP command is not required to be implemented by all POP3 servers. However,
it is implemented by most POP servers, so we will assume it to be available.
Following is an example session that utilizes all of the above POP commands.
$ telnet pop.foo.bar 110
Trying 192.168.1.1...
Connected to pop.foo.bar.
Escape character is '^]'.
+OK QPOP (version 2.4) at pop.foo.bar starting.
USER user.123
+OK Password required for foo.123.
PASS foo
+OK user.123 has 3 messages (1548 octets).
STAT
+OK 3 1548
LIST
+OK 3 messages (1548 octets)
1 344
2 386
3 818
.
TOP 1 10
+OK 344 octets
Return-Path:
Received: (from user.123@localhost)
by pop.foo.bar (8.8.8/8.8.8) id SAA29469
for user.123; Wed, 3 Dec 1997 18:54:54 -0500 (EST)
Date: Wed, 3 Dec 1997 18:54:54 -0500 (EST)
From: Pat Gunn
Message-Id: <199712032354.SAA29469@pop.foo.bar>
X-Real-To: user.123
Subject: Hi!
X-UIDL: b7bf8f395f5fea1e6ad4964ca202e979
Status: U
.
TOP 2 10
+OK 386 octets
Return-Path:
Received: (from user.123@localhost)
by pop.foo.bar (8.8.8/8.8.8) id SAA29614
for user.123; Wed, 3 Dec 1997 18:55:43 -0500 (EST)
Date: Wed, 3 Dec 1997 18:55:43 -0500 (EST)
From: Pat Gunn
Message-Id: <199712032355.SAA29614@pop.foo.bar>
X-Real-To: user.123
Subject: Hi!
Content-Type: text/plain
X-UIDL: f6aba8f9429ffcb4f343c6b061cd82bb
Status: U
Hi Pat! What's up?
.
TOP 3 5
+OK 818 octets
Return-Path:
Received: (from user.123@localhost)
by pop.foo.bar (8.8.8/8.8.8) id SAA29769
for user.123; Wed, 3 Dec 1997 18:56:38 -0500 (EST)
Date: Wed, 3 Dec 1997 18:56:38 -0500 (EST)
From: Pat Gunn
Message-Id: <199712032356.SAA29769@pop.foo.bar>
X-Real-To: user.123
Subject: Long message
Content-Type: text/plain
X-UIDL: fe81b45a152922cb1b05f0b1bb905944
Status: U
blah blahblahblahblahblahblahblahblahblahblah
blahblahblahblahblahblahblahblahblahblahblah
blahblahblahblahblahblahblahblahblahblah
blahblahblahblahblahblahblahblahblahblahblah
blahblahblahblahblahblahblahblahblahblahblahblahblah
.
DELE 3
+OK Message 3 has been deleted.
RETR 2
+OK 386 octets
Return-Path:
Received: (from user.123@localhost)
by pop.foo.bar (8.8.8/8.8.8) id SAA29614
for user.123; Wed, 3 Dec 1997 18:55:43 -0500 (EST)
Date: Wed, 3 Dec 1997 18:55:43 -0500 (EST)
From: Pat Gunn
Message-Id: <199712032355.SAA29614@pop.foo.bar>
X-Real-To: user.123
Subject: Hi!
Content-Type: text/plain
X-UIDL: f6aba8f9429ffcb4f343c6b061cd82bb
Status: U
Hi Pat! What's up?
.
DELE 2
+OK Message 2 has been deleted.
DELE 1
+OK Message 1 has been deleted.
QUIT
+OK Pop server at pop.foo.bar signing off.
Connection closed by foreign host.
Sometimes when one recieves very large files through mail, common mail clients
have problems downloading the mail over modems. Using the methods described
here, it is possible to fix a oversized mailspool in a matter of seconds,
or to grab a message quickly using the POP3 protocol if you're away from
your computer.
Things to remember while doing this:
- You need to remember your username and password to do this :)
- The TOP command can be used to identify various messages
If there an error occurs, the POP server will
respond with -ERR reason instead of +OK description.
POP3 is described in RFC1725.
Next