Send e-mail directly without SMTP server relay

Source: Internet
Author: User
Tags mail domain name server mail exchange

Objective

You must be familiar with the "SpeedPost" in Foxmail, it can send e-mail directly to each other's mail server, without the need to go through the SMTP server relay, so what is the benefit? First: Send faster, do not need to wait for the SMTP server to the mail for drug search, distribution, verification; second: You can keep abreast of whether the message sent success information. Sometimes we send an email with Outlook and the next day we don't get it. But my side has indeed sent a successful, had to let each other several times, to the third day the SMTP server replied, "Sorry, you sent to xxx email because xxx reason failed to service ...", the original mail was called back, Especially the last 163 mailboxes are outrageous, I sent out 10 emails, at least 3 will be called back for no reason, say what "network connection failed" so be called back, inexplicably, maybe I am free mailbox for the sake of it, no way to have to apply for more than a few mailboxes, I now have "chrys@21cn.com, Chrys.xie@gmail.com, hwxie@ust.hk ... "A lot of mailboxes, is to prevent people from sending emails when the reason to return ... It's far, I'm sorry. Third: We sometimes need to be in the program to send some sensitive information to the company's mailbox, such as: The calculation of the registration code we need users to operate our software to send the registration information back to our after-sales service mailbox, by our staff to deal with these messages.

You'll want to use SMTP (Simple Mail Transfer Protocol) to send mail via your SMTP server, but there's a big problem with security. Many well-known mail server Operators for the software through the SMTP protocol to submit frequent mail forwarding applications are not welcome, my 163 mailbox has been hurt, I was in the write SMTP client to send mail program, conveniently on the use of 163 of the SMTP server, I have just sent to the 5th email failed to send, I again log on to the 163 site to check, originally my account was blocked, the reason is that I use software to send mail too much (God, only 5 only AH), and then I spent nearly two months with Sina Company and gift and apologized, but also the identity card fax past my account to be restored.

Profiling the Mail transfer process

Nonsense say too much please don't mind, now to the end, to send the message directly to the other (POP or IMAP) server, and not through the SMTP mail server transfer, it is not difficult, you just switch to unix/linux operating system, Direct SendMail command can be completed, But I'm afraid it's going to take a little bit of effort to implement this feature under Windows. We first want to start with the protocol Rfc821-simple Mail Transfer protocol analysis.

First we look at the email delivery process:

Original message → encoding →SMTP client →smtp forwarding server → remote SMTP server (opposite side Post office).

The realization thought of "speedpost"

The message is encoded and delivered to an SMTP referral server, which is sent to the SMTP server of the remote post office based on priority and the order of the letters, after the mail is divided (to the same post office). In other words, as soon as we know how the SMTP referral server determines the address of the remote postoffice SMTP server, it can be delivered directly to the remote postoffice server. Does the SMTP referral server know the address of the remote post Office? This is the domain name resolution completed work, like we in IE browser input "www.viction.net" This domain name, ie browser how to know the target server IP address? Also is the domain name resolution server credit.

E-mail address consists of two parts, such as: Chrys@163.com, where the Chrys is the mailbox name (that is, the user name, a user corresponding to a mailbox), 163.com is the mailbox server address, mailbox name and mailbox server address between "@" as a separate.

We can find the IP address of the remote Post Office SMTP server by sending a remote post Office server address to the domain name server that queries "163.com", which is called the address query for the MX (mail exchange) mail Exchange Server. The remote post Office SMTP server may have more than one address, at this time, you can choose according to the different letter priority of the corresponding remote post office, I for the sake of security will be every remote post Office server according to the level of each attempt, as long as the mail successfully sent to one of the post Office our task is completed.

We are going to complete several programming tasks: the acquisition of native DNS, the implementation of MX instruction queries with DNS server communications, and SMTP mail submission, as described below.

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.