SMTP Protocol original command code and working principle

Source: Internet
Author: User
Tags end mail return domain domain name client mx record

1.SMTP is working in two cases: one is to transmit e-mail from the client to the server, and the other is to transfer from one server to another

Server

2.SMTP is a request/response protocol in which commands and responses are based on ASCII text and end with CR and LF. The response includes a representation return

Three-bit number code for back status

3.SMTP listens for connection request at TCP protocol Port 25th

4. Connection and sending process:

A. Establishing a TCP connection

B. The client sends the HELO command to identify the sender's identity, and then the client sends the Mail command

The server is looking for a OK response, indicating that it is ready to receive

C. The client sends the RCPT command to identify the intended recipient of the e-mail message and can have multiple rcpt rows

The server side indicates whether you want to accept the message for the recipient

D. End of negotiation, send mail, send with command data

E. To send out with the end of the input content

F. End this send and exit with quit command.

5. Two other orders:

The VRFY---is used to verify the existence of a given user's mailbox and to receive detailed information about that user.

EXPN---Used to augment mailing lists.

6. Mail Routing process:

The SMTP server is based on the domain name of the scheduled recipient in the Domain Name Services DNS. The SMTP server is based on MX records in DNS

The routing email, MX record registers the domain name and the related SMTP relay host, the e-mail that belongs to this domain should send to this host.

If the SMTP server mail.abc.com receives a letter to send to shuser@sh.abc.com:

A.sendmail request DNS to give the host sh.abc.com CNAME records, if so, if cname to shmail.abc.com, then again

Request Shmail.abc.com's CNAME record until it's not so far

B. Suppose to be cname to shmail.abc.com, and then SendMail request the DNS of the @abc.com domain to give the shmail.abc.com MX record.

Shmail MX 5 shmail.abc.com

Ten shmail2.abc.com

C. sendmail finally requested DNS to give the shmail.abc.com a record, that is, the IP address, if the return value is 1.2.3.4

D. SendMail connects with 1.2.3.4, transmits this letter to shuser@sh.abc.com to 1.2.3.4 the SMTP daemon for this server

7.SMTP Basic Command set:

Command description

------------------------------

HELO identify the user identity to the server

The sender can cheat, lie, but in general the server can detect.

Mail Initiate message transfer

Mail from:

RCPT identifies a single recipient of the message, often behind the mail command

There can be multiple RCPT to:

Data after a single or multiple RCPT command indicates that all message recipients have identified and initialized the data transfer to. End.

VRFY is used to verify that the specified user/mailbox exists or that the server often prohibits this command for security reasons

EXPN Verify that a given mailbox list exists, and that the expanded mailbox list is often disabled

Help query server What commands are supported

NOOP no action, server should respond OK

QUIT End Session

RSET reset session, current transfer canceled

--------------------------------

8. The address specified in the MAIL from command is called the envelope from address and does not need to be consistent with the sender's own address.

RCPT to, the specified receiver address is referred to as the envelope to address, regardless of what the actual to: line is.

9. Why are there no rcpt CC and RCPT BCC:?

All recipient negotiations are implemented through the RCPT TO command, and if it is BCC, the recipient of the envelope is deleted after the negotiation is received.

10. The message is divided into the envelope part, the letterhead part and the letter body part

Envelope from, envelope to and message from:, message to: completely irrelevant.

The evnelope is provided by the SMTP background of the server host, while the message from/to is provided by the user. There is no colon is also the difference.

11. How does the envelope part check if a letter is forged?

A. Relevance of the received line.

Now the SMTP mail transfer system, in the envelope part except the two ends of the internal host processing of the one, consider between the two company firewalls

, if the two firewall machines are A and b respectively, but the receiver checks the envelope received: The row is found to have passed C. Then it was forged.

B. Received: Whether the host and IP address pairs in the row correspond to the following:

Receibed:from galangal.org (turmeric.com [104.128.23.115] by mail. bieberdorf.edu .....

C. The received line that was manually added to the last side:

Received:from galangal.org ([104.128.23.115]) by mail. bieberdorf.edu (8.8.5)

Received:from lemongrass.org by galangal.org (8.7.3)

Received:from graprao.com by lemongrass.org (8.6.4)



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.