5. TRANSACTION 状态
一旦客户端已成功向 POP3 服务器标识自身, 且 POP3 服务器已锁定并打开相应邮件投递箱, POP3 会话此时就处于 TRANSACTION 状态. 客户端现在可以重复发出以下任何 POP3 命令. 在每条命令之后, POP3 服务器都会发出一条响应. 最终, 客户端发出 QUIT 命令, POP3 会话进入 UPDATE 状态.
以下是 TRANSACTION 状态下有效的 POP3 命令:
STAT
Arguments: none
Restrictions: may only be given in the TRANSACTION state.
Discussion:
The POP3 server issues a positive response with a line
containing information for the maildrop. This line is
called a "drop listing" for that maildrop.
In order to simplify parsing, all POP3 servers are
required to use a certain format for drop listings.
The first octets present must indicate the number of
messages in the maildrop. Following this is the size
of the maildrop in octets. This memo makes no
requirement on what follows the maildrop size.
Minimal implementations should just end that line of
the response with a CRLF pair. More advanced
implementations may include other information.
NOTE: This memo STRONGLY discourages
implementations from supplying additional
information in the drop listing. Other,
optional, facilities are discussed later on
which permit the client to parse the messages
in the maildrop.
Note that messages marked as deleted are not counted in
either total.
Possible Responses:
+OK nn mm
Examples:
C: STAT
S: +OK 2 320
LIST [msg]
Arguments: a message-id (optionally) If a message-id is
given, it may NOT refer to a message marked as
deleted.
Restrictions: may only be given in the TRANSACTION state.
Discussion:
If an argument was given and the POP3 server issues a
positive response with a line containing information
for that message. This line is called a "scan listing"
for that message.
If no argument was given and the POP3 server issues a
positive response, then the response given is
multi-line. After the initial +OK, for each message
in the maildrop, the POP3 server responds with a line
containing information for that message. This line
is called a "scan listing" for that message.
In order to simplify parsing, all POP3 servers are
required to use a certain format for scan listings.
The first octets present must be the message-id of
the message. Following the message-id is the size of
the message in octets. This memo makes no requirement
on what follows the message size in the scan listing.
Minimal implementations should just end that line of
the response with a CRLF pair. More advanced
implementations may include other information, as
parsed from the message.
NOTE: This memo STRONGLY discourages
implementations from supplying additional
information in the scan listing. Other, optional,
facilities are discussed later on which permit
the client to parse the messages in the maildrop.
Note that messages marked as deleted are not listed.
Possible Responses:
+OK scan listing follows
-ERR no such message
Examples:
C: LIST
S: +OK 2 messages (320 octets)
S: 1 120
S: 2 200
S: .
...
C: LIST 2
S: +OK 2 200
...
C: LIST 3
S: -ERR no such message, only 2 messages in
maildrop
RETR msg
Arguments: a message-id (required) This message-id may
NOT refer to a message marked as deleted.
Restrictions: may only be given in the TRANSACTION state.
Discussion:
If the POP3 server issues a positive response, then the
response given is multi-line. After the initial +OK,
the POP3 server sends the message corresponding to the
given message-id, being careful to byte-stuff the
termination character (as with all multi-line
responses).
If the number associated with this message is higher
than the "highest number accessed" in the maildrop, the
POP3 server updates the "highest number accessed" to
the number associated with this message.
Possible Responses:
+OK message follows
-ERR no such message
Examples:
C: RETR 1
S: +OK 120 octets
S: <the POP3 server sends the entire message here>
S: .
DELE msg
Arguments: a message-id (required) This message-id
may NOT refer to a message marked as deleted.
Restrictions: may only be given in the TRANSACTION state.
Discussion:
The POP3 server marks the message as deleted. Any
future reference to the message-id associated with the
message in a POP3 command generates an error. The POP3
server does not actually delete the message until the
POP3 session enters the UPDATE state.
If the number associated with this message is higher
than the "highest number accessed" in the maildrop,
the POP3 server updates the "highest number accessed"
to the number associated with this message.
Possible Responses:
+OK message deleted
-ERR no such message
Examples:
C: DELE 1
S: +OK message 1 deleted
...
C: DELE 2
S: -ERR message 2 already deleted
NOOP
Arguments: none
Restrictions: may only be given in the TRANSACTION state.
Discussion:
The POP3 server does nothing, it merely replies with a
positive response.
Possible Responses:
+OK
Examples:
C: NOOP
S: +OK
LAST
Arguments: none
Restrictions: may only be issued in the TRANSACTION state.
Discussion:
The POP3 server issues a positive response with a line
containing the highest message number which accessed.
Zero is returned in case no message in the maildrop has
been accessed during previous transactions. A client
may thereafter infer that messages, if any, numbered
greater than the response to the LAST command are
messages not yet accessed by the client.
Possible Response:
+OK nn
Examples:
C: STAT
S: +OK 4 320
C: LAST
S: +OK 1
C: RETR 3
S: +OK 120 octets
S: <the POP3 server sends the entire message
here>
S: .
C: LAST
S: +OK 3
C: DELE 2
S: +OK message 2 deleted
C: LAST
S: +OK 3
C: RSET
S: +OK
C: LAST
S: +OK 0
RSET
Arguments: none
Restrictions: may only be given in the TRANSACTION
state.
Discussion:
If any messages have been marked as deleted by the POP3
server, they are unmarked. The POP3 server then
replies with a positive response. In addition, the
"highest number accessed" is also reset to zero.
Possible Responses:
+OK
Examples:
C: RSET
S: +OK maildrop has 2 messages (320 octets)