RFC821-Simple Mail Transfer Protocol (SMTP) Chinese version-2

Source: Internet
Author: User
From: Author: (2001-11-2308: 08: 00) 4.1.2.COMMAND syntax format commands are composed of the command code and its subsequent parameter fields. It consists of four letters, which are case-insensitive. The following command is used for the same purpose: mailmailmailmailmailmail is also applicable TO the flag of any parameter values for guidance. for example, to and TO are the same as SMTP.

From: Author: (08:08:00)

4.1.2. COMMAND syntax format
A command is composed of an authorization code and a subsequent parameter field. The command code is composed of four letters, no difference
Case. Because the following commands serve the same purpose:
MAIL Mail mail
This is also applicable TO the flag that directs any parameter value, such as to and. Command code and
Parameters are separated by one or more spaces. However, the parameters in the reply path and the forwarding path are case-insensitive.
. Especially on some hosts, "smith" and "Smith" are not a user at all.
The parameter field is composed of an indefinite string, which consists End, before the receiver completely receives this sequence
No action will be taken. Square brackets represent optional parameter fields. If not selected, the system selects the default
.
The following is the SMTP command:
HELO MAIL FROM:
RCPT TO:
DATA
RSET
SEND FROM:
SOML FROM:
SAML FROM:
VRFY
EXPN
HELP [ ]
NOOP
QUIT
TURN

The format of the above parameter fields is given below for the BNF format, where "..." represents
The domain is repeated once or multiple times.
: =
: =
: = "<" [":"] ">"
: = | ","
: = "@"
: = | "."
: = | "#" | "[" "]"
: = "@"
: = |
: =
: = |
: = |
: = | | "-"
: = <字符串> | <字符串> "."
<字符串> : = <字符> | <字符> <字符串>
: = """ """
: = "\" | "\" | |
<字符> : = | "\"
: = "." "." "."
: = |
: =
: = Carriage return (ASCII code 13) : = (ASCII code 10)
: = Space (ASCII code 32) : = A forward composed of one, two, or three numbers
Number between 0 and
: = 52 uppercase/lowercase English letters for all A-Z
: = 128 ASCII characters, excluding spaces and special characters
: = 0-9 number
: = Not included , , "Or \'s 128 ASCII characters
: = All 128 ASCII characters
: = "<" | ">" | "(" | ")" | "[" | "]" | "\" | ". "|", "|"; "|": "| "@""""
Or control characters
Note: "\" is a conversion character. it indicates that the character after it represents another meaning.
For example, "Joe \, Smith" is used to represent a separate user name separated by commas. The host is usually converted from
The name of the address. Note: the domain name element is a formal name and cannot be a nickname or a pseudonym.
Sometimes the name conversion mechanism may not know the host, which causes communication congestion. To solve this problem
You can use either of the following methods: add a decimal number after "#" to indicate the host address;
The other method is to add a 32-bit IP address to the backend. the IP address is in the form of four periods separated by periods.
The decimal number between 0 and 25 5. The format of the timestamp and return path rows is usually defined as follows:
: = "Return-Path :"
: = "Received :"
: = ";"
: = "FROM" <域>
: = "" <域>
: = [ ] [ ] [ ] [ ]
: = "" <连接>
: = "" <协议>
: = "ID" <字符串>
: = "" <路径>
<连接> : = Standard name of the connection registered in the Network Information Center
<协议> : = Name of the protocol registered in the network center
: = <日> <时间>
<日期> : = <日> <月> <年>
<时间> : = <小时> ":" <分> ":" <秒> <时区>
: = 1-31 days of every month composed of one or two numbers
<月> :: = "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" | "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
<年> : = Represents the age 00-99 of the world by two digits
<小时> : = 24 hours a day, from 0 to 24
<分> : = The number of minutes per hour 0-59
<秒> : = The number of seconds per minute 0-59
<时区> ::= Global standard time zone

Return Path example
Return-Path: <@ CHARLIE. ARPA, @ BAKER. ARPA: JOE@ABLE.ARPA>

Example of timestamp rows
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
There are various responses to SMTP commands, which determine the request and processing during mail transmission.
Synchronization also ensures that the sending SMTP knows the status of the received SMTP. Each command must have only one
Response.
SMTP response consists of three digits followed by some text. Number helps determine the next step
And the text is meaningful to people. The three responses contain enough information,
Text can be discarded or transmitted to users without reading any more. Specifically, the text is
The received text may be different each time because it is related to the environment. See Appendix E.
All response codes. Normally, the response consists of the following sequence: three digits, ,
One line of text and one Or a multiline response. Only EXPN and HELP commands are supported.
Multiple lines of responses can be returned. However, multiple lines of responses to all commands are allowed.
 
4.2.1. reply codes by function groups 500 format error, command unrecognizable
(This error also includes the command line being too long)
501 incorrect parameter format
502 commands cannot be implemented
503 error command sequence
504 command parameters cannot be implemented
211 system status or system help response
214 help information
220 Service ready
221 Service disables the transmission channel
421 The service is not ready. disable the transmission channel. (this response can be used when the transmission channel must be closed.
To respond to any command)
250 The required email operation is completed
251 The user is not local and will forward
450 the email operation is not completed and the mailbox is unavailable (for example, the mailbox is busy)
550 the requested email operation is incomplete and the email address is unavailable (for example, the email address is not found or cannot be accessed)
451 discard required operations; errors occurred during handling
551 users are not local. please try
452 The System Storage is insufficient and the required operations are not performed
552 excessive storage allocation, required operations not performed
553 the mailbox name is unavailable and the required operation is not performed (for example, the mailbox format is incorrect)
354 start email input, . End
554 operation failed
 
4.3. command and response sequence
The communication between the sender and the receiver is an alternative form of Q & A, which is controlled by the sender.
In this way, the receiver sends a response by sending a command. The recipient is sending the next instruction
Must wait for the response. An important response is the connection response. When the connection is complete, the receiver usually
Sent 220 "service ready ". The sender waits for this response before sending the instruction. Note: Each connection
The answer must have the official name of the service host as the first part, followed by the response code. For example:
220 USC-ISIF.ARPA Service ready
The successful and failed responses are listed below. these responses must follow a strict order and the recipient can
The text in the response is ignored, but the meaning and operation sequence specified by the number cannot be changed.
Command response sequence:
Each command lists its possible responses. Use the prefix "P" before a possible response to indicate that the prepared
(Not used in SMTP), "I" indicates the middle, "S" indicates the success, "F" indicates the failure, and "E" indicates the error
Error. If the STMP receiver must disable the channel, it can make 421 for any command (the service is unavailable,
Disable the transmission channel) response. This table is based on the following state chart:
Connection establishment (establish a CONNECTION)
S: 220
F: 421
HELO
S: 250
E: 500,501,504,421
MAIL
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. status chart
The following state chart is a simple SMTP implementation. each group of commands has a state chart. In the figure,
Only the first number of the response code is used as the response representative. The command group creates a mode for each command.
Then, the commands are centralized in structure mode. There are three possible responses for each command: Success (S ),
Failure (F) and error (E ). In the status, we use B to start, and W to wait for a response.


 



This status chart uses the following commands: HELO, MAIL, RCPT, RSET, SEND, SOML,
SAML, VRFY, EXPN, HELP, NOOP, QUIT, TURN.
The following is a more complex state chart of the DATA command:


 



 
Note: the email content here is multi-line, and the recipient can only send a response when receiving the last line.
 
4.5. details
4.5.1. minimum implementation
To enable SMTP to work, this is the minimum implementation command for the receiver:
COMMANDS-HELO
MAIL
RCPT
DATA
RSET
NOOP
QUIT

4.5.2. transparency
There is no guarantee of data transparency" . "When the Mail content ends
An error occurred. Generally, users do not care about this "invalid" sequence. To make it transparent to all users
The following measures must be taken:
1. before sending an email, you must check each line of the email before sending SMTP. if it is a full stop
Add a full stop at the beginning of the line.
2. when an email is received, the receiving SMTP must check each line of the email. if only one row is found
The email ends. if there are two periods in one line, there should be only one
And delete the first period.
The email content can contain 128 ASCII characters. All characters sent to the recipient's
Mailbox, including format symbols and other control characters. If the transmission channel provides an 8-bit data stream
Can be transmitted in the ASCII code, and the maximum position is 0. Some systems require
Convert the data format. For hosts that use different ASCII character sets or cannot be in the string shape
This is especially true for hosts that can only be stored in the form of records. if conversion is required
This is especially true for hosts used for storage and forwarding.
 
4.5.3. size
The maximum and minimum sizes are required for some objects. That is to say, each implementation must be able to receive
Small objects. objects larger than the maximum size cannot be sent. For the maximum possible size, implementation
Technically, there are no restrictions.
The maximum length of a user name is 64 bytes.
The maximum length of a domain is 64 characters.
The maximum length of the path reply path and forwarding path is 256 characters.
The maximum length of a command line, including a carriage return of 512 characters.
The maximum length of a response line, including a carriage return of 512 characters.
The maximum length of a text line in a text line, including the carriage return and the addition of no more than 1000 characters for transparency
Characters
The receiving buffer zone can accommodate a maximum of 100 recipients.

If an error occurs, the response is as follows:
500 rows are too long
501 too many paths
552 too many recipients
552 too many emails


Appendix a tcp transmission service

The Transmission Control Protocol (TCP) is used in the ARPA Internet and complies with the US DoD standard of the network protocol.
Accurate. The SMTP transmission channel is connected to the sending process Port U and the receiving process Port L. A single
The full duplex channel is used for transmission. The specified service port for this protocol is 25, that is, L = 25.
TCP connections support 8-bit transmission, while SMTP only needs 7-bit transmission. in this way, the maximum length of each 8-bit character is
Bit is set to 0.

Appendix B NCP transmission service

The ARPANET host-host protocol (implemented by the Network Control Program) can also be used in ARPANET.
The SMTP transmission channel is connected to the sending process Port U and the receiving process Port L.
The initial connection protocol (ICP) establishes a pair of simple connections. This pair of simple connections is used as a transmission channel.
This protocol is specified as connection socket 25, that is, L = 25. NCP connections support 8-bit transmission, while
SMTP only needs to transmit 7 bits. in this way, the maximum bit of each 8-bit character is set to 0.

Appendix C NITS

You can also use the independent network transfer service. By creating NITS between the sending and receiving processes
Establish a transmission channel. The sending process executes the CONNECT primitive and waits for the receiving ACCEPT primitive. NITS connection
8-byte transmission is supported, while SMTP only needs 7-bit transmission. in this way, the highest bit of each 8-bit character is set
0.

Appendix D X.25 transmission service

The X.25 service that can be directly received by the public data network is recommended for reliability.
Such as TCP.

Appendix E response code composition method

Each of the three response codes has a specific meaning. Each response indicates whether the response is successful or not.
Or unfinished. Through this bit, the next operation can be determined by the non-complex SMTP sending. if
The sender wants to know about the problem. it can detect the second digit, while the third digit stores
Complete information. That is to say, from the first to the third, the receiver can step by step
Determine the recipient's status. The first five possible representations have different meanings:

1 YZ partially completed response

The command is accepted, but the requested operation is aborted because it is in the response code. The sender should try again
Send another command to specify whether to continue the operation or stop the operation.

2yz complete response

The required operation has been completed. you can start another request.

3yz needs to complete the response in the last step.

The command is accepted, but the required operation is aborted. you need to receive further information. The sender shall
This sends another command to indicate further information.

4yz no response yet

The command is not accepted, and the required operation is not executed, but the error status is temporary.
To perform another request. The sender should return the Start command of the command sequence (if any ). Very
It is difficult to explain this temporary significance, especially for two different sites. Different responses belong to some classes.
Or the next method is: if the re-sending command can be repeated without any change
This class, if not, is the next class (5yz.

5yz permanent incomplete response

The command is not accepted and the required operation is not completed. Sending duplicate commands does not work. Even if
Some error conditions have changed, but the user does not want to try again, but wants to try again at a certain time in the future.
.

The second answer has the following meanings:

X0z syntax: this type of response is applicable to the following situations: syntax errors; compliant with the syntax but not saved in the command
In terms of functions; incomplete or redundant commands.

X1z Information: This type of response is used for 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 email system: this type of response indicates the recipient's email system's request transfer or other operations
.

The third part provides a more detailed description. The list of response tables illustrates this. The text response is
We recommend that you use it instead of using it. its content can be changed according to different situations.
On the other hand, the response code must strictly comply with the instructions in this section. The receiver should not be slightly different.
Instead of using the defined code. For example, the NOOP command
If it is successfully executed, no new information is returned, and only 250 is returned. When sending
The response should be 502 when an unimplemented site is specified for an operation. Answer text may
More than one line; in this case, the text must be marked, and the recipient of the text will not read less
One row of data. This requires the specific format to indicate multi-line responses. This format is: each row except the last
All rows outside the row start with a "-" in the response code. The last line is followed by a response code and a space. Start.
For example:

123-First line

123-Second line

123-234 text beginning with numbers

123 The last line

Generally, the recipient only needs to find the line with the response code and spaces.
The content of the preceding line is omitted. In special cases, the sender must know the content of the response text.
The recipient can correctly determine whether to know the text content based on the current situation.

Appendix F examples


This section provides complete examples of SMTP sessions.

Typical SMTP operations

This class shows how messages are sent from Smith on the USC-ISIF and on the machine to the BBN-UNIX host
Jones, Green, and Brown. Here we assume that the USC-ISIF host is directly in contact with the BBN-UNIX host.
Jones and Brown receive the mail, while Green has no mailbox on the 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:

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:... etc. etc.

S :.

R: 250 OK

 

S: QUIT

R: 221 BBN-UNIX.ARPA Service closing transmission channel

Discard 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:

R: 250 OK

 

S: rcpt:

R: 550 No such user here

 

S: RSET

R: 250 OK

 

S: QUIT

R: 221 MIT-Multics.ARPA Service closing transmission channel



Forward email

Step 1: source host to forwarding host

 

R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready

S: 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 .

S: Date: 2 Nov 81 22:33:44

S: From: John Q. Public

S: Subject: The Next Meeting of the Board

S: To: Jones@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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.