Organization: China Interactive Publishing Network (http://www.china-pub.com/)
RFC Document Chinese Translation Program (http://www.china-pub.com/compters/emook/aboutemook.htm)
E-mail: Ouyang@china-pub.com
Translator: lou_goodman (lou_goodman lou_oxyget@163.com)
Translation time: 2001-5-8
Copyright: This Chinese translation copyright belongs to China Interactive Publishing Network. Can be used for non-commercial use free reprint, but must
Keep the translation and copyright information of this document.
Network Working Group M. Butler
REQUEST for Comments: 937 J. Postel
D. chase
J. Goldberger
J. K. Reynolds
Obsoletes: RFC 918 ISI
February 1985
Post Office Agreement (Version 2)
(RFC 937 Post Office Protocol - Version 2)
One: Summary:
This RFC document provides a simple way to make the workstation dynamic from the mail server. It focuses on
A mail protocol that complies with the ARPA standards and provides recommendations and discussions for its further development. It is
Update of RFC 918. You can freely spread this document.
2: Introduction
The post office protocol (version 2) is to allow the user to get email from the mail server. It should also be allowed
Parts from the workstation to the mail server via a simple mail delivery protocol (SMTP). For more information, please refer to POP2 821 [1]
And POP2 822 [2].
This protocol assumes that there is already a reliable data stream, such as a data stream provided by TCP protocols or other protocols.
If it is a TCP protocol, the POP2 protocol server monitors from 109 ports.
Three: System Model and Analysis
When we assign an IP address to a workstation to treat it as an Internet host, we don't want it to pack.
With the user's mailbox. We want to have a dedicated server to provide an email service.
Of course, we know that the most important requirement for providing this service is that it is robust. A frequently downtime is
Not suitable for mail servers.
The POP2 protocol is a short period of time between workstations and servers on a local area network (such as ethernets).
Designed .POP2 protocol can also work on other types of networks. But if the network environment has changed, one
The new agreement may be necessary.
Imagine a user called John Smith, its computer called Fido, its mail server called DOG-HO
USE. Then it's email address is jsmith @ dog-house. ARPA (not JS
Mith @fido. ARPA)
That is to say, the email is stored in the mailbox of the mail server. ! ! ! The agreement only provides a mechanism for browsing mail in the mailbox.
There is no relationship between the user's workstation and the server, and the user's workstation is not a part of the email address.
Minute.
This is a very simple agreement. It is not a user interface. We hope that there is a friendly on our computer.
program of. But in fact, the agreement is not friendly. One of its basic rules is: if there is any error, disconnect
connection.
The POP2 protocol does not do anything for the message, which also analyzes the message header (Date:, from:, to :, cc :, or or
Subject :). The POP2 protocol passes the message from the server to the customer workstation.
4: POP2 protocol
The POP2 protocol is a collection of commands and answers. It comes from the ARPA network
It has many already existing protocols.
The server must listen to a connection. When a connection is established, the server sends a
Greeting message and waits for other commands of the user. When the command arrives, the server processes,
And give the user a reply.
Customers open a connection, wait for the Greeting message, then send the helo command,
The parameters including the user's name and password are authenticated to the server to get the message. Server returns the default
The number of emails of the mailbox to the user.
Users can read the email of the default mailbox, or use the fold command to select the mailbox.
Similarly, the server will return the number of emails of the mailbox selected by the user.
The user starts reading the mail with the read command.Read command should include a parameter to specify
Read the mail serial number, the default is the current message (that is, the first email when a new folder is opened).
The server began to send the content of the message to the user.
Users can use the retrial command to request a directory of the message.
When all data is received, the user sends a confirmation message. This is ACKS, ACKD, and NACK.
ACKS means "I have successfully received the message, please save it in the mailbox".
Ackd means "I have successfully received the message, please delete it from the mailbox".
NACK means "I am not subject to messages, please save it in the mailbox".
After receiving the ACKS and ACKD commands, the server points the message pointer to the next message; receive NACK
After the command, the message pointer remains unchanged.
In all cases, the server returns the content of the current message.
The user uses the quit command to turn off a conversation, and the server returns a message - OK.
The normal conversation process is shown below:
User server
Wait for a connection
Open connection ->
<- Server enters ready state, waiting for command
Helo command and account. Password ->
<- Send # 13 message, waiting for a command
Read # 13 message ->
<- = 537 characters in That Message
Waiting for a command
Retrial command ->
<- (send data)
Waiting for a command
ACKS message ->
<- = 0 Data transfer is completed
Wait for Command
Quit ->
<- OK close connection -> <- close connection
Waiting for the connection (return to the initial state)
parameter
The following parameters have a determination meaning:
User - User Account
PASSWORD - Account Password
Mailbox - mailbox name (or folder name)
Default mailbox
TOPS-20 system
Mail.txt.1 - from login Directory
UNIX system
/ usr / spool / mail / user
with
/ usr / usr / mail / inbox / *
"User" is the parameter provided by the Helo command.
File end sign
The file end flag is represented by a carriage return (CR) and a wrap (LF). Use "CRLF" in the file.
This logo will be used in commands and answers.
Message length
The answer to the read command and confirmation command (ACKS, ACKD, NACK) is the length of the message to be passed,
Includes all message characters. CRLF is considered two characters. The length of length is zero means that the message does not exist or
Empty. Request to pass a zero length message means closing the connection. This is in the Internet standard RFC 822 and NVT-
Defined in ASCII.
Number of emails
The answer to the helo and fold command is the statistics of the number of messages in the mailbox. Read command requires one
Parameters to specify emails to read. All numbers are represented by decimal, and from the beginning. This means that the mailbox is
The first message is represented by "1".
All numbers in this document are represented by decimal.
Side reference
In some cases, special characters need to be used in the parameters, and this is the syntax not allowed. For example: one in the password
Space. In order to do this, we need to use the escape session. Unfortunately, we have to use people hate
Character. In this Agreement, we use a backslash "/". One of the space characters in the parameter needs to be represented by two characters "/
Space ". This escape reference is only used in the command parameters, and the mail data that answers the retri command does not require this method.
Reply string
The first character must be specified (eg " ", "-", "=", "#"). Keeping the option string can be arbitrary
value.
Command and answer definition
Command and answer summary
Command answer
-------- -------
Helo User Password OK
Fold Mailbox - Error
Read [n] #xxx
Retr = yyy
ACKS
ACKD
NACK
Quit
Command explanation
Helo User Password
Helo command is used to authenticate the user. Its information is used by the server to determine the user's right to use the mailbox.
The keyword of this command is HELO, followed by the user's account and password, then CRLF.
Possible response:
"#nnn" nnn is the number of emails for the default mailbox.
"- ERROR REPORT" error report and disconnects.
Fold Mailbox
This command selects a mailbox or a folder. The server must determine if the user has permission access
This mailbox or folder. If the mailbox is empty or does not exist, the number of messages is 0. The keyword of the command "fold",
The back is followed by the Mailbox parameter, then CRLF.
Possible response:
"#nnn" nnn is the total number of mailboxes.
Read [nnn]
The read command begins to pass the data. If the parameters are not given in the read command, it means reading the current message.
A read command first sets the mail pointer as the parameter value, and then the server returns the length of the message. If there is no email readable,
The returned message is equal to zero. If the message has been deleted by the ACKD command, it returns zero length. Follow the read command
Is the retr command, read command, fold command, or quit command. Don't try to use the retr command to operate a zero length
Mail. The keyword for this command is "read". Loading is the number of mail numbers and CRLF. Possible response:
"= CCC" CCC is the length of the corresponding message
Retri
This command determines that the user has been prepared to receive mail. It must be followed by a confirmation command. Server
The connection is disconnected if the message is sent (eg, a message that does not exist). The keyword of the command is "
Retrin, followed by a CRLF.
Possible response:
Data stream or shutdown connection
ACKS
This command confirms that the user has received the message. This command ends the transmission of the mail data. The mail data is guaranteed
In the mailbox, the mail pointer adds 1. The server returns the next mail data length or zero (if the next mail does not exist
Or has been deleted). The keyword for this command is "ACKS", followed by CRLF
Possible response:
"= CCC" CCC is the length of the next mail
ACKD
This command confirms that the user has received the message, ending the transmission of mail data, if the user has a mailbox
Write rights to delete the corresponding messages from the mailbox. In fact, only the session is over, the mailbox is released or the user selects another
There will be a change when a mailbox will be changed. If the user does not write permission to the mailbox, the mailbox does not change. Server should
The answer is the same, regardless of whether the message is deleted. Then, the server points the mail pointer to the next message and returns its length.
Corresponding, if the message does not exist or have been deleted, zero length. The keyword of the command is "ACKD" and then
CRLF.
Possible response:
"= CCC" CCC is the length of the next mail
NACK
The user reports that it does not receive data with this command. This command ends the transmission of the mail data. Number of emails
According to saved in the mailbox, keep the mail pointer unchanged. The server returns the length of the current message. Because the current email inevitably exists,
So the message length is a number greater than zero. The keyword for this command is "NACK" and then CRLF.
Possible response:
"= CCC" CCC is the length of the current message.
Quit
This command indicates that the user has completed the session. The server will send a "OK" to respond to the user and turn off the connection.
The keyword of this command is "quit" and then CRLF.
Possible response:
" Ok" and close the connection
Server answer
Greeting
When any connection is established, the server will send the response to the user. The message is added by a plus, then
Is the name of the agreement (POP2), the name of the server, text, and CRLF.
" "
The plus sign means successful connection. He is followed by text and CRLF.
"-"
The reduction means that the connection failed. Like the plus, follow the text and CRLF.
"="
The equal sign returns the length of the message specified in the command. He follows a number and then the text and CRLF.
"#"
This symbol returns the total number of messages in the specified mailbox or folder. He follows a number, then the text
This and CRLF.
Timeouts
There are Timeouts in any similar agreement. If you don't want to let one of them fall into endless wait
During. Users want a faster response, so it should be short-time. It is called T1.
For some servers, there should have time to calculate the number of messages or the length of the message in the mailbox or the rectification
The stored data is used to transmit. Therefore, the timeout should be greater than these times. You should also consider this in the command retri
question.
Service companies do not want to wait for the next command of the user, so service companies are taken by a timeout
T2.
When a user gives a program for the client, it can be reasonable when it automatically sends commands to the server.
Imagination, at this time the T2 time of the server should be small.
Correspondingly, if a person sends a command to the server, the server's T2 should be large.
discuss
Servers on TOPS-20:
In this case, the mailbox is a simple file. The letter is linked behind the file. Different messages have
A segmentation line.
The particular point of this server is its delete operation. Only when the user has a write permission to the file,
To do this. Pay attention to avoid two problems: (1) Block other users from writing to the file; (2) Prevent accident deletion
The user is a message.
A recommendation
When a mailbox is selected, if the user has a write permission, a temporary name is re-email. This new message is
Will be placed in a temporary file. All POP2 operations are performed on the temporary mailbox. This way to delete the mail box folder when the POP2 session ends or the other mailbox.
Command line and the size of the answer
The maximum length of the command line (including the command word and CRLF).
512 characters (including , -, =, #, and CRLF) at the maximum length of the row.
The maximum length of the mail data line is 1000 characters (including CRLF).
ISI has used POP2 protocols as a server for TOPS-20 and Berkeley 4.2 UNIX systems;
Machines for IBM-PC and Berkeley 4.2 UNIX systems.
Deficiency
The POP2 protocol does not check the content of the data, and does not even analyze the data head.
Any status information of the mail in the middle of the server (for example: we don't have anything from a session to another
What is the server, I don't know that the message is a new email.
Five: example
Example 1:
Client Server
------ ------
Wait for Connection
Open connection ->
<- POP2 USC-ISIF.ARPA Server
Helo Postel Secret ->
<- # 2 Messages in your mailbox
Read ->
<- = 537 characters in message 1
Retr ->
<- [Data of Message 1]
ACKD ->
<- = 234 characters in Message 2
Retr ->
<- = 234 characters in Message 2
Retr ->
<- [Data of Message 2]
ACKD ->
<- = 0 no more messages
Quit ->
<- OK, BYE, BYE
Close Connection -> <- Close Connection
Go Back to Start
Example 2:
Client Server
------ ------
Wait for Connection
Open connection ->
<- POP2 ISI-VAXA.ARPA Server Here
Helo Smith Secret ->
<- # 35 messages
Fold / usr / spool / mail / smith ->
<- # 27 messages
Read 27->
<- = 10123 characters in That Message
Retr ->
<- [Data of Message 27]
Acks ->
<- = 0 no more messages
Quit ->
<- BYE, Call Again Sometime.
Close Connection -> <- Close Connection
Go Back to Start
Example 3:
Client Server
------ ------
Wait for ConnectionOpen Connection ->
<- POP2 ISI-VAXA.ARPA Server Here
Helo Jones SECRET ->
<- # 0 messages
Read ->
<- Close Connection
Close Connection ->
Go Back to Start
Six: form syntax
Options and parameters
A | B | C | ... | Z
|, | - | / |: | <| = |> |? | @ |
[|] | ^ || `| {| | |} |
= /
2. Userflow chart
| ^ BYE
| Open | -----
| GREET | CLOSE
V ----- |
----- quit -------
| CALL | --------------> | EXIT |
----- -------
| ^
| GREET |
| ----- |
| Helo |
----> |
#Nnn ^ | | #nnn |
---- | V V ---- |
Fold | ------- quit |
<--- | NMBR | --------------------->
----- ^
^ | | | |
| | #Nnn |
| | ---- | = CCC | | Read |
---- | | | |
Fold | | = CCC |
| V ---- |
= CCC ---> ----- quit |
---- ^ | Size | --------------------->
Read <- -------
^ | |
| | = CCC
Data | | ----
---- | | Retri
ACK | |
| V
-----
| XFER |
-----
3. Server flow chart
---------------------- Close
| | -----
Listen | | CLOSE
V |
----- -------
| LSTN | | DONE |
----- -------
| ^
| Open |
| ----- |
| GREET |
| | |
| Quit |
V ----- |
----- BYE |
| Auth | --------------------->
----- ^
| | |
| Helo |
| ---- |
| #Nnn |
| | |
| Quit |
V ----- |
Fold ---> ------- BYE |
---- ^ | MBOX | --------------------->
#Nnn <--- ----- ^
^ | | | |
| | R | |
Fold | | ---- |
---- | | = CCC |
#Nnn | | quit |
| V ----- |
Read ---> ------- Bye | ---- ^ | Item | -------------------->
= CCC <--- -------
^ | |
| | Retri
ACK | | ----
---- | | | DATA
= CCC | |
| V
-----
| Next |
-----
4. Communication flow chart
--
| Call | <----------------------------------------------------------------------------------------------------------------------------------------------------- --------------
| LSTN | ^
-- |
| GREET |
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----> |
| ^ Quit | |
V | v |
---- ---- -- |
| Call | Helo | NMBR | | EXIT | |
| Auth | -------> | Auth | | Auth | |
---- ---- -- |
| #Nnn BYE | |
| | | | |
| ------------------------------------> |
| ^ Quit | | | | | |
V | v | |
-> ---- -- -- | |
Fold ^ | NMBR | Read | Size | | Exit | | |
---- | | | MBOX | -------> | MBOX | | MBOX | | | #nnn <- ---- - ---- | |
^ | = CCC BYE | | | | |
| | | | | | |
Fold -------- | -----------------> | | |
---- ^ | ^ Quit | | | | |
#Nnn | v | v | | | |
---> ---- - ---- | | |
^ | Size | Retr | XFER | | Exit | | | | |
---- | | Item | -------> | Item | | item | | |
= CCC <--- --- - ---- | | |
^ | Data | | | | | |
| | | | | | |
= CCC | V BYE | | | | |
-- ---- | | | |
| SIZE | ACK | XFER | | | | |
| NEXT | <------- | Next | | | | |
-- ---- | | | |
| | | | | |
| | | | | |
V v v |
----- |
| Exit | ->
| DONE |
-----
5. User Policy Table
| State |
------- ---------------------------------- |
INPUT | CALL | NMBR | SIZE | XFER | EXIT |
------- ---------------------------------- |
Greet | 2 | 1 | 1 | 1 | 6 |
------- ---------------------------------- |
#Nnn | 1 | 3 | 1 | 1 | 6 |
------- ---------------------------------- |
= CCC | 1 | 1 | 4 | 1 | 6 |
------- ---------------------------------- |
Data | 1 | 1 | 1 | 5 | 6 |
------- ---------------------------------- | BYE | 1 | 1 | 1 | 1 | 6 |
------- ---------------------------------- |
CLOSE | 1 | 1 | 1 | 1 | 6 |
------- ---------------------------------- |
Other | 1 | 1 | 1 | 1 | 6 |
------- ---------------------------------- |
TIMEOUT | 1 | 1 | 1 | 1 | 6 |
------- ---------------------------------- |
user behavior
1. This is a useless message. Send the "quit" command to enter the exit status.
2. (a) If Greeting is successful, send "Helo" to enter the NMBR state.
(b) Otherwise, send "quit" to enter the exit status.
3. If the user selects the folder and nnn> 0, send "read" and enter the Size State..
If the user selects the folder and nnn = 0, "quit" is sent, and enter the exit status.
If the user reselects the folder, send "fold" and returns the NMBR state.
4. If the user selects the message and CCC> 0, send "retr" and enter the XFER state.
If the user selects the email and CCC = 0, "quit" is sent, and enter the exit status.
If the user reselects the email, send "read" and enter the Size state.
5. If the user wants to save the email, send "ACKS" and enter the Size status.
If the user wants to delete the message, send "ACKD" and enter the Size status.
If the user wants to return to the message, send "NACK" and enter the Size state.
6. Turn off the connection.
6. Server Policy Table
| State
------- -----------------------------------------
INPUT | LSTN | Auth | MBOX | Item | Next | DONE |
------- ----------------------------------------- |
Open | 2 | 1 | 1 | 1 | 1 | 1 |
------- ----------------------------------------- |
Helo | 1 | 3 | 1 | 1 | 1 | 1 |
------- ----------------------------------------- |
FOLD | 1 | 1 | 5 | 5 | 1 | 1 |
------- ----------------------------------------- |
Read | 1 | 1 | 6 | 6 | 1 | 1 |
------- ----------------------------------------- |
Retr | 1 | 1 | 1 | 7 | 1 | 1 |
------- ----------------------------------------- |
ACKS | 1 | 1 | 1 | 1 | 8 | 1 | ------- ---------------------------- ------------- |
ACKD | 1 | 1 | 1 | 1 | 8 | 1 |
------- ----------------------------------------- |
NACK | 1 | 1 | 1 | 1 | 8 | 1 |
------- ----------------------------------------- |
Quit | 1 | 4 | 4 | 4 | 1 | 1 |
------- ----------------------------------------- |
CLOSE | 1 | 1 | 1 | 1 | 1 | 9 |
------- ----------------------------------------- |
Other | 1 | 1 | 1 | 1 | 1 | 1 |
------- ----------------------------------------- |
TIMEOUT | | 1 | 1 | 1 | 1 | 1 |
------- ----------------------------------------- |
Server behavior
1. This is a useless message. Send "-Error" and disconnects.
2. Send GRETING to enter the Auth status.
3. If it is an authentication user, send "#nnn" to enter the MBOX status.
Otherwise, send "-Error" and disconnect the connection.
4. Send " BYE" to enter the DONE status.
5. Send " NNN" and enter the MBOX status.
6. Send "= CCC" to enter the ITEM status.
7. If the message exists, transfer the data, enter the NEXT state. Otherwise, disconnect.
8. Answer the command ACKS / ACKD / NACK to enter the ITEM status.
9. Disconnect.
Seven: Thanks
I am very grateful to the first edition of the post office protocol of the RFC 918 and the draft of the POP2 protocol provided by the Group of Interests.
8: References:
[1] Postel, J., "Simple Mail Transfer Protocol", RFC 821,
USC / INFORMATION sciences institute, August 1982.
[2] CROCKER, D., "Standard for the format of arpa-internet text
Messages, RFC 822, University of Delaware, August 1982.
[3] Reynolds, J.K., "Post Office Protocol", RFC 918, USC / Information
Sciences Institute, October 1984.
[4] Reynolds, J.K., And J. Postel, "Assigned Numbers", RFC 923,
USC / INFORMATION sciences institute, October 1984.
RFC 937 Post Office Protocol - Version 2 Post Office Agreement (Version 2) 1
RFC Document Chinese Translation Program