How do I add or edit mail or MX records?

Table of Content:

  1. What is a MX record?
  2. MX Record Configuration
    1. Set up with an email provider
    2. Set up with your own email server
  3. Useful Links
  4. Troubleshooting Links


What is a MX record?

MX records are used to specify the mail server that is responsible for accepting email messages on behalf of a recipient’s domain. MX records can be created in the DNS settings of your Cloudflare dashboard. Mail will still continue to work as normal provided that you have all of the required mail and MX records in your Cloudflare DNS settings. Cloudflare operates as a HTTP/S proxy and currently does not proxy mail ports. Consult your mail provider if you are unsure of what these records should be.


MX Record Configuration

Set up with an email provider


  • Domain:
  • Email Provider:
  • Mail Server: and
  1. Navigate to the DNS panel.
  2. From the dropdown, select MX as the record type.


     3. Enter the domain name in the name field:


     4. In the next text box (it says Click to configure),  click to open the Add Record dialog.

     5.Type the address of the mail server and set the priority to 1.


Priority is a relative number. There is no default variable for this setting. The lowest number in a group of MX records will have priority over the rest.

    6. Click save. Unless specifically asked by your email provider to set a certain TTL, leave “Automatic TTL” selected. Finally click “Add Record”.






  • Most email providers will ask you to create at least 2 MX records, with two different priorities for redundancy. To create additional MX records, repeat steps 2 to 6, inserting the appropriate information as needed.
  • In some cases, your hosting provider will ask you to create additional records, such as SPF records. See How do I add an SPF record.


Set up with your own email server

This method includes migrating from a third-party provider ( to email that you are hosting yourself. We will cover a couple of points here:

  • The existing MX records will be edited to be and
  • The subdomains for and will be created, and Cloudflare is disabled on them both so mail can be delivered.

Let's start:

  1. First, we will create the subdomains for the two new mail servers. This is covered in this guide. When this is complete, you should have two new records. 
  2. If they have an orange cloud next to them, please click this so it turns grey - effectively disabling Cloudflare for them. It should look similar to the image below.



     3. Modify the MX records to point to our new mail servers by clicking the value field for the first MX record and a box should appear with details of the record.

     4. Enter the address of your first mail server - - in the server field. If this is your primary mail server, ensure the priority of the record is lower than the other record.



      5. Repeat the process for the second mail server, this time with a higher number for priority (e.g. 20).

      6. Once these two records are created, your domain should now be capable of receiving mail to your mail servers.

Note that we will disable Cloudflare for the mx1 and mx2 subdomains, because:

  • We do not proxy traffic on port 25 (SMTP).
  • If Cloudflare is not disabled for the records, mail delivery will not be successful. 

Useful Links:

How do I add Google Apps MX mail records?

How do I add Zoho records to my DNS settings?

Troubleshooting Links:

My email or mail stopped working. What should I do?
Will my mail still work after switching to Cloudflare’s name servers?


If you experience issues following this guide, contact Cloudflare Support ticket mentioning this article, along with details of the issues that you are having.

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk