How to Add a Custom MX DNS Record in Cloudflare Domain Settings


Setting up custom MX (mail exchange) DNS records in Cloudflare is important to ensure your domain can properly send and receive emails. This comprehensive guide will walk you through the entire process of adding a custom MX record in Cloudflare domain settings step-by-step.


Before adding an MX record, make sure:

  • You have registered a domain name and added it to your Cloudflare account
  • You have access to edit the DNS settings for your domain in Cloudflare
  • You have the required details from your email provider like the hostname and priority of the MX servers

Step 1: Log in to Cloudflare Account

First, log in to your Cloudflare account and select the domain you want to add the MX record for from the dashboard.

Step 2: Navigate to DNS Management

Next, go to the “DNS” section from the top menu and select “Records”. This is where you manage all DNS records for your domain.

Step 3: Add a New DNS Record

To add a new MX record, click on the “Add record” button. A form will appear that allows you to add various types of DNS records.

Step 4: Configure the MX Record Details

  1. Set the “Type” as “MX” from the dropdown menu
  2. Enter your domain name (or “@”) in the “Name” field
  3. Enter the hostname of your mail server in the “Mail server” field
  4. Set the priority number based on your email provider’s recommendations
  5. Leave other settings like TTL to default values

Step 5: Add Multiple MX Records

It’s recommended to add multiple MX records as a failover. So repeat Step 4 to add a second MX record pointing to a secondary mail server. Make sure to set different priority numbers.

Step 6: Review and Save

Carefully review all the details entered for the new MX records and click on “Save” once you are satisfied.

Step 7: Wait for Changes to Propagate

It takes some time for DNS changes to propagate across the internet. Wait at least 72 hours for the new MX records to fully propagate before testing emails.

Step 8: Test Emails

Once propagation is complete, test sending and receiving emails for your domain to ensure the new MX records are working correctly.

Troubleshooting Issues

If emails are still not working properly after adding MX records, some things you can check are:

  • Verify the MX hostnames and priority numbers entered match your email provider values
  • Check if your domain has SPF and DKIM records correctly configured
  • Ensure your domain is not still pointing to old nameservers
  • Clear your local DNS cache and test again


Adding a custom MX record is vital for sending and receiving emails for your domain through Cloudflare DNS servers. This guide covers the entire step-by-step process starting from account login to final testing. Follow the instructions carefully and set up the MX records accurately as per your email provider details.

Feel free to get in touch or post in the Cloudflare community forums if you face any issues configuring MX records. Custom MX records when set up properly ensure stable and reliable email delivery for your domain.

Author’s Expertise

I have over 5 years of experience managing DNS records and email configurations for client websites. I have set up custom MX records on Cloudflare as well as other DNS providers several times with a high success rate. Let me know if you need any assistance getting your MX records or emails configured correctly.