POP3 protocol specification (Chinese version)

zhaozj2021-02-08  241

POP3 Post Office Agreement - Version 3

1. Brief introduction For a smaller node on the network, the support message transmission system (MTS) is not practical. For example, a workstation may not have sufficient resource to allow SMTP servers and a comparable local mail transfer system to remain resident and continue to run. Similarly, the cost of connecting a personal computer for a long time in the IP type network is also considerable (resource for nodes is called "liability"). Noneto, it is very useful to allow administrative emails on such a summary point, and these nodes often support one user agent to manage messages. To solve this problem, it is possible to support MTS's nodes to provide mail storage features for these unfilled nodes. The post office protocol - Version 3 thus enables such a workstation to access the storage mail stored on the server with a relatively practical approach. Usually, this means that the workstation can get the message from the server, and the server is temporarily saved for mail. Hereinafter, the client host refers to the host using the POP3 service, and the server host refers to a host that provides a POP3 service. 2. Brief Description Do not specify how the customer host is sent to the transfer system in this document. Here is an explanation here: When the user agent needs to send the information to the transfer system, it establishes SMTP connections on the relay host (these relay host can be a POP3 host, or may not be). 3. When the basic operation is initially, the server starts POP3 service by listening to TCP port 110. When the client host needs to use the service, it will establish a TCP connection with the server host. When the connection is established, POP3 sends a confirmation message. Customer and POP3 servers (separate) exchange commands and responses, this process has always been continued to terminate. The pop3 command consists of a command and some parameters. All commands end in a CRLF pair. Commands and parameters consist of printed ASCII characters, which are spaced between spaces. Commands are generally three to four letters, and each parameter can reach 40 characters. The POP3 response consists of a status code and a command that may follow additional information. All responds are also ended by CRLF pairs. There are now two status codes, "determination" (" OK") and "fail" ("-err"). The response to a particular command is made up of many characters. In these cases, the following statement: Any additional information line is transmitted after sending a first row response and a CRLF, and they are also ended by the CRLF. When all the information is transmitted, the last line is sent, including an end character (decimal code 46, which is ".") And a CRLF pair. If any of the lines in the information starts with end characters, this line is filling by the end of the end of the line. Therefore, multi-line response is ended by five CRLF.CRLF. When a multi-row response is detected, the customer is detected to confirm whether the line begins with the end character. If yes, and after the characters are not CRLF, the first character (end character) of this row will be abandoned; if it followed the CRLF, the response from the POP server terminates, including .crlf's row is not It is considered part of the multi-line response. In the life cycle, POP3 sessions have several different states. Once the TCP connection is opened, and the POP3 server sends a confirmation information, this process enters the "confirmation" state. In this state, the customer must confirm that it is its customer to the POP3 server. Once the confirmation is successful, the server gets resources related to the customer mail, and this process enters the "operation" state. In this state, the customer puts forward the service when the customer issues a Quit command, and this process enters the "Update" state. In this state, the POP3 server is released in the "Operation" state, and the message is sent, and the connection is terminated. The POP3 server can have a batch that automatically exits the login.

This timer must be at least 10 minutes. This will be refreshed from the message sent from the customer. When the timer is invalid, the POP3 session does not enter the "update" status, but close the TCP connection, and does not delete any messages and do not send any responses to customers. 4. "Confirm" Status For a time TCP connection is opened by POP3, and the POP3 server sends a single line of confirmation. This message can be any character over the CRLF. For example, it can be: S: OK POP3 Server Ready Note: This message is a POP3 response. POP3 servers should give a "determination" response as an acknowledgment. At this point, the POP3 session enters the "confirmation" state. At this point, the customer must prove its identity to the server. In the documentation, two possible processing mechanisms are introduced, one is the user and pass commands, the other is the apop command to be introduced later. Use the user and pass command to confirm the process, the customer must first send the user command, if the POP3 server responds to the "confirm" status code, the customer can send the pass command to complete the confirmation, or send the quit command to terminate the POP3 session. If the POP3 server returns a "failed" status code, the customer can send a confirmation command, or send the quit command. When the customer sends a pass command, the server determines whether to allow access to the corresponding storage email based on the additional information of the user and pass commands. Once the server is determined by these data to allow the customer to access the mail, the server adds a row lock on the message to prevent changes in the mail before entering the "update" state. If the row lock is successfully obtained, the server returns a "confirmation" status code. The session enters the "Operating Status" and does not have any messages to be marked as delete. If a message cannot be opened because some reason can be opened (for example, the lock can not be obtained, the customer cannot access the corresponding message or mail cannot be gramatic analysis), the server will return "failed" status code. After returning the "failed" status code, the server will turn off the connection. If the server does not turn off the connection, the customer can resend the confirmation command, start, or send the quit command. After the server opens the message, it specifies a message number for each message and represents the length of each message with an octave. The first message is specified as 1, and the second message is specified as 2, so that the nth message is specified as N. In the POP3 command and response, the message number and length is represented in decimal. The following is a summary of the above three commands:

Command format parameter limit Response Example User Name Specifies the string of the mailbox, which is critical to the server only after the user and pass command fails or in the "confirmation" status OK: effective mailbox; -ERR: invalid mailbox C: user Mrose S: ​​ OK MROSE IS A REAL HOOPY FROOD ... C: User Frated S: -err sorry, no mailbox for Frated Herepass String Password only in the "confirm" status (because this command has only one parameter Therefore, the space is no longer a separator, and as part of the password OK: mail is ready; -RR invalid password or unable to lock mail C: user mroky s: Ok MROSE IS A REAL HOOPY FROOD C : Pass Secret S: Ok Mrose's Maildrop Has 2 Messages (320 OCTS) ... C: User Mrose S: ​​ Ok Mrose Is A Real Hoopy Frood C: Pass Secret S: -ERR MAILDROP ALREADY LOCKEDQUIT (None) OKC: Quit S: OK DEEY POP3 Server Signing Off5. "Operation" Status Once the customer successfully confirms its own identity to the server, the server will lock and open the corresponding message, and the POP3 session enters the "Operation" state. Now customers can repeat the POP3 command below, and they will return to each command server. Finally, the customer sends a quit command, the session enters the "Update" status.

Here is the command available in the "Operation" state:

Command Parameter Limit Description Response Example Stat is available only in the "operation" state. The server is "confirmed" in response to mail information. To simplify grammar analysis, all servers require a specific format of the mailing list. "Confirm" responds by a space, a space and mail size indicated by an octal representation. This is the minimum implementation, and advanced implementation requires other information. Note: The letters marked as deleted are not here. OK: NN MMC: Stat S: OK 2 320List [MSG] The number of letters (optional), if there is, not including letters marked as deletion. Only available in the "operation" state. If the parameters are given, and the POP3 server returns a "confirmation" including the above information, the line is referred to as "scanning table". If there is no parameters, the server returns "confirm" response, which is given more than many lines. After the initial OK, the server gives the corresponding response for each letter. To simplify the grammatic analysis, all servers require a specific format of the scan table. It includes spaces, the exact size of each message. This is the minimum implementation, and advanced implementation requires other information. Note: The letters marked as deleted are not here. OK: After followed by the table; -ERR: No scan. C: List s: OK 2 Messages (320 OCTES) 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 MaildropRetr MSG does not include the number of letters marked as delete. Only available in the "operation" state. If the server returns "confirm", the response given is multi-line. After the initial OK, the server sends information corresponding to the given information number, pays attention to the byte fill terminator for multi-line responses. OK: The message is after the next; -ERR: There is no message thereafter. C: Retr 1 S: OK 120 OCTS S: s:. De The number of letters marked as delete. Only available in the "operation" state. The server marks this letter as delete, and any other in the future will generate an error. The server does not really delete this letter before the session enters the "Update" state. OK: Letters are deleted; -ERR: Non-this letter. C: DELE 1 S: OK Message 1 Deleted ... C: Dele 2 S: -ERR Message 2 Already DeletedNoop is available only in the "Operation" state. The server returns only "confirm". OKC: Noop S: OkRSET (None) is available only in the "Operation" state. All letters that are marked as deleted, the server returns "confirm". OKC: RSET S: OK MAILDROP HAS 2 Messages (320 characters) 6. "Update" Status When the customer sends the quit command in the "Operation" state, the session enters the "Update" state. (Note: If the customer sends QUIT in the "confirmation" state, the session does not enter the "update" state.)

If the session is interrupted because the quit command is interrupted, the session does not enter the "Update" status, nor does any letters from the server.

Command Parameter Limit Description Response Example Quit (None) The server deletes all the letters marked as deleted, then releases the lock lock and returns the status code of these operations. Finally, the TCP connection was interrupted. OKC: Quit S: OK DEEY POP3 Server Signing Off (Empty Tag Mail) ... C: Quit S: OK DEGEY POP3 Server Signing Off7. Optional POP3 Command

The order discussed above is the minimum implementation of the POP3 service. The optional commands described below allow customers to more easily process letters, which is a relatively general POP3 service implementation.

Command Parameter Limit Description Response Example TOP MSG N is the number of letters that are not marked as delete, and the other is a non-negative number (must be provided) only in the "operation" state. If the server returns "confirm", the response is multi-line. After the initial OK, the server sends a letter head, one space separated the letter header and the letter, and pay attention to the byte fill terminator for multi-line responses. Note: If the number of rows required by the customer is larger than the number of rows in the letters, the server will send the entire letter. OK: There is a letter header; -ERR: There is no similar message thereafter. C: TOP 1 10 S: OK S: s:. ... C: TOP 100 3 S: -ERR No Such MessageUidl [MSG] Number of letters (Optional). If the number of letters is given, the letter marked as deletion is not included. Use only in the "operation" state. If the parameters are given, and the POP3 server returns "confirmation" including the above information, the line is referred to as "independent-ID table". If there is no parameters, the server returns "confirm" response, which is given more than many lines. After the initial OK, the server gives the corresponding response for each letter. This line is called the "independent-ID table" of the letter. To simplify the grammatic analysis, all servers require a specific format of the independent-ID table. It includes independent-ID of spaces and letters. The independent -ID of the letter consists of 0x21 to 0x7e character, which will not be repeated in a given storage message. Note: Letters do not include letters marked as delete. OK: thereafter it is independent-ID table; -ERR: There is no similar letter thereafter. C: UIDL S: OK S: 1 WhixYWZ S: 2 QHDPYR: 00WBW1PH7X7 S:. ... C: UIDL 2 S: OK 2 QHDPYR: 00WBW1PH7X7 ... C: UIDL 3 S: -ERR No Such Message, Only 2 Messages In MaildropapapapoPopApap Name Digest Specifies the string of the mailbox and the MD5 summary string. Use only in the "confirmation" state after POP3 confirmation. Typically, each POP3 session begins with user / pass interchange. This leads to explicit transmission of username and password on the network, which will not cause any danger. However, many customers are often connected to service check letters. Usually the interval is relatively short, which increases the possibility of leakage. Another way to provide a "confirm" process is to use the APOP command. The server that implements the APOP command includes a timestamp confirmed by a tag. For example, using the syntax of the APOP command on UNIX: Process-id.clock@hostname, where the process-ID is the decimal number of the process, the clock is the decimal representation of the system clock, the host name is consistent with the POP3 server name. The client records this timestamp, then to send the apop command. The Name syntax is consistent with the USER command. Digest is a string that includes the timestamp and shared key generated by the MD5 algorithm. This key is a customer and server condominations. You should pay attention to protect this key. If you discise, anyone can enter the server as a user. If the server is connected to the APOP command, it verifies Digest, if correct, the server returns "confirm" and goes to "Operation" status; otherwise, give "failure" and stay in the "confirmation" state. Note: The length of the shared key is increased, and the difficulty of interpretation is also increased accordingly. This key should be a long string. OK: Mail is locked and ready; -ERR: Rejects the request.

S: OK POP3 server ready <1896.697170952@dbc.mtview.ca.us> C: APOP mrose c4c9334bac560ecc979e58001b3e22fb S: OK maildrop has 1 message (369 octets) In this example, the shared key <1896.697170952@dbc.mtview. Ca.us> TanSTAAF is generated by the MD5 algorithm, which produces a Digest value, C4C9334BAC560ECC979E58001BAC560ECC979E58001B3E22FB8. POP3 command summary foundation POP3 command: user name In "confirm" status Valid pass string quit stat to "Operation" status List [MSG] Retr MSG Dele Msg NOOOP RSET Quit In "Update" status Valid optional pop3 command: APOP Name Digest In "Confirm" status Top Msg N In "Operation" status Valid UIDL [MSG] POP3 Response: OK -ERR Note: In addition to STAT Outside the response of List and UIDL, the response of other commands is " OK" and "-err". All text after the response will be ignored by the client. 9. POP3 session example S: C: S: OK pop3 server ready <1896.697170952@dbc.mtview.ca.us> C: APOP MROSE C4C9334BAC560ECC979E58001B3E22FB S: OK MROSE's MAILDROP HAS 2 Messages (320 OCTS) C: Stat S: OK 2 320 C: List S: OK 2 Messages (320 OCTETS) S: 1 120 S: 2 200 s:. C: Retr 1 S: OK 120 OCTS S: S:. C: DELE 1 S: OK Message 1 Deleted C: Retr 2 S: OK 200 OCTS S: S:. C: Dele 2 S: OK Message 2 Deleted C: Quit S: OK DEEY POP3 Server Signing Off (MAildrop Empty) C: S: 10. Message Format The message format in the session is assumed to be with Internet text The message format is consistent. It should be noted that the count is not necessarily the same because each server is different from the processing of the newline. Typically, in the "confirmation" state, the server can calculate the size of the letter in an octave. For example, if the server inside the server identifies a character, the general server is calculated as two characters when calculating it. Note that the message line starting with the terminator is not counted twice, because the customer will delete all bytes filled after receiving multiple lines. 11. Safety Considerations can be speculated that using the APOP command can provide protection during session. Accordingly, the server that implements the pass and apop commands only allows the user to access one way; that is, use the USER / PASS combination, or use the APOP command, it is not possible to use two.

转载请注明原文地址:https://www.9cbs.com/read-3072.html

New Post(0)