📄 rfc937.txt
字号:
Network Working Group M. ButlerRequest for Comments: 937 J. Postel D. Chase J. Goldberger J. K. ReynoldsObsoletes: RFC 918 ISI February 1985 POST OFFICE PROTOCOL - VERSION 2Status of this Memo This RFC suggests a simple method for workstations to dynamically access mail from a mailbox server. This RFC specifies a proposed protocol for the ARPA-Internet community, and requests discussion and suggestions for improvement. This memo is a revision of RFC 918. Distribution of this memo is unlimited.Introduction The intent of the Post Office Protocol Version 2 (POP2) is to allow a user's workstation to access mail from a mailbox server. It is expected that mail will be posted from the workstation to the mailbox server via the Simple Mail Transfer Protocol (SMTP). For further information see RFC-821 [1] and RFC-822 [2]. This protocol assumes a reliable data stream such as provided by TCP or any similar protocol. When TCP is used, the POP2 server listens on port 109 [4].System Model and Philosophy While we view the workstation as an Internet host in the sense that it implements IP, we do not expect the workstation to contain the user's mailbox. We expect the mailbox to be on a server machine. We believe it is important for the mailbox to be on an "always up" machine and that a workstation may be frequently powered down, or otherwise unavailable as an SMTP server. POP2 is designed for an environment of workstations and servers on a low-delay, high-throughput, local networks (such as Ethernets). POP2 may be useful in other environments as well, but if the environment is substantially different, a different division of labor between the client and server may be appropriate, and a different protocol required. Suppose the user's real name is John Smith, the user's machine is called FIDO, and that the mailbox server is called DOG-HOUSE. ThenButler, et. al. [Page 1]RFC 937 February 1985Post Office Protocol we expect the user's mail to be addressed to JSmith@DOG-HOUSE.ARPA (not JSmith@FIDO.ARPA). That is, the destination of the mail is the mailbox on the server machine. The POP2 protocol and the workstation are merely a mechanism for viewing the messages in the mailbox. The user is not tied to any particular workstation for accessing his mail. The workstation does not appear as any part of the mailbox address. This is a very simple protocol. This is not a user interface. We expect that there is a program in the workstation that is friendly to the user. This protocol is not "user friendly". One basic rule of this protocol is "if anything goes wrong close the connection". Another basic rule is to have few options. POP2 does not parse messages in any way. It does not analyze message headers (Date:, From:, To:, Cc:, or Subject:). POP2 simply transmits whole messages from a mailbox server to a client workstation.The Protocol The POP2 protocol is a sequence of commands and replies. The design draws from many previous protocols of the ARPA-Internet community. The server must be listening for a connection. When a connection is opened the server sends a greeting message and waits for commands. When commands are received the server acts on them and responds with replies. The client opens a connection, waits for the greeting, then sends the HELO command with the user name and password arguments to establish authorization to access mailboxes. The server returns the number of messages in the default mailbox. The client may read the default mailbox associated with the user name or may select another mailbox by using the FOLD command. The server returns the number of messages in the mailbox selected. The client begins a message reading transaction with a READ command. The read command may optionally indicate which message number to read, the default is the current message (incremented when a message is read and set to one when a new folder is selected). The server returns the number of characters in the message.Butler, et. al. [Page 2]RFC 937 February 1985Post Office Protocol The client asks for the content of the message to be sent with the RETR command. The server sends the message data. When all the data has been received the client sends an acknowledgment command. This is one of ACKS, ACKD, and NACK. ACKS means "I've received the message successfully and please keep it in the mailbox". ACKD means "I've received the message successfully and please delete it from the mailbox". NACK means "I did not receive the message and please keep it in the mailbox". In the case of ACKS or ACKD the server increments the current message indicator. In the case of NACK the current message indicator stays the same. In all cases the server returns the number of characters in the (now) current message. The client terminates the session with the QUIT command. The server returns an ok.Butler, et. al. [Page 3]RFC 937 February 1985Post Office Protocol The Normal Scenario Client Server ------ ------ Wait for Connection Open Connection --> <-- + POP2 Server Ready Wait for Command HELO Fred Secret --> <-- #13 messages for you Wait for Command READ 13 --> <-- =537 characters in that message Wait for Command RETR --> <-- (send the message data) Wait for Command ACKS --> <-- =0 no more messages Wait for Command QUIT --> <-- + OK Close connection --> <-- Close connection Wait for Connection (go back to start)Conventions Arguments These arguments have system specific definitions. user - A login account name. password - The password for the login account. mailbox - A mailbox name (also called a mail folder).Butler, et. al. [Page 4]RFC 937 February 1985Post Office Protocol Default Mailboxes TOPS-20 MAIL.TXT.1 - from login directory UNIX both /usr/spool/mail/user and /usr/user/Mail/inbox/* where "user" is the user value supplied in the HELO command. End of Line End of Line is Carriage Return (CR) followed by Line Feed (LF). This sequence is indicated by "CRLF" in this document. This end of line convention must be used for commands and replies. Message Length The reply to the READ command or an acknowledgment command (ACKS, ACKD, NACK) is the length (a character count) of the next message to be transmitted. This includes all the characters in the data transmitted. CRLF counts as two characters. A length of zero means the message does not exist or is empty. A request to transmit a message of zero length will result in the server closing the connection. The message is transmitted in the standard internet format described in RFC-822 [2] and NVT-ASCII. This may be different from the storage format and may make computing the message length from the stored message non-trivial. Message Numbers The reply to the HELO and FOLD commands is a count of the number of messages in a the selected mailbox. The READ command has a message number as an optional argument. These numbers are decimal, start at one, and computed with respect to the current mailbox. That is, the first message in a mailbox is message number 1. Numbers All numbers in this memo and protocol are decimal.Butler, et. al. [Page 5]RFC 937 February 1985Post Office Protocol Quoting In a few cases, there may be a need to have a special character in an argument (user, password, or mailbox) that is not allowed by the syntax. For example, a space in a password. To allow for this, a quoting convention is defined. Unfortunately, such quoting conventions "use up" another otherwise uninteresting character. In this protocol the back slash "\" is used as the quote character. To include a space in an argument the two character sequence "back-slash, space" is transmitted. To include a back-slash in an argument the two character sequence "back-slash, back-slash" is transmitted. This quoting convention is used in the command arguments only, it is not used in the mail data transmitted in response to a RETR command. Reply Strings The first character is required to be as specified (i.e., "+", "-", "=", "#"). The optional strings that follow can be whatever the implementer thinks is appropriate.Definitions of Commands and Replies Summary of Commands and Replies Commands Replies -------- ------- HELO user password + OK FOLD mailbox - Error READ [n] #xxx RETR =yyy ACKS ACKD NACK QUITButler, et. al. [Page 6]RFC 937 February 1985Post Office Protocol Commands HELO user password The Hello command identifies the user to the server and carries the password authenticating this user. This information is used by the server to control access to the mailboxes. The Hello command is the "HELO" keyword, followed by the user argument, followed by the password argument, followed by CRLF. Possible responses: "#nnn" where nnn is the number of messages in the default mailbox," "- error report" and Close the connection. FOLD mailbox The Folder command selects another mailbox or mail folder. The server must check that the user is permitted read access to this mailbox. If the mailbox is empty or does not exist, the number of messages reported is zero. The Folder command is the "FOLD" keyword, followed by the mailbox argument, followed by CRLF. Possible responses: "#nnn" where nnn is the number of messages in this mailbox. READ [nnn] The Read command begins a message reading transaction. If the Read command is given without an argument the current message is implied (the current message indicator is incremented by the ACKS or ACKD commands). If an argument is used with the Read command it is the message number to be read, and this command sets the current message indicator to that value. The server returns the count of characters in the message to be transmitted. If there is no message to be read, the count of zero is returned. If the message was previously deleted with the ACKD command, the count of zero is returned. The Read command is followed by the RETR command, the READ command, the FOLD command, or the QUIT command. Do not attempt to RETR aButler, et. al. [Page 7]RFC 937 February 1985Post Office Protocol message of zero characters. The Read command is the "READ" keyword, optionally followed by the message number argument, followed by CRLF. Possible responses: "=ccc" where ccc is the number of characters in this message. RETR The Retrieve command confirms that the client is ready to receive the mail data. It must be followed by an acknowledgment command. The server will close the connection if asked to transmit a message of zero characters (i.e., transmit a non-existent message). The message is transmitted according to the Internet mail format standard RFC-822 [2] in NVT-ASCII. The Retrieve command is the "RETR" keyword, followed by CRLF. Possible responses: the message data Close the connection ACKS The Acknowledge and Save command confirms that the client has received and accepted the message. The ACKS command ends the message reading transaction. The message is kept in the mailbox. The current message indicator is incremented. The server returns the count of characters in the now current message to be transmitted. If there is no message to be read or the message is marked deleted, the count of zero is returned. The Acknowledge and Save command is the "ACKS" keyword, followed by CRLF. Possible responses: "=ccc" where ccc is the number of characters in the next message.Butler, et. al. [Page 8]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -