How to set the domain to Cloudflare if the mail is hosted?

Minor corrections to the DNS zone records will be required. These are the addresses of the MX mail server, which are used to direct mail to the appropriate servers. When the Cloudflare service is enabled, the A record for the main domain will receive a new IP or will be converted into CNAME for the new domain, as a result of which the mail will stop working properly.

At this point we have to configure the appropriate records so that the mail is correctly directed to our hosting.

Configuring MX records to Cloudflare

Below is an example of our domain, which is to be directed to IP - remember to choose a domain name and IP according to your needs!

1. Login to CloudFlare and proceed to edit the zone for our domain.

2. Edit record for the mail subdomain, and main MX record, also check SPF and DKIM record if its correct.
NOTE: Those need to be excluded from traffic proxy by Cloudflare - the cloud must be gray. Then we will be sure that the mail will arrive correctly on our servers.

Cloudflare mail configuration

3. After changes approval, you need to wait for the DNS zone propagation to complete.

4. Similar domain name change will need to be made in configuration of all types of mail clients or mobile devices that you use.

Also Read