RFC821-Simple Mail Transfer Protocol (SMTP) Chinese version-0
Source: Internet
Author: User
From: Author: (2001-11-2307: 08: 00) 1. the goal of the Simple Mail Transfer Protocol (SMTP) is to deliver mail reliably and efficiently. it is independent of the transfer subsystem and requires only one channel that can ensure the order of transmitted data units. Appendix A, B, C, and D describe the use of SMTP in different transfer services. The terms used in this document are also defined in the glossary. SMTP from: Author: (07:08:00)
1. Introduction
The goal of Simple Mail Transfer Protocol (SMTP) is to transmit mail reliably and efficiently, which is independent of the transfer protocol.
The delivery subsystem only requires a channel that can ensure the sequence of transmitted data units. Appendix A, B, C
And D describe the use of SMTP in different transfer services. The glossary also defines
.
An important feature of SMTP is its ability to transmit mails during transmission. the transfer service provides
Inter-process communication environment (IPCE), which can include one network, several networks, or one network
. It is important to understand that the transfer system (or IPCE) is not one-to-one. Process may be straight
And other processes communicate with each other through known IPCE. An email is an application or inter-process communication. Mail
You can send emails through processes connected to different IPCE instances across the network. What's more, Mail
The parts can be transmitted by the host over different networks.
2. SMTP model
SMTP design is based on the following communication model: for user mail requests, send SMTP establishment and connection
Create a two-way transmission channel between receiving and SMTP. Receiving SMTP can be either the final receiver or
Inter-carrier. The SMTP command is sent by the sending SMTP, and received by the receiving SMTP, and the response is reversed.
Send.
Once the transfer channel is established, the SMTP sender sends the MAIL command to specify the MAIL sender. If
If an SMTP recipient can receive an email, an OK response is returned. The SMTP sender then sends the RCPT command to confirm the email.
Whether to receive the message. If the SMTP receiver receives the message, an OK response is returned. if the message cannot be received, an OK response is sent.
Refuse to receive the response (but do not stop the entire email operation). The two parties will repeat it multiple times. When the recipient receives
After all emails are sent, a special sequence will be received. if the recipient successfully processes the emails, an OK response will be returned.
Answer.
SMTP provides a mail transfer mechanism. if the recipient and the sender are connected to the same transmission service
The email can be directly sent from the sender's host to the receiver's host; or, when the two are not in the same
In the transfer service, it is transmitted through the relay SMTP server. To provide relay capabilities for the SMTP server
Force, it must have the final destination host address and email name.
The MAIL command parameter is the reply path, which specifies where the MAIL comes from, and the RCPT command parameter is
It specifies the path to which the email is sent. The forward path is the source path, and the reply path is the return path.
(It is used to return an email when an error occurs ).
When a message is sent to different recipients, SMTP sends the same message to different recipients.
There is a strange syntax for mail commands and responses, and there are also
Code. In the following example, we can see which actual commands and responses are used. Complete Life
Orders and responses are in section 4.
Commands and responses are case-insensitive. that is, commands and responses can be in uppercase, lowercase, or
But this is not necessarily true for the user's mail name, because some hosts
The name is case sensitive. In this way, the SMTP implementation retains the user's email name as the initial form,
Host names are case insensitive.
Commands and responses are composed of the ASCII alphabet. when the shipper service provides an eight-byte transfer channel
Characters are correctly transmitted, and the highest bit is filled with 0. After a common command or response format is specified
Numbers are represented by strings similar to languages, such" "Or" ",
Angle brackets indicate that this is a language-like variable.
3. SMTP process
This section provides some SMTP processes. The first describes the basic sending process (defined
Sending operation ). Next describe the forward mail, confirm the email name and extended email list, and send it to the end
Enable and disable switching. At the end of this section is a description of the interrupt and email domain. The example in this section is only 1.
For a complete example of the sequence of some commands and responses, see Appendix F.
3.1. MAIL
There are three steps in the SMTP sending operation. The operation is identified by the MAIL command. Series or
More RCPT commands are followed by the receiver information, and then the DATA command is used to list sent emails.
Content, and finally the Mail content indicator to confirm the operation.
The first step is the MAIL command. <reverse-path> includes the source email address.
MAIL FROM:
This command tells the recipient that the new sending operation has started. please reset all status tables and buffers.
It provides a reverse path to return error information. If the request is received, the receiver returns
250 OK response. It includes not only the mailbox, but also the host and source mailbox-
Routing, the first host is the host that sends this command.
The second step in the process is to send the RCPT command.
RCPT TO:
This command identifies the receiver in the forward path. if the command is received, the receiver returns
250 OK, and store the forward path. If the receiver is unknown, the receiver returns a 550 Failure
Response. This process may be repeated several times.
It includes not only emails, but also route tables of hosts and destination mailboxes.
The first host is the host that receives commands. The third step in the process is to send the DATA command.
DATA
If the command is received, the receiver returns a 354 Intermediate response and determines that
All rows are mail content. After receiving and storing the ending letter, the receiver sends a 250 OK response.
Because the email is sent through the transmission channel, you must specify the end of the email content so that you can reply to the dialog
To start again. SMTP sends only one full stop message in the last line to indicate the end of the Mail content.
Receiver. This symbol is filtered out in a process that is transparent to users without affecting normal data.
Note: The Mail content includes the following prompts: Date, Subject, To, Cc, From.
The email content indicator confirms the email operation and informs the recipient that the data can be stored and sent again. For example
If this command is received, the receiver returns a 250 OK response. The DATA command is only available in emails.
Or the source fails.
The above process is a sending operation. These commands can only be used in the preceding sequence. Example
Indicates the use of these commands in a sending operation.
SMTP process example: In this example, the Smith of the Alpha. ARPA host sends an email to the Beta. ARPA host.
Jones, Green, and Brown of, assume that the host Alpha is directly connected to the host Beta.
S: mail from:
R: 250 OK
S: rcpt:
R: 250 OK
S: rcpt:
R: 550 No such user here
S: rcpt:
R: 250 OK
S: DATA
R: 354 Start mail input; end .
S: Blah blah...
S:... and so on
S: .
R: 250 OK
This email was received by the first two people, and the third person had no email on this host.
3.2. forwarding
Below are some The destination address is incorrect, but the recipient knows the target
. In these examples, one of the following responses should allow the sender and obtain the correct address.
251: the user is not local. .
This response means that the receiver SMTP knows that the user's mailbox is on another host, and it means
In the future, we will use the correct turning path. Please note that the host or user, or both of them are not
. The receiver is responsible for transmitting messages.
551: the user is not local. please try
This response means that the receiving SMTP knows that the user's mailbox is on another host, and it means that
The correct forwarding path. Note that the host or user, or both, are different. Connect
The recipient refuses to receive the user's mail. the sender must resend the email based on the provided information or send the email to the original user.
The sender returns an error message. The following example shows the applications with these responses.
Forwarding example
S: rcpt:
R: 251 User not local; will forward
Or
S: rcpt:
R: 551 User not local; please try
3.3. validation and expansion
SMTP provides additional user name confirmation and extended mail list functions. These functions are composed of VREF and
The EXPN command is complete. all of them are strings. For VREF commands, string parameters refer to
Account name. The response to this command should include the user name and the user's email address. For the EXPN command, the character
String parameters refer to the mail list, and more than one response to this command should be included in all lists
User name and their email address.
"User name" is a redundant project, which is intentionally added. If the host uses VREF
Command and EXPN command, and the local mailbox must provide a user name for confirmation by the host. If you select
It is also allowed to use another string as the user name.
In some hosts, the mailbox list and the proxy of one mailbox are a little unclear, because the average number
The data structure may include two types of entries. If you want to confirm the email list, make sure that
Set the response. After receiving this message, the host will send the email to all the addresses on the list,
If no response is received, an error is reported. For example,
"550 That is a mail list, not a user name ". If the request is used to extend a user name,
A definite response may be formed by returning a list containing a name. If no definite 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 case of a fuzzy request, for example, "VRFY Smith", the two Smith responses must be
"553 User ambiguous ".
The user name is confirmed as follows: Example 3:
Confirm user name
S: VRFY Smith R: 250 Fred Smith
Or
S: VRFY Smith
R: 251 User not local; will forward
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 multiple responses as follows:
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-
R: 250
Or
S: EXPN Executive-Memory Room-List
R: 550 Access Denied to You.
The string command parameters of VERF and EXPN commands cannot be limited due to different implementations.
. In some systems, the EXPN command parameter may be a file name containing the mail list,
However, there are many different file structures on the Internet.
VRFY and EXPN commands are not included in the minimum implementation. they are not required when they are implemented.
Implemented in the inter-transmission mode.
3.4. send and receive the mail (sending)
SMTP is mainly used to send emails to users' mailboxes. Provided by some hosts
The function is to send emails to the user's terminal (if the user is on the terminal ). Send email to user
The email address is called mailing.
(Sending ). Because the implementation of the two is very similar on some hosts
Put in SMTP. However, obtaining mail commands is not available in the minimum implementation of SMTP. User
It should be able to write information to the terminal. Most hosts allow users to accept or reject
Similar information.
The following three commands are defined to support receiving letters. They are used for MAIL commands instead of MAIL
Command to indicate the special significance of receiving SMTP operations:
SEND FROM:
The SEND command requires that the Mail content be directly transmitted to the user terminal. If the user does not open the terminal (or
Is not received by the terminal), 450 response will return an RCPT command. If the message is successfully sent,
This operation is successful.
SOML FROM:
The Send or MaiL command requires that the MaiL content be directly sent to the user's terminal (if the user
On the terminal ). If the user is not on the terminal, the email content is directly sent to the mailbox. If the email is sent
Sent to the user terminal or user mailbox.
SAML FROM:
The Send and MaiL commands require that the MaiL content be directly sent to the user terminal (if the user is on the terminal ).
In any case, the Mail will enter the mailbox. If the Mail enters the mailbox, the sending operation is successful.
The responses for MAIL commands are the same as those for these commands.
3.5. open and close
When a transfer channel is opened, some information needs to be exchanged to determine the identities of both parties. The following command is:
Used to open and close:
HELO
QUIT
In the HELLO command, the host sends the command by itself. this command can be interpreted as: "HELLO,
I am XX ".
Example of opening a connection
R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
S: HELO USC-ISIF.ARPA
R: 250 BBN-UNIX.ARPA
Example of disabling a join
S: QUIT
R: 221 BBN-UNIX.ARPA Service closing transmission channel
3.6. forwarding
The forwarding path may be in the following format: "@ ONE, @ TWO: JOE @ THREE". here, ONE, TWO
And THREE are hosts. This format emphasizes the differences between addresses and paths. The email address is an absolute address.
Paths are information about how to arrive. These two concepts should not be confused.
In terms of concept, the element of the forwarding path is moved to the reply path from one SMTP server to another.
SMTP server information. The reply path is a reverse data source path, for example, from the bit of the current information
To the initiator. When an SMTP server deletes its own tag from the forwarding path and inserts it
In the reply path, it must use a name that can be understood by its sending environment to prevent its
Names are interpreted as different names in different environments.
If the first element in the forwarding path of the message received by SMTP is not the flag of this SMTP
The element is used to determine the next SMTP server to be sent instead of being deleted from the forwarding path. In
In any case, SMTP adds its own tag to the reverse path.
When you use the source path, you can receive the forwarded mail from SMTP and send it to another receiving SMTP server.
The receiving server can accept or reject emails forwarded to local users. Receive SMTP by marking it
Change the command parameters from the forward path to the reply path. At this time, the receiving SMTP is changed to sending
Send SMTP, it establishes the SMTP channel to the next forwarding path, and then it sends
Send email.
The first host in the reply path should be the host that sends the SMTP command.
The host should be the host that receives SMTP commands.
Note: The forwarding and reply paths appear in SMTP commands and responses, but do not necessarily appear in
. That is To say, there is no such path. in particular, this format appears in the ":",
"From:" and "CC.
If the SMTP server accepts the forwarding task, but later it finds that the forwarding path is incorrect or
Other principles cannot send emails. it must establish an "undeliverable mail" signal to send emails.
The sender of the email.
This signal must be sent from the SMTP service of this host. of course, this server should not report
Error message. One way to prevent this error reporting loop is when the mail command of the signal is returned
Leave the path empty. When this information is sent, the reply path can also be left blank. After a MAIL command
The reply path is empty in the following format:
Mail from: <>
The following example shows the Mail information that cannot be sent. This message is an email sent to JOE from HOSTW.
An error occurred when HOSTX needs to pass HOSTZ to HOSTY. The example we see is in HOSTX
And HOSTY.
Example of Mail information not allowed
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.
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
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.