SMTP original command code and working principle-PHP Tutorial

Source: Internet
Author: User
Tags mx record
The original authorization code and working principle of the SMTP protocol. Www. linuxforum. netJepheWu (2001-04-2118:16:42) 1. SMTP works in two situations: one is to transfer an email from the client to the server, and the other is to transfer the email from one server to another. 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

Http://www.bkjia.com/PHPjc/531900.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531900.htmlTechArticlehttp://www.linuxforum.net Jephe Wu (18:16:42) 1. SMTP is working in two cases: one is the transfer of email from the client to the server; the other is the transfer from one server to another...

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.