Set Up SPF, DKIM, and DMARC for cPanel Email with Cloudflare DNS

By Dave TanguayPublished Editorial draft

Quick Answer

For cPanel-hosted email with Cloudflare DNS, obtain the account’s correct SPF and DKIM requirements from the actual sending provider, reconcile them with existing senders, and publish the approved records in Cloudflare’s authoritative zone. Add or review the domain’s DMARC policy separately. Confirm that the sender signs mail and test received-message authentication. cPanel’s local DNS records and Repair controls do not automatically update an external Cloudflare zone.

This guide covers authentication for an existing email setup. It does not require moving the website, changing mailbox providers, or changing registrar nameservers. If you are migrating DNS authority too, first use the cPanel-to-Cloudflare DNS migration guide to preserve the complete zone and handle delegation and DNSSEC.

The correct records depend on what actually sends your mail. A cPanel website can send through its hosting server, an external mailbox provider, or an application delivery service. Cloudflare can manage public DNS for all of those arrangements.

1. Confirm the mail provider and authoritative DNS

Identify the website host, mailbox provider, outbound sending services, registrar, and public DNS provider. These responsibilities can belong to different companies. A cPanel login does not establish that cPanel hosts employee mail or controls public DNS.

Check the domain’s delegation and the active authoritative nameservers. In the usual full Cloudflare setup, the registrar delegates the domain to its assigned Cloudflare nameservers. If the setup is partial, delegated, or otherwise unfamiliar, have the DNS administrator confirm which zone owns each record.

Use the values from your actual service account. If employee mail uses Google Workspace or Microsoft 365 while cPanel hosts only the website, follow that mail provider’s authentication instructions. Do not replace working provider records with cPanel’s suggested values merely because they appear in the hosting panel.

2. Preserve existing values and inventory all senders

Before an approved edit, export or record the active names, record types, contents, priorities, and TTLs. Save the cPanel or sending-service configuration separately. Record who approved the change and which values would be needed to restore the previous state.

Include employee mail, forms, account notifications, store messages, newsletters, invoices, and support tools. Identify their visible From domain, envelope domain, and DKIM signing domain from provider settings and received examples where available.

Scroll horizontally to see all columns.

What the record inventory should distinguish
Record or setting Purpose Owner to confirm
SPF TXT policy Authorizes the appropriate sending sources for a checked domain. All services sending with that envelope domain.
DKIM selector record Publishes a public key or delegates the selector lookup to the provider. The service that holds the private key and signs messages.
DMARC TXT policy Defines the domain’s alignment policy and requested treatment/reporting. The domain owner with the email administrator.
MX and mail-host address Directs incoming mail to the intended service. The mailbox provider.
cPanel Email Routing Controls the server’s treatment of mail for the domain. The hosting administrator.

MX and routing are not substitutes for authentication, but an unrelated change to either can stop mail. Preserve them while carrying out an authentication task unless the investigation specifically requires a separate correction.

3. Obtain the sender’s exact SPF and DKIM requirements

For mail that genuinely originates from the cPanel service, open Email Deliverability and manage the intended domain. Availability depends on the host’s enabled features and installed version. cPanel’s current Email Deliverability documentation describes its suggested records and distinguishes local installation from updating an external authoritative nameserver.

Record the complete suggested name and value. Confirm with the host that these describe the real outbound path, including any relay service. DKIM requires the sending system to have the corresponding private key and to sign the relevant messages. Only the public key or provider-specified delegation belongs in DNS.

For another sending provider, use that provider’s account-generated values instead. Different services can use different DKIM selectors. Keep active selectors required by other services; replacing all DKIM records with one hosting record can interrupt them.

Our SPF guide explains one-policy and lookup constraints, while the DKIM guide explains signatures, selectors, and key publication. Use those details when reconciling the complete sender inventory.

4. Reconcile SPF before saving the Cloudflare record

Inspect the existing TXT records at the exact DNS name. Several unrelated TXT records can coexist, but the SPF check must not select multiple competing v=spf1 policies at that name. Adding a second SPF policy beside the first is not a valid way to add another provider.

Have the administrator combine legitimate requirements within the applicable policy and check the evaluation’s DNS lookup limits. A long list of copied include terms can fail even when each provider supplied a valid individual example. A deliberate sending subdomain can have its own policy when the sending configuration uses it.

In Cloudflare, select the verified domain and open its DNS records. Edit the intended TXT policy or create it only if none exists at that name. The zone apex is commonly represented as @; a sending subdomain has its own name. Check the resulting full hostname before saving.

Use the exact approved content and inspect it again after saving. Keep verification TXT records unrelated to SPF. Do not remove records merely because they are not part of this particular email task.

5. Publish the correct DKIM selector records

A DKIM lookup normally uses a selector-specific name such as selector1._domainkey.example.com. This is a reserved-domain illustration. Your provider supplies the real selector, signing domain, record type, and value.

If the provider supplies a TXT record, add the public-key value at that selector name. If it supplies a CNAME, preserve the exact target. Do not invent a TXT key as a replacement for a required CNAME or paste a private key into either field.

Check whether the DNS interface expects a relative name or accepts the full hostname. A duplicated domain suffix can create a record in the wrong place. Inspect the saved full name and later query the exact selector used in the message’s s= and d= values.

Keep provider-specified DKIM CNAMEs DNS only in the normal Cloudflare setup. TXT records have no website-proxy option. Cloudflare’s email-record setup documentation covers adding email-related DNS records. Complete the provider’s verification or signing-enablement step as required, then test a fresh outgoing message.

Also inspect CNAME flattening if a provider requires a selector CNAME. Cloudflare’s email troubleshooting documentation explains that global or per-record flattening can hide the required CNAME answer. Verify the actual returned type and target, and adjust the relevant flattening setting when the provider requires the CNAME to remain visible.

6. Review DMARC as a separate policy decision

Look for the existing policy at _dmarc for the relevant domain. Preserve a working policy unless an approved review calls for changing it. Do not add a second competing DMARC policy or silently replace a reporting destination.

If the domain is introducing DMARC, a monitoring policy can help identify sending sources and alignment failures without requesting quarantine or rejection for DMARC failure. Choose a reporting destination the responsible team controls and can review. A record alone does not assign someone to interpret reports.

Whether to request stronger treatment depends on the domain’s uses, legitimate senders, and indirect delivery. The DMARC record and rollout guide covers those decisions and the current specification. Avoid copying an old percentage-based rollout recipe without reviewing current standards and receiver behavior.

SPF passing for a provider domain or DKIM signing with a provider’s own domain may leave your visible From domain unaligned. Verify that the actual messages have a passing aligned path before treating the DMARC setup as ready.

7. Keep mail delivery and website proxying separate

Cloudflare’s ordinary website proxy does not carry SMTP, IMAP, or POP connections. Its email troubleshooting guidance explains that an MX record’s target and other mail-service hostnames must resolve directly as required by the provider. An MX record itself is DNS-only, but a proxied address record behind its target can still cause trouble.

Review a mail hostname that aliases the website apex before proxying that website name. Do not assume that the mail route remains direct because the MX record has no orange-cloud control. Keep Cloudflare Email Routing separate from an existing mailbox service; enabling another routing product is not an authentication repair.

Check cPanel’s Email Routing setting with the host. cPanel documents that automatic detection reads the local zone file, rather than performing a public DNS lookup, and does not continuously revise the setting after later changes. Choose local, remote, or backup behavior according to the actual mail service, not a universal recipe.

8. Verify DNS at the authoritative source

Check the saved records outside the editing form. These illustrative read-only queries use a reserved domain and selector; replace them only with the domain and selector you are authorized to inspect:

dig example.com NS +short
dig example.com TXT +short
dig selector1._domainkey.example.com TXT +short
dig selector1._domainkey.example.com CNAME +short
dig _dmarc.example.com TXT +short
dig example.com MX +short

If a recursive answer disagrees with the dashboard, query the verified authoritative nameserver directly and compare the full hostname, type, content, and TTL. Resolver caches can retain earlier answers. There is no single elapsed-time promise that establishes publication everywhere.

A TXT answer split into several quoted strings is not automatically several SPF or DKIM records. Inspect the resource records and the provider’s supported formatting rather than judging the display alone.

9. Test actual messages and preserve the result

Send a non-sensitive authorized test from each real service: employee mail, website notification, and any other route affected by the change. Use a controlled receiving account and inspect the received message’s authentication results.

  1. Record the send time, time zone, message type, and provider identifier where available.
  2. Confirm the SPF result and checked envelope domain.
  3. Confirm the DKIM result, signing domain, and selector.
  4. Confirm DMARC alignment against the visible From domain.
  5. Record whether the recipient accepted, quarantined, rejected, or displayed the message in a particular folder.
  6. If routing was involved, test an independent inbound message and reply as well.

A cPanel “valid” status or a successful public lookup is one observation. Neither proves that every sending service signs correctly or that the destination places mail in the inbox. For a missing notification, follow the form delivery path. For mail that authenticates but is filtered, use the spam troubleshooting guide.

Troubleshoot the failed layer before rolling back

If the authoritative answer is wrong, compare it with the preserved value and correct the exact record. If the answer is right but DKIM is absent, inspect sender signing settings and the actual message route. If SPF passes but DMARC fails, check alignment rather than adding another SPF policy.

If mail stops after an unrelated proxy or routing edit, restore that specific saved setting with the responsible provider and verify the service again. Moving nameservers back is a separate DNS transition, not the first response to every record or sender problem.

Retain a small before-and-after record, the approved changes, and the observed tests. DNS restoration is subject to caching too. Avoid removing active keys or selectors until the corresponding provider confirms they are no longer needed.

Key Takeaways

  • Identify the actual sending provider and public DNS authority first.
  • Reconcile existing senders instead of replacing their requirements with a hosting default.
  • Publish approved records in the authoritative zone and confirm signing at the sender.
  • Keep mail-host proxy status, MX, and cPanel routing separate from authentication.
  • Verify both DNS and actual received messages for every affected sending route.

Frequently Asked Questions

Will cPanel Repair update Cloudflare DNS?

Do not assume so. When an external service controls authoritative DNS, the relevant public records need to be updated there through the supported process. cPanel’s local records can still matter to its own operation.

Should I replace my current SPF policy with cPanel’s suggested one?

First identify every legitimate sender using that domain. A hosting suggestion may describe only cPanel-originated mail. Reconcile the complete requirements and lookup behavior before an approved edit.

Should I proxy a DKIM CNAME in Cloudflare?

Use DNS-only for the normal provider-specified DKIM delegation. Preserve the exact name and target. The website proxy serves a different purpose.

Why does DKIM fail when the DNS record exists?

The sender may use a different selector or domain, signing may not be enabled, the public key may not match the signing key, or the message may have changed after signing. Inspect a relevant received message and the sender’s configuration.

Does a website hosted in cPanel have to use cPanel email?

No. Website hosting, mailbox service, outbound delivery, and DNS can be separate. Use each actual provider’s supported settings and verify how the routes connect.

Plan the change with the responsible providers

Our cPanel hosting service describes the available hosting scope. If the issue involves a website or its sending integration, contact Interactive Online with the provider names, affected message type, and non-sensitive diagnostic details. Keep the mail administrator involved when a change affects employee mail or a third-party sending service.

Archives