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: Gu Guofei (GGFEI GGFEI@263.net)
Translation time: 2001-3-30
Copyright: This Chinese translation copyright belongs to China Interactive Publishing Network. Can be used for non-commercial use free reprint, but the translation and copyright information of this document must be retained.
Network Working Group J. Postel
Request for Comments: Draft ISI
Replaces: RFC 788, 780, 772 August 1982
RFC821 Simple Mail Transfer Protocol (SMTP)
(RFC821 Simple Mail Transfer Protocol)
table of Contents
Introduction 2
2. SMTP model 3
3. SMTP process 4
3.1. Mail 4
3.2. Forward 5
3.3. Confirmation and expansion 6
3.4. Send Letters (Mailing) and Get Letters (Sending) 7
3.5. Open and close 7
3.6. Forward 8
3.7. Domain 9
3.8. Change the role 9
4. SMTP Description 9
4.1. SMTP Command 9
4.1.1. Command Syntax 9
4.1.2. Command Grammar Format 13
4.2. SMTP response 15
4.3. Command and Answer Sequence 16
4.4. State Figure 17
4.5. Details 18
4.5.1. Minimum implementation 18
4.5.2. Transparency 19
4.5.3. Size 19
Appendix A TCP Transport Service 19
Appendix B NCP Transport Service 20
Appendix C NITS 20
Appendix D X.25 Transport Service 20
Appendix E Answer Method 20
Appendix F Some Example 22
Reference 36
1 Introduction
The Simple Mail Transfer Protocol (SMTP) is to reliably efficiently transmit mail, which is independent of the transmit subsystem and only one channel that can guarantee the sequence of data units. Appendix A, B, C, and D describes the use of SMTP under different delivery services. The terminology used in this document is also defined in the noun table.
An important feature of SMTP is that it can transfer emails in transmission, and the transfer service provides the process communication environment (IPCE), which can include a network, several networks, or a network of subnets. It is important to understand that the transfer system (or IPCE) is not one-on-one. The process may communicate directly with other processes through known IPCE. The email is an application or inter-process communication. The message can be sent across the network through a process on different IPCEs. More particularly, the message can be transmitted through host Press in different networks.
2. SMTP model
The SMTP design is based on the following communication model: Send SMTP to establish a bidirectional transfer channel between the SMTP establishment and the receiving SMTP for the user's mail request. The receiving SMTP can be the final recipient or an intermediate transmitter. The SMTP command is sent by the sending SMTP, and the response is received, and the response is transmitted.
Once the transfer channel is established, the SMTP sender sends a mail command to indicate the mail sender. If the SMTP recipient can receive an email, returns the OK answer. SMTP sender issues the RCPT command to confirm if the message is received. If the SMTP recipient is received, the OK response is returned; if you cannot receive it, you will issue a rejection receiving answer (but do not abort the entire mail operation), both parties will repeat multiple times. When the recipient receives all the emails, the special sequence will be received. If the recipient successfully processes the message, the OK response is returned. SMTP provides a mechanism for transferring mail. If the receiver is connected to the sender connection, the message can be transferred directly from the sender host to the receiver host; or when the two are not under the same transfer service, Follow the SMTP server. In order to be able to provide relay power for the SMTP server, it must have the final destination host address and mailbox name.
The mail command parameter is the reply path. It specifies where the message is coming; and the parameter of the RCPT command is the forwarding path. It specifies where the message is deserved. The forward path is the source path, and the reply path is the return path (which is used to return mail when an error occurs).
When the same message is to be sent to different recipients, SMTP encounters a problem with a replica that sends the same copy to different recipients. There is a quicker syntax, and there is a digital code. In the following, what can be seen in the examples using the actual commands and answers. Complete commands and responses in Section 4.
Commands and response to case sensitive, that is, commands and responses can be uppercase, lowercase or mix of both, but this is not necessarily pair for user email name, because some hosts are case sensitive It is sensitive. In this way, the SMTP implementation retains the user's mailbox name to the initial sample, and the host name is not sensitive to case.
Command and response consist of an ASCII alphabet that when the transfer service provides an 8-bit byte delivery channel, each 7-bit character is transmitted correctly, and the highest bit is filled with 0. When the general command or answering format is specified, the parameters are represented by some strings similar to the language, such as "
3. SMTP process
This section provides some processes in SMTP. One illustrates the basic transmission process (defined as a transmission operation). Down describe the forward mail, confirm the mailbox name and extended mailing list, send it to the terminal and turn off. At the end of this section, an explanation of the interruption and mail field. Examples of this section are only part of the commands and responses, and the complete example see Appendix F.
3.1. Mail
There are three steps in the SMTP send operation, and the operation is started by the mail command to give the sender ID. A series of RCPT commands followed, and the recipient information is given, then the DATA command lists the sending message content, and the last message content indicator confirms the operation.
The first step in the process is the mail command,
Mail
This command tells the recipient's new sending operation that has started, please reset all status tables and buffers. It gives the reverse path to return the error message. If the request is received, the recipient returns a 250 OK answer. The mailbox is more than reflected in
The second step in the process is to send the RCPT command.
RCPT
This command gives a forward path identifier recipient. If the command is received, the recipient returns a 250 ok response and stores a forward path. If the recipient is unknown, the recipient returns a 550 Failure response. This process may repeat several times.
Data
If the command is received, the recipient returns a 354 Intermediate response and determines that the following lines are the contents of the letters. When the letter ends and stores, the recipient sends a 250 OK response. Since the message is sent on the transfer channel, you must indicate the end of the message content so that the response dialog can be restarted. SMTP indicates the end of the message content by transmitting only one period in the last line, in the receiver, a transparent process of the user, is filtered out to not affect normal data.
Note: The email includes the following tips: Date, Subject, To, CC, from.
The mail content indicator confirms the email operation and informs the recipient to store and send data. If this command is received, the recipient returns a 250 ok answer. The DATA command fails only if the mail operation is not completed or the source is invalid.
The process described above is a transmission operation. These commands can only be used in the order above. The following example shows the use of these commands in a transmission operation.
SMTP Process Example This example is Jones, Green and Brown, sent mail to the Beta.arpa host's SMIS, Green, and Brown, where host Alpha is directly connected to host Beta.
S: Mail from:
R: 250 ok
S: RCPT TO:
R: 250 ok
S: rcpt to:
R: 550 No Such User Here
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc
S:
R: 250 ok
This letter is received by the first two, and the third person has no mailbox on this host.
3.2. Forward
Here are some of the destination addresses in
251: The user is not locally; will be sent forward to
This response means that the recipient SMTP knows the user's mailbox on another host, and it means that the correct steering path will be used in the future. Please note that hosts or users, or both are different. The recipient is responsible for transmitting the message.
551: User is non-local, please try
This response means receiving SMTP knowing the user's mailbox on another host and means using the correct forwarding path. Note Please note that hosts or users, or both are different. The recipient refuses to receive the user's letters, and the sender must re-transmit according to the information provided or returned to the original sender back an error message. The following example shows the application of these responses.
Forward example
S: RCPT TO:
R: 251 User Not Local; Will Forward To
S: rcpt to:
R: 551 User Not Local; please try
3.3. Confirmation and expansion
SMTP provides additional functions for confirming user names and expansion mailing lists. These functions are done by the VREF and EXPN commands, which are parameters with strings. For the VREF command, the string parameter refers to the username, the response to this command to include the user's naming and user mailbox. For the EXPN command, the string parameter refers to a mailing list, more than one response to this command, which includes the user's naming and their mailboxes in all lists.
"User Name" is a redundant project, it is intentionally plus. If the host uses the VREF command and the eXPN command, the last local mailbox must provide the user name to confirm it by the host. Allowable if the host selects a user name by another string as a username.
In some hosts, the email list and the name of a mailbox are unclear because the general data structure may include two types of portals. If you want to issue a confirmation of the mailing list, you should give a determination response. After receiving this message, the host will transfer the message to all the addresses on the list. If you do not receive a determination response, an error will be reported. For example, "550 That IS A Mail List, Not a User Name". If the request is used to extend a username, it is possible to form a determination response by returning a list that includes a name, and if no determination response is received, an error is reported. (For example, "550 That IS A User Name, Not a Mailing List").
In the case of multiple responses (usually for EXPN), each response specifies a mailbox. In the case of a fuzzy request, for example, "VRFY Smith", the response of the two Smith here must be "553 user ambiguous".
Confirm that the username is as shown in the following example: Example 3:
Confirm user name
S: VRFY Smith R: 250 Fred Smith
or
S: VRFY Smith
R: 251 User Not Local; Will Forward To
or
S: VRFY Jones
R: 550 string does not match anything.
or
S: VRFY Jones
R: 551 User Not Local; please try
or
S: VRFY GourzenkyInPlatz
R: 553 User Ambiguous.
The mailbox list requires a number of responses as shown in the following example:
S: EXPN EXAMPLE-PEOPLE
R: 250-Jon Postel
R: 250-Fred Fonebone
R: 250-Sam Q. Smith
R: 250-Quincy Smith <@ USC-ISIF.ARPA: Q-SMITH@isi-vaxa.arpa>
R: 250-
or
S: EXPN EXECUTIVE-WASHROOM-LIST
R: 550 Access Denied to you.
The string command parameters of the VERF and EXPN commands cannot be limited by the specific implementation. On some systems, the parameters of the EXPN command may be a file name containing the mailing list, but there are many different file structures on the Internet.
The VRFY and EXPN commands do not include the minimum implementation that they do not require inter-transmission between the transmitting when they are implemented.
3.4. Send Letters (Mailing) and Get Letters (Sending)
The main purpose of SMTP is to send mail to the user's mailbox. Similar functions provided by some hosts are to send emails to the user's terminal (if the user is turning on the terminal). Send a message to the user's mailbox, called a transmission letter; and send it to the user terminal called a letter. Because in some hosts, the implementation of both is very similar, so they are also placed in SMTP. However, obtaining the letter command is not in the minimum implementation of SMTP. Users should have the ability to control to write information to the terminal. Most hosts allow users to accept or reject similar information.
The following three commands are defined to support access. They are used for email commands instead of mail commands, indicating the special meaning of receiving this operation of SMTP:
Send
The Send command requires mail content to be transmitted directly to the user terminal. If the user does not turn on the terminal (or does not receive terminal information), the 450 response will return an RCPT command. This operation is successful if the information is successfully sent.
SOML
The Send or Mail command requests the message to send the message to the user's terminal (if the user is on the terminal). If the user is not in the terminal, the message content directly into the mailbox. If the message is sent to the user terminal or user mailbox, the transmission operation is successful.
SAML
The send and mail commands require mail content to be sent directly to the user terminal (if the user is on the terminal). Anyway, letters will enter the mailbox. If the letter enters the mailbox, the send operation is successful.
The response of the mail command is the same as those of these commands.
3.5. Open and close
When the transfer channel is turned on, some information is to be exchanged to determine the identity of both parties. The following command is used to open and close:
Helo
Quit
In the Hello command, the host sends a command yourself, this command can be interpreted as: "Hello, I am XX".
Open the connection
R: 220 BBN-Unix.Arpa Simple Mail Transfer Service Ready
S: Helo USC-ISIF.ARPA
R: 250 BBN-Unix.Arpa
Close up of coupling example
S: quit
R: 221 BBN-Unix.Arpa Service Closing Transmission Channel
3.6. Forward
The forwarding path may be the following format: "@ one, @ two: joe @ tree", here, One, Two and Three are hosts. This format is used to emphasize the difference between addresses and paths. The mailbox is absolute address and the path is about how to arrive. These two concepts should not be confused. Conceptually, the element of the forwarding path is moved to the reply path as information from an SMTP server to another SMTP server. The reply path is a reverse data source path, such as from the location of the current information to the position of the initiator. When an SMTP server removes its own tag from the forwarding path and insert it into the reply path, it must use the name it can understand to prevent its name to prevent its name in a different environment is understood to be different. first name.
This element is not deleted from the forwarding path when the first element of the forwarding path of the SMTP is not the SMTP tag, which is used to determine the SMTP server that the next should be sent. In any case, SMTP adds its own tag into the reverse path.
When using the source path, receive SMTP receive forwarding messages and send it to another receiving SMTP server. The receiving server can accept or refuse to forward the local user's mail. Receive SMTP changes command parameters by moving its own tag from the beginning of the forwarding path to the response path. At this time, the receiving SMTP becomes the transmission SMTP, and the channel of the SMTP in the next forwarding path is established, and then it sends an email to this SMTP.
One host on the reply path should be a host that sends the SMTP command, and the first host on the forwarding path should be a host that receives the SMTP command.
Note: The forwarding path and reply path appear in the SMTP command and a response, but do not have to appear in the information. That is, there is no path in this form to "TO:", "from:", "from:", and "CC:", etc. in this path.
If the SMTP server accepts forwarding tasks, but later it finds that the forward path is incorrect or other principles cannot send mail, it must establish a "undeliverable mail" signal, send it to the letter to this letter.
This signal must be issued from the SMTP service of this host. Of course, this server should not report an error in error information. A condition that blocks this error report cycle is to set it on the reply path of the signal's mail command. When this information is transferred, the reply path is allowed to be empty. The reply path after a mail command is empty as the following form:
Mail from: <>
The unpalatable message information is displayed in the following example. This information is a response to the message issued from Joe on HostW, which is in Hostx needs to respond when Hostz reaches Hosty. The example we see is between Hostx and Hosty.
Examples of unable to transfer mail messages
S: Mail from: <>
R: 250 ok
S: rcpt to: <@ hostx.arpa :joe@hostw.arpa>
R: 250 ok
S: Data
R: 354 Send the mail data, end with.
S: date: 23 Oct 81 11:22:33
S: from: smtp@hosty.arpa
S: TO: Joe@hostw.arpa
S: Subject: Mail System PROBLEM
S:
S: sorry Joe, Your message to sam@hostz.arpa lost.
Hostz.arpa said this:
S: "550 no such user"
S:.
R: 250 ok
3.7. Domain
The domain is recently introduced into the ARPA Internet mail system. The domain can make the address space from a plane normal string host name into a hierarchy of the global address. The host is replaced by a domain name, and the starter consists of a series of paracels, which are arranged in the most special order by a comma. For example, "USC-ISIF.ARPA", "Fred.cambridge.uk" and "PC7.lcs.mit.arpa" may be a host-domain identifier.
Regardless of how the domain name is used in SMTP, only formal names can be used, and a pseudonym or nickname cannot be used.
3.8. Change the role
The TURN command can be used to change the role of the program that communicates on the transport channel. If the program A is now sending SMTP, it sends a TURN command and receives the OK answer (250), it will turn the SMTP. Similarly, the program B can also become SMTP from the receiving SMTP. To refuse to change the role, the recipient can send 502 as a response.
Note: This command is optional. This command is generally not used when the transfer channel of the TCP is used. However, this command is useful when the cost of establishing a transmission channel is relatively large. For example, this command can support a general public switched telephone system as a transmission channel.
4. SMTP description
4.1. SMTP command
4.1.1. Command Syntax
The SMTP command defines a message transfer or system feature defined by the user. Its command is a string ended by
Sending an email operation involves different data objects, which are connected to each other by different parameters. The reply path is the parameter of the mail command, and the forwarding path is the parameter of the RCPT command, and the email date is the parameter of the data command. These parameters or data objects must follow the command. This model also requires different buffers to store these objects, that is, there is a reply path buffer, a forwarding path buffer, a mail content buffer. The specific command produces its own buffer or makes one or more buffers to be cleared.
Hello (Helo)
This command is used to confirm the send SMTP to the received SMTP. The parameter domain includes host names that send SMTP. Receive SMTP to confirm the receiving SMTP to the send SMTP by the connection confirmation command. The talent order and the OK response confirmed that the transmission and reception of SMTP entered the initial state, that is, no operation is being executed, all state tables and buffers have been removed.
Mail (Mail)
This command is used to start sending messages into a plurality of mailboxes. The parameter domain includes a reply path. An optional host and sender mailbox list is included in the return path. When there is a list of hosts, it is a reply path source, which indicates that this mailbox is transmitted by the host in the table (the first host is the last host that receives this message). This table also has a source path to the sender returns a non-transfer signal. Because each delivery host address is added at this table, it must use the send IPCE instead of receiving IPCE (if they are not an IPCE) clear name. The reply path of some error messages may be empty.
This command clears the reply path buffer, forward the path buffer, and the mail content buffer, and inserts the reply path information of this command into the reply path buffer.
Recipient (RCPT)
This command is used to determine the unique recipient of the message content; multiple recipients will be specified by multiple this command. An optional host and a must-purpose mailbox are included in the forwarding path. When a list of host appears, this is a source path, which indicates that the message must be sent to the previous host in the list. If the delivery transmission of the SMTP does not implement the message is received, information such as unknown local users (550) is returned to the user.
When the message is transmitted, the delivery host must put its name by the beginning of the forwarding path to the end of the response path. When the message finally reaches the destination, the receiving SMTP will insert the target email with its host mail format. For example, when the mail received by the transfer host A, from:
TO: <@ Hosta.arpa, @ hostb.arpa: userc@hostd.arpa>
It will become as follows:
From: <@ hosta.arpa:Userx@hosty.arpa>
To: <@ hostb.arpa:userc@hostd.arpa>.
This command causes its forwarding path parameters to join the forwarding path buffer.
Data (DATA)
The recipient will follow the line after the command as the message content. This command causes the mail content after this command to join the mail content buffer. The email content can include all 128 ASCII code characters. The message content is ended by only a row of a period, that is, the following character sequence: "
The end of the email indication requires the recipient to process saved mail content. This process will reply to the path buffer, the contents of the forwarding path buffer, and the mail content buffer are all emptied. If the operation is successful, the recipient must return to the OK response; if the failure must return a failed answer.
When receiving SMTP receives a message, whether it is used as a forward or this message has arrived at the destination, it must add timestamp at the beginning of the message content, this line indicates that the mail host and the message is issued. The logo of the host, and the time and date of receiving the message content. The forwarded letters will have multiple lines such a timestamp. When receiving the transmission of the SMTP for the last stop, it will return the path information row into the message. This line includes information of
Mailboxes may be inconsistent with the mailboxes in the return path, this situation may occur in need to transfer a specific error handling mailbox instead of the sender sender. In the above, the final mail content is row row, and is composed of one or more timestamp of the subsequent one or more time. These lines are the head and body information of the message content.
A specific description is required when the processing behind the mail data indication is successful. This situation may occur in transmitting SMTP discovery When the message needs to be transmitted to multiple users, only some of them can be successfully transmitted in this case. In this case, the DATA command must be sent to the OK response, and the SMTP organization must receive the SMTP organization and send a "unpaid mail" message to the sender of the information. In this information or a list of unsuccessful recipients, or each time you send a receiver, while sending multiple times. All unbaid mail messages are sent by the mail command.
Return path and receive timestamp example
Return-path: <@ ghi.arpa, @ def.arpa, @ abc.arpa: joe@abc.arpa>
Received: from ghi.arpa by jkl.arpa; 27 oct 81 15:27:39 PST
Received: from def.arpa by ghi.arpa; 27 oct 81 15:15:13 PST
Received: from abc.arpa by Def.arpa; 27 Oct 81 15:01:59 PST
Date: 27 oct 81 15:01:01 PST
From: joe@abc.arpa
Subject: Improved Mailing System Installed
TO: Sam@jkl.arpathis is to inform you That ...
Send (Send)
This command is used to start a send command to send mail to one or more terminals. The parameter domain includes a reply path, and this command is sent to the terminal if successful.
The reply path includes an optional host list and sender mailbox. When a host list appears, indicating this is a transfer path, the message is sent to each host on this path (the first host on the list is the last hand). This table is used to return non-transfer signals to the sender. Because each delivery host address is added at this table, it must use the send IPCE instead of receiving IPCE (if they are not an IPCE) clear name. The reply path of some error messages may be empty.
This command clears the reply path buffer, forward the path buffer, and the mail content buffer, and inserts the reply path information of this command into the reply path buffer.
Send or Mail (SOML)
This command is used to start a mail operation to transfer the message content to one or more terminals, or transferred to the mailbox. For each recipient, if the recipient terminal is opened, the mail content will be transferred to the recipient's terminal, otherwise it is sent to the recipient's mailbox. The parameter domain includes a reply path, which is successful if the information is successfully sent to the terminal or mailbox.
The reply path includes an optional host list and sender mailbox. When a host list appears, indicating this is a transfer path, the message is sent to each host on this path (the first host on the list is the last hand). This table is used to return non-transfer signals to the sender. Because each delivery host address is added at this table, it must use the send IPCE instead of receiving IPCE (if they are not an IPCE) clear name. The reply path of some error messages may be empty.
This command clears the reply path buffer, forward the path buffer, and the mail content buffer, and inserts the reply path information of this command into the reply path buffer.
Send And Mail (SAML)
This command is used to start a mail action to transfer the message content to one or more terminals and transmit it to the mailbox. If the recipient terminal is opened, the message content will be transferred to the recipient's terminal and the receiver's mailbox. The parameter domain includes the reply path, and if the information is successfully sent to the mailbox, this command is successful.
The reply path includes an optional host list and sender mailbox. When a host list appears, indicating this is a transfer path, the message is sent to each host on this path (the first host on the list is the last hand). This table is used to return non-transfer signals to the sender. Because each delivery host address is added at this table, it must use the send IPCE instead of receiving IPCE (if they are not an IPCE) clear name. The reply path of some error messages may be empty.
This command clears the reply path buffer, forward the path buffer, and the mail content buffer, and inserts the reply path information of this command into the reply path buffer.
RESET (RSET)
This command indicates that the mail will be given. Any saved sender, recipient, and mail content should be discarded, all buffers and status tables should be cleared, and the recipient must return to the OK response.
Verify (VRFY)
This command requires the recipient to confirm the parameter is a user. If this is (already known) user name, return to the user's full name and the specified mailbox. This command does not affect the reply path buffer, forwarding path buffers, and mail content buffers.
Expand (EXPN)
This command requested the recipient to confirm the parameter specified a message sent a list. If it is a mail sends a list, return to the member in the table. If this is (already known) user name, return to the user's full name and the specified mailbox. This command does not affect the reply path buffer, forwarding path buffers, and mail content buffers. Help (Help)
This command causes the recipient to send help information to the sender of the HELP command. This command can take parameters and return to specific information as a response. This command does not affect the reply path buffer, forwarding path buffers, and mail content buffers.
NOOP (noop)
This command does not affect any parameters and commands already issued. It simply shows that there is no operation instead of that the recipient sends an OK response. This command does not affect the reply path buffer, forwarding path buffers, and mail content buffers.
Quit (quit)
This command indicates that the recipient must send an OK answer and close the transfer channel. The recipient should not turn off the communication channel before receiving the quit command and respond. The sender should not turn off the channel before sending a quit command and receiving a response. Even if an error, the channel should not be closed. If the connection is closed in advance, the recipient should cancel all waiting operations like the RSET command, but does not restore the originally done operation. The sender should assume that commands and operations are still supported like they receive temporary error (4xx).
Turn (TURN)
This command specifies that the recipient either sends an OK answer and changing the role to send SMTP, or send a rejection information and maintain its own role. If the program A is now sent SMTP, it issues the TURN command to receive the OK (250) response, which turns into the receiving SMTP. Program A enters the initial state, as if the communication channel is just open, then it sends 220 to prepare the service signal. If the program B is now receiving SMTP, it issues a TURN command to receive an OK (250) response, which becomes the send SMTP. Program A enters the initial state, as if the communication channel is just open, then it is ready to receive 220 to prepare the service signal.
To refuse to change the role, the recipient can send 502 answers.
There is a certain limit for the order of these commands. The first command of the conversation must be a hello command, which can be used in the session thereafter. If the parameter of the hello command is unacceptable, it must be replicated by returning a 501 failed, and the received SMTP must remain in a state of just consistent. NOOP, HELP, EXPN, and VRFY commands can be used at any time at any time. Mail, Send, SOML or SAML command starts a mail operation. Once started, you will send RCPT and DATA commands. Mail operation can be terminated by the RSET command. There may be one or more operations in a session.
If the operation start parameter is unacceptable, 501 failed response must be returned, and the received SMTP must remain in a state in which it is just consistent. If the command order in the operation is wrong, 503 failed answers must be returned, and the received SMTP must be kept in a state in which it is just consistent.
The last command of the session must be a quit command. This command cannot be used at other times of the session.
4.1.2. Command Grammar Format
The command consists of the command code and the subsequent parameter domain. The command code is four letters, and the case is not different. Since the role of the following command:
Mail Mail Mail Mail Mail Mail
This is also applicable for tags that boot any parameter values, such as TO and TO are the same. The command code and parameters are separated by one or more spaces. However, parameters in the reply path and forwarding path are case sensitive. Especially on some hosts, "smith" and "smith" are not a user.
The parameter domain consists of unregulated strings, which is ended by
RCPT
Data
RSET
Send
SOML
SAML
VRFY
Expn
Help [
NOOP
Quit
TURN
The format of the above parameter domain is given below the format of the BNF, "..." represents a repetition of one or more times for one domain.
: = All A-Z 52 case English letters
:: = Do not include
Note: "/" is a lighting character that represents the same meaning in its subsequent characters. For example, "Joe /, Smith" is used to indicate a single user name separated by a comma. The host is usually represented by the name of the transformation to the address. Note: The name element of the domain is a formal name and cannot use nickname or a pseudonym.
Sometimes the transition mechanism of the name may not know the host, which causes the block of communication. In order to solve this problem, two methods can be taken: one method is to add a decimal number after "#" to represent the host address; another method is to add 32-bit IP addresses, the IP address form is The number of decimal numbers separated from 0-255. The format of the timestamp line and the return path row is usually defined below:
<分> :: = 6 minutes per hour 0-59
Return path example
Return-path: <@ charlie.arpa, @ Baker.Arpa: joe@able.arpa>
Timestam example
RECEIVED: from abc.arpa by xyz.arpa; 22 Oct 81 09:23:59 PDT
Received: from abc.arpa by xyz.arpa via Telenet with x25
ID M12345 for smith@pdq.arpa; 22 Oct 81 09:23:59 PDT
4.2. SMTP response
The response to the SMTP command is diverse, it determines synchronization of requests and processing during mail transmission, and ensures that the transmission SMTP knows the status of receiving SMTP. Each command must have only one response.
The SMTP response consists of three digits, followed by text. The number help determines the next state that should be entered, and the text is meaningful to people. The three response already includes enough information, no need to read the text, the text can directly abandon or pass to the user. In particular, the text is related to the reception and environment, so the text received each time may be different. All of the response codes can be seen in Appendix E. Regular cases, the response consists of the following sequence: three digits,
501 parameter format error
502 commands are not implemented
503 Error command sequence
504 Command parameters are not implemented
211 System status or system help response
214 Help Information
220
221
421
250 required mail operations
251 users are non-local, will forward to
450 The required mail operation is not completed, the mailbox is unavailable (for example, mailbox busy)
550 The required mail operation is not completed, the mailbox is unavailable (for example, the mailbox is not found, or if you are not accessible)
451 Abandon the requirements of the requirements;
551 users are non-local, please try
452 system storage is insufficient, the required operation is not performed
552 excess storage allocation, the required operation is not performed
553 mailbox name is unavailable, the required operation is not executed (such as mailbox format errors)
354 Start the mail input, end with
554 operation failed
4.3. Command and Answer Sequence
Communication between the sender and the recipient is an alternating dialogue form, controlled by the sender. In this way, send a command, and the recipient issues a response. The recipient must wait for the next instruction. An important response is a connection response. When the connection is completed, the recipient usually sends 220 "service ready". The sender will wait here before continuing to send an instruction. Note: Each connection response must have a formal name of the service host as the first part, followed by the response code. E.g:
220
The following is listed below, which must be observed in strict order, and the recipient can ignore the text in response, but the meaning and operation and command response sequence specified by the number cannot be changed. Command Response Sequence:
Each command lists it possible response. Using the prefix "P" prefix "P" indicates that the preparation (not used in SMTP), "I" means that "S" means success, "f" means fail, "e" means an error. If the STMP recipient must turn off the channel, you can make 421 (service unavailable, shut down) response to any command. This table is based on the state map to be described below:
Connection Establishment (establishing connection) S: 220
F: 421
Helo
S: 250
E: 500, 501, 504, 421
S: 250
F: 552, 451, 452
E: 500, 501, 421
RCPT S: 250, 251 F: 550, 551, 552, 553, 450, 451, 452 E: 500, 501, 503, 421
Data
I: 354 -> Data -> S: 250
F: 552, 554, 451, 452
F: 451, 554
E: 500, 501, 503, 421
Rset
S: 250
E: 500, 501, 504, 421
Send
S: 250
F: 552, 451, 452
E: 500, 501, 502, 421
SOML
S: 250
F: 552, 451, 452
E: 500, 501, 502, 421
Saml
S: 250
F: 552, 451, 452
E: 500, 501, 502, 421
VRFY
S: 250, 251
F: 550, 551, 553
E: 500, 501, 502, 504, 421
EXPN
S: 250
F: 550
E: 500, 501, 502, 504, 421
Help
S: 211, 214
E: 500, 501, 502, 504, 421
NOOP
S: 250
E: 500, 421
Quit
S: 221
E: 500
Turn
S: 250
F: 502
E: 500, 503
4.4. State map
The following state diagram is a simple SMTP implementation, each set of commands have a state diagram. In the figure, only the first digit of the response code is used as a representative of the response. The command group is set to each command and then set the command in structure mode. There are three possible answers to each command: success (s), fail (F), and error (E). In the state, we start using the B representative, use W to wait for a response.
This status is used as follows: Helo, Mail, RCPT, RSET, Send, SOML, SAML, VRFY, EXPN, HELP, NOOP, Quit, Turn.
Here is a more complex state diagram for the data command:
Note: The message content here is multi-line, and the recipient can only send an answer when the last line can be received.
4.5. Details
4.5.1. Minimum implementation
In order for SMTP to work, this is the minimum command that should be implemented for the recipient:
Commands - Helo
RCPT
Data
Rset
NOOP
Quit
4.5.2. Transparency
There is no guarantee for data transparency, and errors occur when sending similar "
1. In the sending email, send SMTP must check each line of the message. If it is a period, you will add a number in the lead.
2. When the message is received, the received SMTP must check each line of the message. If there is only one period, the email ends, if there are two groups in a row, then there should be only one sentence in this line, and will The first end is deleted.
The mail content transmitted can include all 128 ASCII characters. All characters are sent to the mailbox of the closer, including format symbols and other control characters. If the transport channel provides an 8-bit data stream, the 7-bit ASCII code can be transmitted therein, and the highest position is 0. Some systems need to be formatted to data when receiving and storing. The mainframe for hosts that can only be stored in a recorded form or cannot be converted in the form of a host or not in the form of the ASCII character set. 4.5.3. Size
Some objects require maximum and minimum size. That is, each implementation must be able to receive an object greater than the minimum size, and cannot send a target greater than the maximum size. There is no restriction in the implementation technology for possible maximum size.
The maximum length of the user user name is 64 bytes.
The maximum length of the domain domain is 64 characters
The maximum length of the path response path and the forwarding path is 256 characters.
The maximum length of the command line command line, including the carriage return 512 characters
The maximum length of the answer should answer, including the return of 512 characters
The maximum length of the text line of text, including the return of the carriage, and the result of increasing the transparency must not exceed 1000 characters
The receive buffer receive buffer can accommodate up to 100 recipients
If an error, the answer is as follows:
500 lines
Too much path 501
Too much receiver 552
552 email content
Appendix A TCP Transport Service
Transmission Control Protocol (TCP) is used in ARPA Internet and complies with the US DOD standard for the network protocol. The SMTP Transport Channel connection is built on port U and the port L of the receiving process. A single full-duplex system is used for transmission. The service port specified for this protocol is 25, that is, L = 25. TCP connection supports transmission of 8-bit bytes, while SMTP only needs to transmit 7 bits; thus, the highest bit of each 8-bit character is set to zero.
Appendix B NCP Transport Service
ArpaNet Host - Host Protocol (implemented by network control) can also be used in Arpanet. The SMTP Transport Channel connection is built on port U and the port L of the receiving process; thereafter, a pair of simple connections are established according to the initial connection protocol (ICP). This pair of simple connections are used as transport channels. This protocol is designated as a connecting socket 25, that is, L = 25. NCP connection supports transmission of 8-bit bytes, while SMTP only needs to transmit 7 bits; thus, the highest bit of each 8-bit character is set to 0.
Appendix C NITS
You can also use a network independent transfer service. The transmission channel is established between the NITS in the transmission process and the reception process. The send process executes the primitive primitive and then waits for acceptance of Accept primitives. NITS connection supports transmission of 8-bit bytes, while SMTP only needs to transmit 7 bits; thus, the highest bit of each 8-bit character is set to 0.
Appendix D X.25 Transport Service
The X.25 service received directly directly using the public data network, however, it is recommended to use a reliable end-to-end protocol such as TCP.
Appendix E response code composition
The three responses have a specific meaning. Each response indicates whether it is successful, failed or not completed. Through this bit, the untruritable SMTP will determine the next step, if the sender wants to know what problems, it can detect the second bit, and the third bit saves the last more complete information. That is, from the first bit to the third bit, the recipient can accurately determine the state of the receiver than one step. There are five possible representation of the first one to represent different meaning:
1YZ part completion response
The command is accepted, but the required operation is aborted, and the reason is in the reply code. The sender should send another command to indicate whether to continue, or abandon the operation.
2YZ full completion response
The required operation has been completed, and another new request can be started.
3YZ requires a part of the completion of the completion of the completion of the completion of the response command, but the required operation is aborted, and further information is required. The sender should send another command to indicate further information.
4YZ is temporarily unfinished
The command is not accepted, and the required operation has not been executed, but the status of the error occurs is temporary, and the operation can be requested again. The sender should return the start command of the command sequence (if any). It is difficult to explain this temporary meaning, especially for two different sites. The difference is that the method is a few or the next type of method:
5YZ permanently unfinished response
The command is not accepted, and the required operation is not completed. The repetition of the command does not work. Even if some error conditions have changed, the user has no need to try again, and it is desirable to operate again in the future.
The second sense of the response has the following categories:
X0z Syntax: This type of response is for the following: syntax errors; in compliance with syntax but there is no function; unfinished or redundant commands.
X1Z information: This type of response is used to request information, such as status, or help information.
X2Z connection: This type of response is about the transmission channel.
X3z is not used.
X4z is not used.
X5Z Mail System: This type of response indicates the status of the recipient mail system for request transmission or other operation.
The third one gives a more detailed description. The listed response illustrates this. The text response is recommended, rather than necessarily, which can vary depending on the situation. On the other hand, the responses must be strictly followed by this section. The recipient should not create a new code because of a slightly different cases without using the already defined code. For example, if the NOOP command is case, if it is successfully executed, no new information is returned, only the 250 response is returned. When the transmitted command requires an unforgettable site specified, the response should be 502. The answer text may be more than one line; in this case, the text must be marked, and the part of the receiving text is not read less than a line of data. This requires a specific format to explain multiple lines. This format is: Each line, in addition to the last line, add a "-" starting with the answer size. The last line begins with the answer to the answer code. Such examples:
123-first line
123-Second Line
123-234 Text Beginning with Numbers
123 The last line
Normally, one of the received words can only be used to find the answer to the number of spaces, and ignore the contents of the previous row. In special cases, the sender must know the content of the response text. At this time, the received response can be correctly determined by the case where the text is needed to know the text.
Appendix F Some examples
This section provides a complete example of some SMTP sessions.
Typical SMTP operation
This type of display is sent by SMITH on USC-ISIF and SMIS, Green, and Brown on the BBN-UNIX host. Here, we assume that the USC-ISIF host is directly connected to the BBN-UNIX host. Jones and Brown receive mail, while Green has no email on BBN-UNIX.
R: 220 BBN-Unix.Arpa Simple Mail Transfer Service Ready
S: Helo USC-ISIF.ARPA
R: 250 BBN-Unix.Arpa
S: Mail from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: rcpt to:
R: 550 No Such User Here
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 BBN-Unix.Arpa Service Closing Transmission Channel
Abandon SMTP operation
R: 220 mit-multics.Arpa Simple Mail Transfer Service Ready
S: Helo ISI-VAXA.ARPA R: 250 mit-multics.Arpa
S: Mail from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: rcpt to:
R: 550 No Such User Here
S: Rset
R: 250 ok
S: quit
R: 221 Mit-multics.Arpa Service Closing Transmission Channel
forward mail
Step 1: Source hosts to forwarding hosts
R: 220 USC-ISIE.ARPA SIMPLE MAIL TRANSFER Service Ready
Helo mit-ai.arpa
R: 250 USC-ISIE.ARPA
S: Mail from:
R: 250 ok
S: RCPT TO: <@ USC-isie.arpa:jones@bbn-vax.arpa>
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Date: 2 nov 81 22:33:44
S: from: john q. public
S: Subject: The next meetings of the board
S: TO: Jones@bbn-vax.arpa
S:
S: Bill:
S: The next meetings of the board of directors Will Be
S: on Tuesday.
S: John.
S:.
R: 250 ok
S: quit
R: 221 USC-ISIE.ARPA Service Closing Transmission Channel
Step 2: Forwarding the host to the destination host
R: 220 BBN-vax.Arpa Simple Mail Transfer Service Ready
S: Helo USC-ISIE.ARPA
R: 250 bbn-vax.arpa
S: mail from: <@ USC-isie.Arpa :jqp@mit-ai.arpa>
R: 250 ok
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: RECEIVED: from mit-ai.arpa by usc-isie.arpa;
2 Nov 81 22:40:10 Uts: date: 2 nov 81 22:33:44
S: from: john q. public
S: Subject: The next meetings of the board
S: TO: Jones@bbn-vax.arpa
S:
S: Bill:
S: The next meetings of the board of directors Will Be
S: on Tuesday.
S: John.
S:.
R: 250 ok
S: quit
R: 221 USC-ISIE.ARPA Service Closing Transmission Channel
Confirmation and send
R: 220 Su-Score.arpa Simple Mail Transfer Service Ready
Helo mit-mc.arpa
R: 250 Su-Score.arpa
S: VRFY CRISPIN
R: 250 Mark Crispin
S: Send from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 Su-score.arpa Service Closing Transmission Channel
Get and send the email First determine the user name, then try to send the message to the user terminal, send it to the user's mailbox when it fails.
R: 220 Su-Score.arpa Simple Mail Transfer Service Ready
Helo mit-mc.arpa
R: 250 Su-Score.arpa
S: VRFY CRISPIN
R: 250 Mark Crispin
S: Send from:
R: 250 ok
S: rcpt to:
R: 450 User NOT Active Now
S: Rset
R: 250 ok
S: Mail from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 Su-score.arpa Service Closing Transmission Channel
More effective practices of the above problems
R: 220 Su-Score.arpa Simple Mail Transfer Service Ready
Helo mit-mc.arpa
R: 250 Su-Score.arpa
S: VRFY CRISPIN
R: 250 Mark Crispin
S: SOML from:
S: rcpt to:
R: 250 User NOT Active Now, SO Will Do Mail.
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 Su-score.arpa Service Closing Transmission Channel
Mail list First, each of the two mailing lists extends on different sessions of different hosts, and then send mail by forwarding the host to the user on the list.
Step 1: Extend the first list
R: 220 mit-ai.arpa Simple Mail Transfer Service Ready
S: Helo Su-score.arpa
R: 250 mit-ai.arpa
S: EXPN EXAMPLE-PEOPLE
R: 250-
R: 250-Fred Fonebone
R: 250-Xenon Y. zither
R: 250-Quincy Smith <@ USC-ISIF.ARPA: Q-SMITH@isi-vaxa.arpa>
R: 250-
R: 250
S: quit
R: 221 mit-ai.arpa service closing transmission channel
Step 2: Expand the second list
R: 220 mit-mc.arpa Simple Mail Transfer Service Ready
S: Helo Su-score.arpa
R: 250 mit-mc.arpa
S: EXPN INTERESTED-Parties
R: 250-al Calico
R: 250-
R: 250-Quincy Smith <@ USC-ISIF.ARPA: Q-SMITH@isi-vaxa.arpa>
R: 250-
R: 250
S: quit
R: 221 mit-mc.arpa service closing transmission channel
Step 3: Send mail by forwarding the host to all users included in the two lists
R: 220 USC-ISIE.ARPA SIMPLE MAIL TRANSFER Service Ready
S: Helo Su-score.arpa
R: 250 USC-ISIE.ARPA
S: Mail from:
R: 250 ok
S: rcpt to: <@ USC-isie.arpa: Abc@mit-mc.arpa>
R: 250 ok
S: rcpt to: <@ USC-isie.arpa :Fonebone@usc-isiqa.arpa>
R: 250 ok
S: rcpt to: <@ usc-isie.arpa: xyz@mit-ai.arpar: 250 ok
S: RCPT
To: <@ usc-isie.arpa, @ usc-isif.arpa: Q-SMITH@isi-vaxa.arpa>
R: 250 ok
S: RCPT TO: <@ USC-isie.arpa:joe@foo-unix.arpa>
R: 250 ok
S: rcpt to: <@ usc-isie.arpa :xyz@bar-unix.arpa>
R: 250 ok
S: rcpt to: <@ USC-isie.arpa :fred@bbn-unix.arpa>
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 USC-ISIE.ARPA Service Closing Transmission Channel
Forward situation
R: 220 USC-ISIF.ARPA SIMPLE MAIL TRANSFER Service Ready
S: Helo LBL-Unix.Arpa
R: 250 USC-ISIF.ARPA
S: Mail from:
R: 250 ok
S: rcpt to:
R: 251 User Not Local; Will Forward to
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 USC-ISIF.ARPA Service Closing Transmission Channel
Step 1: Try the first mailbox on the host
R: 220 USC-ISIF.ARPA SIMPLE MAIL TRANSFER Service Ready
S: Helo LBL-Unix.Arpa
R: 250 USC-ISIF.ARPA
S: Mail from:
R: 250 ok
S: rcpt to:
R: 251 User Not Local; Will Forward to
S: Rset
R: 250 ok
S: quit
R: 221 USC-ISIF.ARPA Service Closing Transmission Channel
Step 2: Try the mailbox on the second host
R: 220 USC-ISI.ARPA SIMPLE MAIL TRANSFER Service Ready
S: Helo LBL-Unix.Arpa
R: 250 USC-ISI.ARPA
S: Mail from:
R: 250 ok
S: RCPT TO:
R: OK
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ... s: ... etc. Etc. Etc.
S:.
R: 250 ok
S: quit
R: 221 USC-ISI.Arpa Service Closing Transmission Channel
Many recipients
R: 220 Berkeley.Arpa Simple Mail Transfer Service Ready
S: Helo USC-ISIF.ARPA
R: 250 Berkeley.arpa
S: Mail from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: rcpt to:
R: 552 Recipient Storage Full, Try Again in Another Transaction
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: Mail from:
R: 250 ok
S: rcpt to:
R: 250 ok
S: Data
R: 354 Start Mail INPUT; End with
S: Blah Blah Blah ...
S: ... etc. Etc. Etc. ETC.
S:.
R: 250 ok
S: quit
R: 221 Berkeley.Arpa Service Closing Transmission Channel
Name:
Bus stop
Space
ASCII
US standard information exchange code
Host
Network computers with SMTP processes or mailboxes
Send SMTP process
Process with work with the receiving SMTP process. Send SMTP to start the transfer service connection, it issues a SMTP command, receive a response, and the transfer of mail
user
I hope that the person who has received the mail service (or the process of being in the name of the person), and the recipient of the mail.
Session
A series of information exchanged when the transfer channel is opened
Transmission service
Reliable-oriented data communication service. For example: NCP, TCP, NITS.
Transmission channel
Acquisition of the full-duplex for the SMTP and the received SMTP for exchange commands, response, and mail content
character
String display
Row
End of the message ended with one
answer
Receive SMTP responds to a command (successful or unsuccessful) response to a command transmitted by the transmission SMTP. The general format of the response is to add a message to a piece of text. Normally, the answer is used for the machine, and the text is used for human users.
content of email
A series of strings that meet the standard character set of ARPA Internet text information format
Email content end tag
Specific characters indicating the end of the email content
mailbox
Specifies the address of the letter that should be orientated to the user (string). It is usually represented by the username and hostname
command
Request for requesting a mail service operation by sending SMTP to receiving SMTP
area
Hierarchical representation of the host address string in the mail system
Receive SMTP processes
A process that works with the send SMTP process. It waits to connect through the transfer service. It receives the command sent by sending the SMTP, gives an response and performs the corresponding operation.
operating
A information transmitted from one recipient to another or more recipients
Reference
[1] ASCII
ASCII, "USA Code for Information Interchange", United States of STATES OF
America Standards Institute, X3.4, 1968. Also in: Feinler, E.
And J. Postel, EDS., "Arpanet Protocol Handbook", NIC 7104, FOR
The Defense Communications Agency By Sri International, Menlo
Park, California, Revised January 1978.
[2] RFC 822
Crocker, D., "Standard for the Format of Arpa Internet Text
Messages, "RFC 822, Department of Electrical Engineering,
University of DelaWare, August 1982.
[3] TCP
Postel, J., Ed., "Transmission Control Protocol - DARPA INTERNET
Program Protocol Specification, RFC 793, USC / Information Sciences
Institute, Ntis Ad Number A111091, September 1981. Also in:
Feinler, E. And J. Postel, EDS., "Internet Protocol Transition
Workbook, Sri International, Menlo Park, California, March 1982.
[4] NCP
Mckenzie, a., "Host / Host Protocol for the arpa network", NIC 8246,
January 1972. Also in: Feinler, E. And J. Postel, EDS., "Arpanet
Protocol Handbook, NIC 7104, for the Defense Communications
Agency By Sri International, Menlo Park, California, Revised
January 1978.
[5] Initial Connection Protocol
Postel, J., "Official Initial Connection Protocol", NIC 7101,
11 June 1971. Also in: Feinler, E. And J. Postel, EDS., "Arpanet
Protocol Handbook, NIC 7104, for the Defense Communications
Agency By Sri International, Menlo Park, California, Revised
January 1978.
[6] NITS
PSS / SG3, "A NetWork Independent Transport Service", Study Group 3,
The Post Office PSS Users Group, February 1980. Available from
The DCPU, National Physical Laboratory, Teddington, UK.
August 1982 RFC 821
Simple Mail Transfer Protocol
[7] X.25
CCITT, "Recommendation X.25 - Interface Between Data Terminal
Equipment (DTE) And Data Circuit-Terminating Equipment (DCE) for
Terminals Operating In the Packet Mode on public data networks, "
CCITT Orange Book, Vol. Viii.2, International Televhone and
Telegraph Consultative Committee, Geneva, 1976.
RFC821 Simple Mail Transfer Protocol RFC821 Simple Mail Transfer Protocol (SMTP)
1
1
RFC Document Chinese Translation Program