Preface
I have previously written an article on how to build your own mailbox using home broadband. However, this kind of self-built mailbox can only receive messages. Whether or not the messages can be sent to the other party's mailbox depends entirely on the email security policy of the email provider used by the other party (see the article for the construction and subsequent test results:Docker series builds a mail server based on poste.io): The result is that you will most likely not be able to get in. After all, spam is rampant, and each large email provider has its own complete email rating standards. It is just overthinking to just build an email box and send emails everywhere. So it seems a waste to spend so much energy to build an email box just to receive emails. Moreover, the key is that it also exposes your source site address. If you are directly attacked, it will waste the traffic cleaning function of cloudflare. But I really want to have an email box with my own domain suffix, so that when I leave an email address to others, I can leave a similar[email protected]
Still very skin-loving.
Is there any efficient way to achieve this? Of course there is, that is the "email routing" function provided by cloudflare for free. In simple terms, it is similar to the "sub-account" function provided by mobile phone operators in the past. You can add email addresses based on your domain name suffix on cloudflare at any time. For example, if your domain name is "example.com", you can add email addresses such as[email protected]
,[email protected]
You can specify different email addresses to send emails to. The advantage of this is that you can hide the address of your real email address, and you can change your external email address at any time (why do you feel like doing something bad?). The disadvantage is that you need a special method to use these custom email addresses to send emails, such as using the sending email function on gmail, and whether you can get into the other party's mailbox depends on luck. . . . However, if the demand is just to receive emails, then this method is perfect.
Configuring Email Routing
Enter the domain name configuration interface of Cloudflare, in "Email" - "Email Routing" - "Get Started":
Fill in the prefix of the custom mailbox, configure the actual bound target mailbox, and then click "Create and Continue" below:
The following interface appears:
At this time, you need to find the verification email sent by cloudflare in the target mailbox and click the verification link in the email to complete the verification:
Note: In theory, after clicking the button in the red box above, you should enter the configuration interface of MX records and dmarc's txt records, but I don't know what happened to Cloudflare, and it bounced me back to the start page:
But the actual process is to configure the MX record and the dmarc txt record. I configured the email routing of 2 domain names and encountered this problem. It should be a bug. The solution is also very simple. Go through the process again and change the custom address:
At this time, the following interface will appear directly. You can see that the target address status is verified, because the previous custom address has been successful, but the interface has not appeared. Then click "Continue" in the red box below:
Then you come to the interface that should have appeared but did not appear. You can directly click "Add record and enable" in the red box at the bottom:
You can see that the routing status is green "Enabled". At this time, the custom email address can receive emails and forward them to the bound target email address:
In "Routing Rules", you can see the two custom email addresses you just created. You can also create more custom addresses in this interface, or delete existing email addresses. Just select the Edit button to the right of the custom address you want to delete:
In "Target Address", you can see all bound target email addresses, and you can also add new target email addresses:
In the "Settings" menu, you can add this feature to other subdomains of the main domain:
I haven't studied this, I don't have this need.
Send emails on behalf of others
If you want to set up sending emails, it is recommended to use Gmail's sending. The specific configuration location of Gmail is as follows:
I will not write about the specific configuration steps in detail here. There are many tutorials on the Internet, but the main significance is not very great. After testing, either I can enter the recipient's mailbox, but the prompt is that it is sent on behalf of others (gmail, qq); or it goes directly to the spam box (outlook, NetEase). Some corporate mailboxes may even have dangerous prompts such as identity authentication failure. So forget about sending emails. I can only say that using gmail to send emails is a little better than using my own mailbox with home broadband to send emails.
Summarize
In short, for some special occasions, such as the administrator mailbox that provides external contact information, which is mainly used to receive emails, then cloudflare's email routing function is very practical, at least it is much more convenient and hassle-free than me using my home broadband to set up a mailbox just to receive emails. Moreover, more importantly, different custom mailbox prefixes can be created according to different purposes and bound to different target mailboxes, and the mailbox prefix can be changed at any time (I feel more and more that it is doing something bad), which at least saves the time of tossing the real mailbox in special scenarios.