How to configure SPF, DKIM, and DMARC on cPanel
SPF, DKIM and DMARC prove to mail servers that the emails sent in your domain's name really come from you. This guide shows how to configure SPF, DKIM and DMARC on cPanel, and how to add DMARC to your domain, with the Email Deliverability tool. It then covers adding the records by hand, the syntax of each record and the fixes for common errors.
What SPF, DKIM and DMARC do
They are three TXT records in your domain's DNS zone, and they work together.
| Record | Role | Name in the zone |
|---|---|---|
| SPF | lists the servers allowed to send for the domain | the domain itself (@) |
| DKIM | publishes the key that checks the signature of each message | default._domainkey |
| DMARC | tells the recipient what to do with a message that fails, and where to send reports | _dmarc |
Without them, your messages land in spam more often, and anyone can send emails that seem to come from your domain. Since February 2024, Gmail and Yahoo require SPF or DKIM from every sender, and all three from bulk senders.
Check the domain in Email Deliverability
The cPanel Email Deliverability tool checks SPF, DKIM and DMARC for each of your domains.
In the client area, open your hosting page and click Advanced panel at the top right. cPanel opens straight away, with no login details to type.
In the Email section, click Email Deliverability.
The page lists your domains. The Email Deliverability Status column shows "Valid" when everything is in place. Otherwise it shows "Problems Exist" and names the records at fault, for example "(DMARC, DKIM, and SPF)".

The page shows the real status of your own domain. In the screenshot, the example domain does not use the OuiHeberg name servers, hence "Problems Exist" on every line. A domain that uses the servers ns1.ouiheberg.com to ns4.ouiheberg.com should normally switch to "Valid" once the suggested records are installed.
The Repair button fixes all the records of a domain at once. The Manage button opens the details, record by record.
Both buttons only work if your domain uses the hosting's nameservers,
ns1.ouiheberg.comtons4.ouiheberg.com. Otherwise, add the records with the provider that runs your DNS (see below).
Install the suggested records
Click Manage next to the domain. The page has a part for DKIM, one for SPF, one for DMARC and one for Reverse DNS (PTR). Each shows its status and, if there is a problem, the record cPanel suggests, with its Name and Value.
Read the suggested record in the part with an error.
Click Install The Suggested Record.
Do the same for the other parts, then go back to the list.
The status changes to "Valid" once the records are published.

For SPF, cPanel suggests a record such as
v=spf1 +mx +a +ip4:203.0.113.10 ~all, with your server's IP address. If you also send through another service, the Customize link lets you complete the value before installing it.For DMARC, cPanel suggests
v=DMARC1; p=none;. This policy watches without blocking anything. Tighten it step by step afterwards (DMARC section below).The Reverse DNS (PTR) part concerns the server itself. It is not set in your zone.
A yellow box says "This system does not control DNS"? Your domain uses other nameservers, so the install button would have no effect. Copy the Name and Value with the Copy links, then add them by hand.
Add the records by hand
Adding records by hand is for when your DNS is managed elsewhere, or when you want to write a record yourself. Everything happens in the domain's DNS zone.
In the client area, the hosting's zone is edited in the DNS zone tab, with Expert Mode. The guide How to edit the DNS records of your domain covers the add window.
In cPanel, use the Zone Editor, described in Create and manage your DNS records on cPanel.
If the domain uses other nameservers, add the records with that DNS provider or with your registrar.
In the client area's Add a record window, keep the Manual template, choose the TXT Type, then fill in Name and Value.

