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. Select the record type as MX from the dropdown box.


     3. Input the domain name in the name field:


     4. Clicking the value field after the record has been added will open up a pop up. Type in 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 5, inserting the appropriate information as needed.
  • In some cases your hosting provider will ask you to create additional records, such as SPF records. The creation of these are covered in this guide - 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
  • Subdomains for and will be created, and Cloudflare disabled on them both so mail is able to be delivered.

Let's start:

  1. First we will create the subdomains for the two new mail servers. This is covered in the following guide here. 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. You should arrive at something similar to this -



     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

  • 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, please feel free to raise a support ticket mentioning this article, along with details of the issues that you are facing.

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk