# Configuring DNS records for email in Cloudflare

> Add MX, SPF and DKIM records in Cloudflare using your cPanel values so email for your domain keeps working.

Source: https://helpcenter.ruachost.com/add-ons/cloudflare/configuring-dns-records-for-email-in-cloudflare/

Learn how to set up DNS records in Cloudflare so your domain’s email works correctly.

### **DNS Records in Cloudflare**

When you add a domain to Cloudflare, it usually scans and imports your domain’s DNS records automatically. However, there may be times when you need to manually add or update records to ensure your email continues to function correctly.

For example, if a domain’s TXT record for SPF is changed or deleted with the domain registrar, Cloudflare may not detect the change, and you would need to add it manually.

### **Primary DNS Records for Email**

The main DNS records related to email are:

- **MX (Mail Exchanger) record:** Directs email to your mail servers. Most domains have multiple MX records.
- **SPF (Sender Policy Framework) record:** A TXT record used to verify sending servers.
- **DKIM (DomainKeys Identified Mail) record:** A TXT record used to authenticate outgoing email.

### **Steps to Configure DNS Records in Cloudflare**

#### **Step 1: Get Current DNS Values from cPanel**

1. Log in to cPanel.

   - **Note:** If you don’t know how to log in, see this article.
2. On the Tools page, under **Domains**, click **Zone Editor**. ![cPanel - Domains - Zone Editor icon](https://helpcenter.ruachost.com/kb-images/991e6947b944.webp)
3. Locate the domain and click **Manage**.
4. Note the values for MX, SPF, and DKIM records.

#### **Step 2: Log in to Cloudflare**

1. Go to <https://dash.cloudflare.com/login> and log in.
2. On the Home page, click your domain. ![Cloudflare - Account home page](https://helpcenter.ruachost.com/kb-images/45fe98772dda.webp)
3. In the left sidebar, click **DNS**.

![Cloudflare - Account sidebar - DNS](https://helpcenter.ruachost.com/kb-images/f5304bc06e50.webp)

#### **Step 3: Add the MX Record**

1. In the DNS management section, click **Add record**. ![Cloudflare - Account - Add record](https://helpcenter.ruachost.com/kb-images/fee68ab51d65.webp)
2. Select **MX** for the Type. ![Cloudflare - Account - Add MX record](https://helpcenter.ruachost.com/kb-images/4c45f18f0408.webp)
3. In the **Name** box, enter the value from cPanel.
4. In the **Mail server** box, enter the destination from cPanel.
5. Set **TTL** to **Auto**.
6. In **Priority**, enter the value from cPanel.
7. Click **Save**.

   - **Note:** Repeat these steps for additional MX records if needed.

#### **Step 4: Add the SPF Record**

1. Click **Add record**. ![Cloudflare - Account - Add record](https://helpcenter.ruachost.com/kb-images/fee68ab51d65.webp)
2. Select **TXT** for the Type. ![Cloudflare - Account - Add TXT record](https://helpcenter.ruachost.com/kb-images/e281f4fbfd64.webp)
3. In **Name**, enter the value from cPanel.
4. Set **TTL** to **Auto**.
5. In **Content**, enter the SPF record value from cPanel.
6. Click **Save**.

#### **Step 5: Add the DKIM Record (if applicable)**

1. Click **Add record**. ![Cloudflare - Account - Add record](https://helpcenter.ruachost.com/kb-images/fee68ab51d65.webp)
2. Select **TXT** for the Type. ![Cloudflare - Account - Add TXT record](https://helpcenter.ruachost.com/kb-images/e281f4fbfd64.webp)
3. In **Name**, enter the DKIM value from cPanel.
4. Set **TTL** to **Auto**.
5. In **Content**, enter the DKIM value from cPanel.
6. Click **Save**.

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