| Record | Name | Value |
|---|---|---|
| SPF | @ | v=spf1 +mx +a +ip4:203.0.113.10 ~all |
| DKIM | default._domainkey | v=DKIM1; k=rsa; p=MIIBIjANBgkqh… (the full key given by cPanel) |
| DMARC | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@mysite.com |
Use the IP address and the DKIM key shown by Email Deliverability, not the ones in the example. The default prefix is the cPanel DKIM selector. Other services often use another selector, such as google or selector1.
A domain must have only one SPF record. If you send through several services, combine them in the same record.
Write the SPF record
An SPF record starts with v=spf1, lists the allowed sources, then ends with a rule for everything else.
| Item | Meaning |
|---|---|
v=spf1 | protocol version, always first |
+a | allows the IP address of the domain's A record |
+mx | allows the domain's MX servers |
+ip4:203.0.113.10 | allows a specific IP address |
include:_spf.google.com | adds the servers allowed by another domain |
~all | soft fail, other sources are treated as suspicious |
-all | hard fail, other sources are rejected |
?all | neutral, no instruction |
A few records depending on how you send.
| Situation | SPF record |
|---|---|
| hosting email only | v=spf1 +mx +a +ip4:203.0.113.10 ~all |
| hosting and Google Workspace | v=spf1 +mx +a +ip4:203.0.113.10 include:_spf.google.com ~all |
| Google Workspace only | v=spf1 include:_spf.google.com ~all |
| Microsoft 365 only | v=spf1 include:spf.protection.outlook.com ~all |
Start with ~all. Switch to -all once you are sure you have listed all your sending services.
Tighten DMARC step by step
The p=none policy blocks nothing. Add a rua address to receive reports on the emails sent in your domain's name. Once you have checked those senders, tighten the policy in steps of a few weeks.
# Step 1, watch
v=DMARC1; p=none; rua=mailto:dmarc@mysite.com
# Step 2, quarantine in test mode
v=DMARC1; p=quarantine; rua=mailto:dmarc@mysite.com; t=y
# Step 3, quarantine
v=DMARC1; p=quarantine; rua=mailto:dmarc@mysite.com
# Step 4, reject
v=DMARC1; p=reject; rua=mailto:dmarc@mysite.com
With p=quarantine, failing messages go to spam. With p=reject, they are refused. The t=y tag announces a test, and the recipient then applies the policy one level lower. It replaces pct, removed by RFC 9989 in May 2026. Servers that still follow the older standard ignore t, which is why starting with p=none matters.
Do not jump straight to
p=reject. A sending service missing from SPF or DKIM would have its messages refused.
DMARC tags
| Tag | Values | Role |
|---|---|---|
v | DMARC1 | version, required and first |
p | none, quarantine, reject | policy for the domain |
sp | none, quarantine, reject | policy for subdomains |
t | y, n | test mode (policy applied one level lower) |
rua | mailto:address | address for aggregate reports |
ruf | mailto:address | address for detailed failure reports |
adkim | r (relaxed), s (strict) | DKIM alignment |
aspf | r (relaxed), s (strict) | SPF alignment |
fo | 0, 1, d, s | cases that trigger a failure report |
A full example, with a softer policy for subdomains.
v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc@mysite.com; ruf=mailto:forensic@mysite.com; fo=1
Read DMARC reports
Aggregate reports arrive in XML at the rua address. Each block gives a sending IP address, a number of messages and the SPF and DKIM results.
<record>
<row>
<source_ip>203.0.113.10</source_ip>
<count>10</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>pass</spf>
</policy_evaluated>
</row>
</record>
An unknown IP that fails can be a service you forgot, or a spoofing attempt. DMARC report analysis services, often with a free tier, make these files readable.
Authenticate an external sending service
Every service that sends in your domain's name must be listed in SPF and sign with DKIM.
For Google Workspace, add
include:_spf.google.comto your SPF. The DKIM key is generated in the Google Admin console, on the Gmail email authentication page. Google gives a TXT record, usually ongoogle._domainkey.For Microsoft 365, add
include:spf.protection.outlook.comto your SPF. Microsoft gives two CNAME records for DKIM, onselector1._domainkeyandselector2._domainkey.For a bulk sending service (SendGrid, Brevo, Mailjet, Amazon SES, Mailchimp…), copy the records its dashboard gives you when you verify the domain. Several of them no longer ask for an SPF
includeand rely on DKIM only.
In the client area, the Add a record window also offers Google Workspace and Microsoft 365 templates. They set the service's MX and SPF records. Then check that the domain has only one SPF record.
Check the setup
Go back to Email Deliverability. Every domain should show "Valid". You can also query the DNS from your computer.
# Linux and macOS
dig TXT mysite.com +short
dig TXT default._domainkey.mysite.com +short
dig TXT _dmarc.mysite.com +short
# Windows
nslookup -type=TXT mysite.com
nslookup -type=TXT default._domainkey.mysite.com
nslookup -type=TXT _dmarc.mysite.com
Without a terminal, our DNS lookup tool shows the TXT records of a name. For an end-to-end test, send a message to the address given by mail-tester.com. The report scores SPF, DKIM and DMARC. MXToolbox also checks these records.
Fix common errors
SPF, too many DNS lookups
An SPF record cannot trigger more than 10 DNS lookups. Each include, a and mx counts for at least one. Remove the services you no longer use, or replace an include with the service's ip4 addresses when it publishes them.
SPF, several records
Two records that start with v=spf1 make SPF invalid. Merge them.
# Wrong, two records
v=spf1 +mx +a ~all
v=spf1 include:_spf.google.com ~all
# Right, a single record
v=spf1 +mx +a include:_spf.google.com ~all
DKIM not found
Check the selector. The name takes the form
selector._domainkey.mysite.com.Check that the key was copied in full.
Wait for propagation to finish. It depends on the record's TTL.
DKIM key too long
A TXT string cannot exceed 255 characters. A longer key is split into several quoted strings, within the same record. In Email Deliverability, the Split option shows the key already cut. Many DNS interfaces do this split on their own.
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..." "...rest of the key..."
DMARC not found
The name must be exactly _dmarc, that is _dmarc.mysite.com. The value must start with v=DMARC1;, followed by p=.
Messages still land in spam
Check that SPF, DKIM and DMARC are "Valid" in Email Deliverability.
Check with MXToolbox that the sending IP address is not on a blocklist.
Reread the message itself. A misleading subject, a single large image or shortened links raise the spam score.
The guide Manage emails on cPanel explains how to track a message's delivery.
Need help?
Open a ticket from Tickets › Open a ticket (dash.ouiheberg.com/tickets/new), or click the Contact support tile at the bottom of your hosting page. You can also ask your question on our Discord.
cPanel hosting with email accounts and databases, managed from the OuiHeberg client area.
View plans →