If your emails are ending up in spam — or worse, being used to impersonate your brand — there is a very good chance that SPF, DKIM, or DMARC is either missing or misconfigured on your domain.
These three DNS-based protocols form the backbone of modern email authentication. Together, they tell the world’s mail servers: “This email is genuinely from us, was not tampered with in transit, and here is what to do if it fails verification.”
This guide explains exactly what each protocol does, how to configure each one step by step, and how to verify that everything is working correctly — whether you use Google Workspace, Microsoft 365, cPanel, or a self-hosted mail server.
Quick Answer: SPF tells receiving servers which IP addresses are allowed to send email for your domain. DKIM adds a cryptographic signature that proves the email was not altered. DMARC ties them together and tells servers what to do when either check fails.
What Are SPF, DKIM, and DMARC — and Why Do They Matter?
email actually came from the domain in the From address?” Without authentication records, anyone can send an email claiming to be from your domain — a technique used in phishing, business email compromise (BEC), and spam campaigns.
The three protocols each answer a different part of that trust question:
SPF (Sender Policy Framework): Published as a DNS TXT record, SPF lists the mail servers authorised to send email on behalf of your domain. If a message arrives from an unlisted server, it fails SPF.
DKIM (DomainKeys Identified Mail): DKIM adds a digital signature to every outgoing email using a private key held by your mail server. The receiving server fetches your public key from DNS and verifies the signature. Tampered emails will fail.
DMARC (Domain-based Message Authentication, Reporting & Conformance): DMARC is the enforcement layer. It requires that at least one of SPF or DKIM aligns with the From: domain — and tells receiving servers whether to quarantine or reject messages that fail.
Without all three working together, your domain is vulnerable to spoofing, your emails land in spam more often, and you have no visibility into who is sending mail on your behalf.
According to Google’s Postmaster Tools documentation, domains without DMARC are significantly more likely to have their emails rejected or filtered by Gmail — especially since Google began enforcing authentication for bulk senders in 2024.
How Do SPF, DKIM, and DMARC Compare to Each Other?
Before diving into setup, here is a clear side-by-side breakdown of what each protocol does and how they interact:
Feature
SPF
DKIM
DMARC ⭐
What it does
Authorises sending servers
Adds a cryptographic signature
Enforces SPF + DKIM policy
DNS record type
TXT
TXT
TXT
Protects against
Spoofed sending IPs
Tampered message content
Phishing & impersonation
Survives email forwarding?
No ❌
Yes ✅
Depends on alignment
Visibility to recipient?
No (backend only)
No (backend only)
Yes (reports sent to owner)
Required for DMARC?
Yes ✅
Yes ✅
N/A
Setup difficulty
Easy
Moderate
Moderate–Advanced
Can work standalone?
Yes (limited)
Yes (limited)
No — needs SPF + DKIM
The most important takeaway: DMARC cannot work without both SPF and DKIM in place. Always set up SPF and DKIM first, verify they are working, then layer DMARC on top.
What Do You Need Before You Start Setting Up Email Authentication?
Before making any DNS changes, gather the following:
Access to your domain’s DNS settings: This is usually through your domain registrar (Namecheap, GoDaddy, Cloudflare DNS, Route 53). If your DNS is managed by your hosting provider, you will need access to cPanel, Plesk, or hPanel.
Your email provider’s documentation: Google Workspace, Microsoft 365, Zoho, and others publish their own specific SPF includes and DKIM public keys. Always use the values your provider gives you — do not guess.
A DNS propagation checker: Changes can take up to 48 hours to propagate. Tools like MXToolbox and DNSChecker.org let you verify your records in real time.
A DMARC report inbox: DMARC sends aggregate XML reports to an email address you specify. Create a dedicated inbox (e.g., dmarc-reports@yourdomain.com) or use a free tool like Postmark’s DMARC analyser.
Warning: Never delete existing DNS records before verifying the new ones are working. A broken SPF record will immediately cause email failures for your entire domain.
How Do You Set Up SPF — Step by Step?
SPF is a single DNS TXT record added to your domain’s root (@). It uses a specific syntax to define which servers are authorised to send mail on your behalf.
What Does an SPF Record Look Like?
Every SPF record starts with v=spf1 and ends with either ~all (softfail) or -all (hard fail). Here is the basic structure:
# SPF Record Structurev=spf1 [mechanisms] [qualifier]all# Example — Google Workspacev=spf1 include:_spf.google.com ~all# Example — Microsoft 365v=spf1 include:spf.protection.outlook.com ~all# Example — Multiple Providersv=spf1 include:_spf.google.com include:spf.protection.outlook.com ip4:203.0.113.5 ~all
What Do the SPF Mechanisms Mean?
include: Authorises another domain’s SPF record (e.g., include:_spf.google.com delegates to Google’s list of IPs).
ip4: / ip6: Directly authorises a specific IP address or CIDR range (e.g., ip4:203.0.113.5).
a: Authorises the IP address of your domain’s A record (useful if your web server also sends email).
mx: Authorises the mail servers listed in your MX records.
~all (Softfail): Unauthorised servers are marked as suspicious but still delivered — recommended while testing.
-all (Hard fail): Unauthorised servers are rejected outright — use once you are confident your record is complete.
Create Your SPF TXT Record
Log in to your domain’s DNS management panel.
Create a new TXT record with the following values:
Name / Host: @ (or leave blank — this means your root domain)
Value: v=spf1 include:[your-provider] ~all
TTL: 3600 (1 hour) is standard
Save the record and wait for DNS propagation.
Best Practice: Only ever have ONE SPF TXT record on your domain. Multiple SPF records cause a PermError which means SPF fails completely. If you use multiple email services, combine them into one record with multiple include: statements.
A result of “SPF record found” with no errors means it is publishing correctly.
A “PermError: too many DNS lookups” means your include: chain exceeds 10 DNS queries — the most common SPF failure.
How Do You Set Up DKIM — Step by Step?
DKIM requires generating a public/private key pair. Your mail server signs outgoing emails with the private key. You publish the public key as a DNS TXT record so that receiving servers can verify the signature.
How Does DKIM Work Technically?
When your server sends an email, it generates a hash of specific header fields (From, Subject, Date, etc.) and the body. This hash is encrypted using your private key and added to the email as a DKIM-Signature header. The receiving server fetches your public key from DNS at the selector subdomain and decrypts the hash to verify it matches.
What Is a DKIM Selector?
A DKIM selector is a short label that lets you publish multiple DKIM keys for the same domain. It is part of the DNS lookup path: [selector]._domainkey.yourdomain.com. Common selectors include google, s1, mail, k1, or any string your provider assigns.
Generate and Publish Your DKIM Key
How to Set Up DKIM for Google Workspace?
Go to Google Admin Console → Apps → Google Workspace → Gmail → Authenticate Email.
Select your domain and click Generate New Record.
Google will show you a DNS TXT record with a selector (e.g., google._domainkey.yourdomain.com) and a long public key value.
Copy the TXT record value and add it to your DNS. The Host field should be: google._domainkey
Return to Admin Console and click Start Authentication once DNS has propagated.
Microsoft will display two CNAME records (selector1 and selector2) to add to your DNS.
Add both CNAME records to DNS, then return to the portal and click Enable.
How to Set Up DKIM for cPanel / Self-Hosted?
Log in to cPanel → Email → Email Deliverability.
Click Manage next to your domain.
cPanel auto-generates a DKIM key pair. Click Install Suggested Record to publish the public key.
For FastPanel or Mailcow, navigate to the domain’s mail settings — DKIM key generation is built into both panels.
# DKIM TXT Record ExampleDNS Name:google._domainkey.yourdomain.comType:TXTValue:v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…# Note:# The p= value is your base64-encoded public key.# It will be several hundred characters long — this is normal.
How Do You Verify Your DKIM Record?
Use MXToolbox DKIM Lookup and enter your domain and selector. A valid result shows “DKIM record found” with the public key details.
Alternatively, send a test email to mail-tester.com which gives you a full deliverability score including DKIM pass/fail status.
How Do You Set Up DMARC — Step by Step?
DMARC is the enforcement and reporting layer. It builds on SPF and DKIM, so both must be passing before DMARC adds meaningful value. DMARC is a single TXT record published at _dmarc.yourdomain.com.
What Are the DMARC Policy Options?
Policy (p=)
Action on Failure
Use Case
Risk Level
none
Deliver as normal; send reports only
Initial monitoring phase
🟢 Safe to start
quarantine
Send to spam/junk folder
Testing enforcement
🟡 Moderate
reject
Block the email entirely
Full protection mode
🔴 Production-ready
The recommended approach is to always start with p=none to monitor your email flow before moving to enforcement. Rushing to p=reject without monitoring will block legitimate emails you did not know about.
v=DMARC1 — Required. Identifies the record as a DMARC policy. p= — Policy to apply (none, quarantine, reject). rua= — Email address for aggregate reports (XML summaries of all mail activity). ruf= — Email address for forensic reports (copies of failing messages — use cautiously). pct= — Percentage of failing messages the policy applies to. Start at pct=10 when testing quarantine/reject. adkim= — DKIM alignment mode. r (relaxed, default) or s (strict — From domain must match exactly). aspf= — SPF alignment mode. r (relaxed, default) or s (strict). sp= — Policy for subdomains. Useful if you want stricter rules for subdomains independently.
Publish Your DMARC TXT Record
Log in to your DNS management panel.
Create a new TXT record with Name/Host: _dmarc
Set the Value to your chosen DMARC policy (start with p=none).
Set TTL to 3600.
Save and wait for DNS propagation.
Best Practice: Start with p=none and an rua= reporting address for at least 2–4 weeks before moving to quarantine. Review the aggregate reports to identify all legitimate sources of email for your domain — including CRMs, marketing tools, helpdesks, and ticketing systems.
How Do You Verify All Three Records Are Working Together?
Once SPF, DKIM, and DMARC are published, send a test email and inspect the Authentication-Results header in the received message. In Gmail, click the three-dot menu → Show Original. You should see:
EasyDMARC — Comprehensive monitoring, report parsing, and DMARC record builder.
What Are the Most Common SPF, DKIM, and DMARC Mistakes?
Problem
Likely Cause
Fix
Emails going to spam despite SPF
SPF record has too many DNS lookups (>10)
Flatten SPF or use an SPF flattening service
DKIM signature fails on forwarded email
Forwarding rewrites headers, breaking signature
Use DMARC p=none + monitor; SPF is the main check for forwarded mail
DMARC reports show unknown senders
Third-party services (CRM, helpdesk) not added to SPF
Add all sending services to SPF and configure their DKIM
Multiple SPF records causing failure
Domain has two separate TXT SPF records
Merge into a single SPF TXT record
DMARC alignment failure despite passing SPF
Return-path domain differs from From: domain
Ensure your From: domain matches your SPF authorized domain
SPF PermError: too many DNS lookups
include: chains exceed 10 DNS lookups
Remove unused includes; use ip4:/ip6: directly where possible
Critical: Publishing p=reject before verifying all legitimate sending sources is the single most dangerous DMARC mistake. It will silently block emails from your own CRM, marketing platform, or helpdesk until you identify and authorise them.
How Does DMARC Work With Third-Party Email Services?
Most businesses use multiple services that send email on their behalf — marketing platforms (Mailchimp, HubSpot), CRMs (Salesforce, Pipedrive), helpdesks (Freshdesk, Zendesk), and transactional email APIs (SendGrid, Mailgun).
Every one of these services must be authorised in your SPF record and/or configured with their own DKIM signing using your domain. If they are not, they will fail DMARC alignment and your emails from those services will be quarantined or rejected once you enforce DMARC.
How Do You Add Third-Party Services to Your SPF Record?
Each service publishes its own SPF include value. Add it to your existing SPF record:
# SPF Record (Multiple Providers)v=spf1 include:_spf.google.com include:spf.protection.outlook.com include:servers.mcsv.net include:sendgrid.net include:_spf.salesforce.com ip4:203.0.113.10~all # Common SPF Includes (Popular Services)Mailchimp:include:servers.mcsv.netSendGrid:include:sendgrid.netMailgun:include:mailgun.orgHubSpot:include:_spf.hubspot.comZendesk:include:mail.zendesk.comSalesforce:include:_spf.salesforce.comAmazon SES:include:amazonses.com
What Is DKIM Alignment and Why Does It Matter for Third-Party Senders?
DMARC alignment means the domain in the DKIM signature (d= tag) must match the From: domain in the email header. Some third-party senders sign emails with their own domain (e.g., d=mailchimp.com) by default — this will fail DMARC alignment even if DKIM passes.
To fix this, enable custom domain DKIM signing in each third-party platform. Most services allow you to add a CNAME record to your DNS that delegates DKIM signing for your domain to their infrastructure.
What Is the Recommended Rollout Timeline for SPF, DKIM, and DMARC?
A phased approach protects you from accidentally blocking legitimate email during the transition. Here is the recommended timeline for a typical small-to-medium business:
Phase
Timeline
Action
Phase 1
Day 1–3
Publish SPF record. Verify with MXToolbox. Test by sending emails and checking headers.
Phase 2
Day 3–7
Enable DKIM in your email provider. Publish the public key to DNS. Send test emails and confirm dkim=pass.
Phase 3
Week 1–2
Publish DMARC with p=none and rua= reporting. Begin collecting aggregate reports.
Phase 4
Week 2–6
Analyse reports. Identify and authorise all third-party senders. Fix SPF and DKIM for any failing services.
Phase 5
Week 6–8
Move DMARC to p=quarantine; pct=10. Gradually increase pct over two weeks while monitoring reports.
Phase 6
Month 2+
Set DMARC to p=reject. Your domain is now fully protected against spoofing and impersonation.
What Are the SPF, DKIM, and DMARC Requirements for Gmail and Microsoft in 2025?
In February 2024, Google and Yahoo/Microsoft both rolled out stricter authentication requirements that affect all bulk email senders (those sending more than 5,000 emails/day to Gmail addresses):
SPF or DKIM required: At least one must pass for any email to be delivered reliably.
DMARC required for bulk senders: p=none is sufficient to start, but a DMARC record must exist.
One-click unsubscribe: Required for marketing email — not directly related to authentication but part of Google’s 2024 sender requirements.
Spam rate below 0.1%: Monitored via Google Postmaster Tools. Persistent high spam rates lead to delivery failures.
How Do You Set Up SPF and DKIM on cPanel, Plesk, and FastPanel?
How to Enable Email Authentication in cPanel?
Log in to cPanel → Email → Email Deliverability.
Your domains are listed with a status indicator.
Click Manage next to any domain showing as “Invalid” or “Not Configured”.
Click Repair or Install Suggested Record next to the SPF and DKIM sections.
cPanel automatically generates and publishes the correct DNS records if your nameservers are pointed to cPanel’s DNS.
How to Enable Email Authentication in Plesk?
Log in to Plesk → Websites & Domains → select your domain → Mail Settings.
Check the boxes for “Enable SPF spam protection” and “Enable DKIM email signing”.
Plesk auto-generates the DKIM key and publishes it. If DNS is external, it shows you the TXT record to add manually.
How to Enable Email Authentication in FastPanel?
Log in to FastPanel → Domains → select your domain → DNS Records.
FastPanel includes a mail server stack (Postfix + Dovecot + OpenDKIM). Navigate to Mail → DKIM Settings.
Generate a new DKIM key pair. Copy the public key DNS record.
Add the TXT record manually if your DNS is external, or let FastPanel apply it if DNS is managed internally.
Add your SPF record manually in the DNS Records section.
Warning: If your domain uses external nameservers (e.g., Cloudflare), cPanel, Plesk, and FastPanel cannot automatically publish DNS records. You must manually copy the generated records and add them in your external DNS dashboard.
Ready to Protect Your Domain With SPF, DKIM, and DMARC?
Setting up SPF, DKIM, and DMARC is one of the highest-leverage technical improvements you can make to your email infrastructure. It protects your brand from being impersonated, improves deliverability to Gmail and Outlook, and gives you visibility into every server sending mail on your behalf.
Here is the quick-start checklist to take action today:
✅ Step 1: Add a single SPF TXT record at @ including all your email providers.
✅ Step 2: Enable DKIM in your email provider’s admin panel and publish the public key to DNS.
✅ Step 3: Publish DMARC with p=none and an rua= reporting address.
✅ Step 4: Monitor aggregate reports for 4–6 weeks using DMARC Analyser or EasyDMARC.
✅ Step 5: Authorise all third-party senders in SPF and DKIM, then escalate DMARC to p=reject.
Not Sure If Your Domain Is Properly Authenticated?
We audit, configure, and validate SPF, DKIM, and DMARC for businesses using Google Workspace, Microsoft 365, cPanel, or self-hosted VPS mail servers. We also handle third-party sender alignment for CRMs, helpdesks, and marketing platforms.
Do I need all three — SPF, DKIM, and DMARC — or just one?
You need all three for complete protection and optimal deliverability. SPF alone cannot prevent spoofing of the visible From: address. DKIM alone cannot prevent forged sender domains. DMARC is what enforces both checks and prevents impersonation — but it depends entirely on SPF and DKIM being correctly configured first.
Can I set up SPF, DKIM, and DMARC for free?
Yes. All three are DNS records that you publish yourself — there is no cost to the protocols themselves. However, if you want advanced DMARC report analysis and monitoring, paid tools like EasyDMARC (from ~$7/month) or Valimail save significant time by parsing the XML reports and showing you actionable data in a dashboard.
Why is my SPF record failing even though I set it up correctly?
The most common cause is exceeding the 10 DNS lookup limit. Every include: in your SPF record triggers additional DNS lookups, and include: chains can stack up quickly if you use many third-party senders. Use an SPF flattening tool to resolve includes into raw IP addresses and reduce lookup counts.
Will setting DMARC to p=reject break any of my emails?
It can — and that is exactly why you should monitor with p=none first. Emails from services you have not added to SPF, or that sign DKIM with their own domain instead of yours, will be rejected. Always audit your DMARC aggregate reports for 4–6 weeks before moving to p=reject to ensure all legitimate senders are authorised.
How long does it take for SPF, DKIM, and DMARC to take effect?
DNS propagation typically takes between 15 minutes and 48 hours, depending on your DNS provider’s TTL settings and the global propagation speed. Once propagated, the records take effect immediately on the next email sent. You can use DNSChecker.org to monitor propagation progress across different global DNS servers.
What happens if I have multiple email providers for the same domain?
You must include all of them in a single SPF record (never create two SPF records — that causes PermError). Each provider must also be configured with DKIM using your domain. DMARC will then align whichever check passes. This is common when using Google Workspace for internal email and SendGrid for transactional email — both can coexist correctly.
Does SPF, DKIM, and DMARC affect cold outreach or sales emails?
Yes, significantly. Prospects using Gmail or Outlook will have their mail servers verify your authentication records before delivering your message. Without proper SPF, DKIM, and DMARC, even well-written cold emails land in spam or are silently rejected. Correct authentication is now table stakes for any outbound sales or marketing programme.