Table of Content:
- What is a MX record?
- MX Record Configuration
- Useful Links
- 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: example.com
- Email Provider: email.com
- Mail Server: mx1.email.com and mx2.email.com
- Navigate to the DNS panel.
- 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 (mail.com) to email that you are hosting yourself. We will cover a couple of points here:
- The existing MX records will be edited to be mx1.email.com and mx2.email.com
- The subdomains for mx1.email.com and mx2.emial.com will be created, and Cloudflare is disabled on them both so mail can be delivered.
- 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.
- 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 -
mx1.email.com - 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.
If you experience issues following this guide, contact Cloudflare Support ticket mentioning this article, along with details of the issues that you are having.