Simple Mail Transfer Protocol (SMTP)
Introduction SMTP Model SMTP Procedure SMTP Description TCP Transport Service NCP Transport Service NITSX.25 Transport Service Answer Method Some examples
1. Introduction The goal of the Simple Mail Transfer Protocol (SMTP) is reliable and efficiently transmitting messages, 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. The SMTP model SMTP design is based on the following communication model: Send SMTP to establish a two-way transmission 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 "
Examples of this section are only part of the commands and responses, and the complete example see Appendix F. 3.1. Mail has three steps in the SMTP send operation, and the operation is given 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,
-------------------------------------------------- ----------- 3.2. Forward below is the incorrect address of the destination address in
551: User is non-local, please try
Confirm that the username is as shown in the following example: Example 3: ------------------------------------- ------------------------ Confirm user name S: VRFY Smith R: 250 Fred Smith
S: EXPN EXECUTIVE-WASHROOM-LIST R: 550 Access Denied to you. ---------------------------------- --------------------------- VERF and EXPN commands The parameters 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. The main purpose of the sending letter and the SEnding 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 in the mail command instead of the mail command, indicating the special meaning of receiving this operation: Send
-------------------------------------------------- ----------- Example of opening coupled R: 220 bbn-unix.arpa Simple Mail Transfer Service Ready S: Helo USC-INIF.ARPA R: 250 BBN-UNIX.ARPA ------ -------------------------------------------------- ----- --------------------------------------------- ---------------- Close the connection: quit r: 221 bbn-unix.arpa service closing transmission channel --------------- -------------------------------------------- 3.6. Forward forwarding The path may be formatted: "@ one, @ two: joe @ Three", 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 forwarding path is not correct or other principles cannot send mail, it must establish a "undeliverable mail" signal to send it to this letter to the 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 following example shows that the invoice information is displayed. 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.
-------------------------------------------------- ---------- Example of unloading mail information 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. S: Hostz.arpa said this: s: "550 no such user" s:. R: 250 ok ---------- -------------------------------------------------- - 3.7. Domain field 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 TURN command to change the role of the program that communicates on the transfer 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 SMTP command defines mail transfer or by user-defined system features. Its command is a string ended by
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 a message received by the transfer host A, from:
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 receif pact: from def.arpa by ghi.arpa; 27 Oct 81 15:15:13 Pst resceid: 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.arpa this 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 action to transfer the mail 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 that 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 requires the recipient to confirm the parameter specified a message send a list. If it is a mail sends a list, it returns a 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 response and changing the role to send SMTP, or send a rejection information and keep your 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. The command syntax format command is made up of the command code and the subsequent parameter domain. The command code is four letters, and the case is not different. Because the following commands are the same: 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
|
C> :: = 128 ASCII characters, but does not include spaces and special characters :: = does not include
The format of the timestamp line and the return path row is usually defined below:
-------------------------------------------------- ------------------------------------------------- ---------------------- Timestam Example received: from abc.arpa by xyz.arpa; 22 Oct 81 09:23:59 PDT Received: from ABC Ar ar..;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -------------------------------------- 4.2. SMTP responds to the response of the SMTP command is diverse It determines the synchronization of requests and processing during mail transmission, and guarantees 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,
Note: Each connection response must have a formal name of the service host as the first part, followed by the response code. For example: 220
4.5. Details 4.5.1. Minimum implementation is to make SMTP work, for the recipient, this is the least should be implemented: Commands - Helo Mail Rcpt Data Rset Noop Quit 4.5.2. Transparency does not transparent Sexual guarantee, errors occur when sending similar "
The maximum length of the user user name is 64 bytes. The maximum length of the domain domain is the maximum length of the 64-character path reply path and the forwarding path is the maximum length of the 256 characters command line command line, including the maximum length of the return of 512 characters, including the carriage return. For the maximum length of 512 character text, the maximum length of the line, including the return of the carrier and the result of more than 1000 characters to the transparency, the receiving buffer receiving buffer can accommodate 100 recipients If an error, the answer is as follows: 500 line Length 501 Too many 552 Receiver Excessive 552 Mail Content Excessive Appendix A TCP Transport Service Transfer Control Protocol (TCP) 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 Transportation Services ARPANET Host - Host Protocol (implemented by network control) can also be used for 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 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 You can directly use the X.25 service received by the public data network, however, it is recommended to use a reliable end-to-end protocol such as TCP. Appendix E Answering code constitutes three response to each one has 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. For the first five possible representation of different meaning: The 1YZ section completes the response command is accepted, but the required operation is aborted, the reason is in the reply code. The sender should send another command to indicate whether to continue, or abandon the operation. 2YZ All completion of the response requirement 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 temporarily unfinished response command is not accepted, the required operation has not been executed, but the state 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: if it is possible to repeat any change again, it is this class, if not, it is the next type (5yz).
The 5YZ permanently unfinished response 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, the command does not have functions; 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. As in the following example: 123-First line 123-Second Line 123-234 Text Beginning With Numbers 123 The last line usually, the received party can only use the line of the response code to add space, 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 class shows how to send SMITH on USC-ISIF to Jones, 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:
BBN-vax.arpa s: s: Bill: s: The next meeting 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 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: 220 Su-score.arpa Simple Mail Transfer Service Ready S: Helo Mit-mc.arpa r: 250 Su-score.arpa S: VRFY CRISPIN R: 250 Mark Crispin < Admin.mrc@su-score.arpa> s: send from:
-------------------------------------------------- ----------- First: 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 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: