Original SMTP command code and working principle

Source: Internet
Author: User
Tags mx record

Http://www.linuxforum.net Jephe Wu (18:16:42) 1. SMTP works in two situations: one is the transmission of email from the client to the server, and the other is the transmission from one server to another. SMTP is a request/response protocol. commands and responses are based on ASCII text and end with CR and LF characters. The response includes a three-digit code indicating the return status. SMTP listens for connection requests on TCP port 25. connection and sending Process:. establish a TCP connection B. the client sends the HELO command to identify the sender, and then the client sends the MAIL command. The server wants to use OK as a response, indicating that it is ready to receive c. the client sends the RCPT command to identify the recipient of the email. If there are multiple RCPT lines on the server, it indicates whether the recipient is willing to accept the email d. after the negotiation ends, send an email and use the command DATA to send e. to. indicates that the input content is sent out together. end sending and QUIT with the QUIT command. 5. The other two Commands: VRFY -- used to verify whether a given user's email address exists and receive detailed information about the user. EXPN --- used to expand the mail list. 6. mail routing process: the SMTP server routes emails based on the domain name of the expected recipient in the 'domain Name Service DNS. The SMTP server routes emails Based on the MX record in the DNS. The MX record registers the domain name and the related SMTP relay host. All emails belonging to the domain should be sent to the host. If SMTP server mail.abc.com receives a letter to send to shuser@sh.abc.com:. sendmail requests the DNS to provide the cname record of the host sh.abc.com. If yes, if the CNAME is sent to shmail.abc.com, request the CNAME record of shmail.abc.com again until no CNAME record is found. assume that the CNAME is sent to shmail.abc.com, and then the DNS of the sendmail request @ abc.com domain gives the MX record of shmail.abc.com, shmail MX 5 shmail.abc.com 10 shmail2.abc.com c. sendmail finally requests the DNS to give the record of shmail.abc.com, that is, the IP address. If the returned value is 1.2.3.4 d. sendmail is connected to 1.2.3.4 to send the mail to the shuser@sh.abc.com to 1.2.3.4 the SMTP background program of this server 7. SMTP Basic command set: Command description ---------------------------- HELO identifies the user identity to the server and the sender can cheat and lie, but generally the server can detect. MAIL initialize mail Transmission MAIL from: RCPT identifies a single MAIL recipient. There are often multiple rcpt to: DATA after one or more RCPT commands, indicates that all Email recipients have been identified and the data transmission is initialized. end. VRFY is used to verify the existence of the specified user/email address. For security reasons, the server often disallows this command to EXPN to verify whether the specified email address list exists and expand the email address list, it is also often disabled to query what commands supported by the HELP server are not operated by NOOP, the server should respond to OK QUIT to end the session RSET reset session, the current transmission is canceled ---------------------------- 8. the address specified in the mail from command is called envelope from address and does not need to be the same as the sender's own address. Rcpt to is equivalent to the following: the specified receiver address is called envelope to address, but it has nothing TO do with the actual to: What is the row. 9. Why is there no rcpt cc or rcpt bcc :? All receiver negotiation is implemented through the rcpt to command. If it is BCC, after the negotiation is sent, the recipient of the envelope is deleted 10 when the recipient receives the email. the email is divided into the envelope part, the header part and the body part envelope from. envelope to is completely irrelevant to message from:, message. Evnelope is provided by the SMTP backend between server hosts, while message from/to is provided by users. It is also different if there is a colon. 11. How can I check whether a letter is forged in the envelope part? A. correlated ed rows are correlated. In the current SMTP mail Transmission System, apart from the internal host processing at both ends of the envelope part, consider the part between the two company firewalls. If the two firewall machines are A and B, but the receiver checks the envelope written ed: When the row is found to pass through C. it is forged. B. received: whether the host and IP address pairs in the row correspond to: Receibed: from galangal.org (turmeric.com [104.128.23.115] by mail .bieberdorf.edu .... c. manually added to the end of the sorted ed row: sorted ed: from galangal.org ([104.128.23.115]) by mail .bieberdorf.edu (8.8.5) stored ed: from lemongrass.org by galangal.org (8.7.3) stored Ed: from graprao.com by lemongrass.org (8.6.4) Jephe Wu

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.