> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuring DNS records for email in Cloudflare

> Learn how to configure DNS records in Cloudflare so your domain's email works correctly.

This article describes how to configure DNS records in Cloudflare so your domain's email works correctly.

## DNS records in Cloudflare

When you add a domain to Cloudflare, in most cases it automatically scans and imports your domain's DNS records. You do not need to take any further action.

There may be occasions however, when you must manually add records to Cloudflare to ensure your email continues to function correctly. For example, if a domain's TXT record for SPF is deleted or updated with the domain registrar, Cloudflare may not detect this change. In this case, you would need to manually add the TXT record in Cloudflare.

## Adding DNS records to Cloudflare

There are three primary DNS records related to email:

* **MX (Mail Exchanger) record**: Most domains have multiple MX records.

* **SPF (Sender Policy Framework) record**: This is a TXT record.

* **DKIM (DomainKeys Identified Mail) record**: This is a TXT record.

To configure these records in Cloudflare, follow these steps:

1. Get the current values of the DNS records in cPanel:

   * Log in to cPanel.
     > 📘 Note
     >
     > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

   * On the Tools page, in the **Domains** section, click **Zone Editor**:\
     ![cPanel - Domains - Zone Editor icon](https://static.hosting.com/kb/kb-cpanel-jupiter-zone-editor-icon.png)

   * Under **Domains**, locate the domain for which you want to add a record, and then click **Manage**.

   * Note the values for the MX, SPF, and DKIM records.

2. Go to [https://dash.cloudflare.com/login](https://dash.cloudflare.com/login) and log in to your Cloudflare account.

3. On the Home page, click the domain:\
   ![Cloudflare - Account home page](https://static.hosting.com/kb/kb-cloudflare-account-home-page.png)

4. In the left sidebar, click **DNS**:\
   ![Cloudflare - Account sidebar - DNS](https://static.hosting.com/kb/kb-cloudflare-account-dns-sidebar.png)

5. Add the MX record:

   * In the **DNS management** section, click **Add record**:\
     ![Cloudflare - Account - Add record](https://static.hosting.com/kb/kb-cloudflare-account-add-record.png)

   * In the **Type** list box, select **MX**:\
     ![Cloudflare - Account - Add MX record](https://static.hosting.com/kb/kb-cloudflare-account-add-record-mx.png)

   * In the **Name** text box, type the value from the **Name** column for the MX record in cPanel.

   * In the **Mail server** text box, type the destination from the **Record** column of the MX record in cPanel.

   * In the **TTL** list box, select **Auto**.

   * In the **Priority** text box, type the priority from the **Record** column of the MX record in cPanel.

   * Click **Save**. Cloudflare saves the MX record.

   > 📘 Note
   >
   > If your domain has multiple MX records, repeat these steps for the other MX records.

6. Add the SPF record:

   * In the **DNS management** section, click **Add record**:\
     ![Cloudflare - Account - Add record](https://static.hosting.com/kb/kb-cloudflare-account-add-record.png)

   * In the **Type** list box, select **TXT**:\
     ![Cloudflare - Account - Add TXT record](https://static.hosting.com/kb/kb-cloudflare-account-add-record-txt.png)

   * In the **Name** text box, type the value from the **Name** column for the SPF record in cPanel.

   * In the **TTL** list box, select **Auto**.

   * In the **Content** text box, type the value from the **Record** column for the SPF record in cPanel.

   * Click **Save**. Cloudflare saves the SPF record.

7. If your domain uses DKIM, you should add that record as well. To do this:

   * In the **DNS management** section, click **Add record**:\
     ![Cloudflare - Account - Add record](https://static.hosting.com/kb/kb-cloudflare-account-add-record.png)

   * In the **Type** list box, select **TXT**:\
     ![Cloudflare - Account - Add TXT record](https://static.hosting.com/kb/kb-cloudflare-account-add-record-txt.png)

   * In the **Name** text box, type the value from the **Name** column for the DKIM record in cPanel.

   * In the **TTL** list box, select **Auto**.

   * In the **Content** text box, type the value from the **Record** column for the DKIM record in cPanel.

   * Click **Save**. Cloudflare saves the DKIM record.

8. Cloudflare is now configured to use your domain's email settings.

## Related articles

* [Activating Cloudflare](/docs/how-to-activate-cloudflare)

* [Troubleshooting Cloudflare connections](/docs/troubleshooting-cloudflare-connections)

* [Turning off Cloudflare](/docs/turning-off-cloudflare)

* [Using Cloudflare to defend against DDoS attacks](/docs/using-cloudflare-to-defend-against-ddos-attacks)

* [Using SSL with Cloudflare](/docs/using-ssl-with-cloudflare)

* [What is Cloudflare?](/docs/what-is-cloudflare)
