Email is the most impersonated communication channel in business. Without proper authentication, anyone can send an email that appears to come from your domain. A scammer can send an invoice from "accounting@yourbusiness.com" to your clients, and without SPF, DKIM, and DMARC in place, the receiving mail server has no way to verify whether the email is legitimate.
In 2024, Google and Yahoo began requiring SPF, DKIM, and DMARC for all bulk email senders. By 2026, Microsoft and other major providers have followed suit. If your domain lacks these records, your legitimate emails are increasingly likely to land in spam folders or be rejected entirely. Setting up all three takes about 30 minutes and protects your brand, your customers, and your email deliverability.
The Problem: Email Spoofing
The email protocol (SMTP) was designed in the 1980s without any built-in authentication. Anyone can set the "From" address on an email to any value they want, just like writing any return address on a physical envelope. SPF, DKIM, and DMARC were created to solve this fundamental design flaw.
Without these protections, attackers can:
- Send phishing emails impersonating your business to trick customers into revealing passwords or payment information
- Send fake invoices from your domain to divert payments to their accounts
- Damage your brand reputation by associating your domain with spam
- Get your domain blacklisted by email providers, preventing your legitimate emails from being delivered
SPF (Sender Policy Framework)
What It Does
SPF tells receiving mail servers which IP addresses and mail servers are authorized to send email on behalf of your domain. When an email arrives claiming to be from your domain, the receiving server checks your SPF record to verify the sending server is on the approved list.
How It Works
- You publish an SPF record in your domain's DNS (a TXT record).
- The record lists all servers authorized to send email for your domain.
- When a receiving server gets an email from your domain, it checks the sending server's IP against your SPF record.
- If the IP matches, the email passes SPF. If not, it fails.
Example SPF Record
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 -all
This record says: "Emails from my domain can only come from Google Workspace servers, SendGrid servers, or the IP address 203.0.113.5. Reject anything else (-all)."
How to Set Up SPF
- Identify all services that send email from your domain (hosting mail server, Google Workspace, Microsoft 365, Mailchimp, SendGrid, transactional email services, etc.).
- Log in to your domain registrar or DNS provider.
- Add a TXT record for your domain with the SPF value.
- Use
~all(soft fail) while testing, then switch to-all(hard fail) once confirmed.
Serverlys Tip: If you host your email with Serverlys, your SPF record should include our mail server. Contact support and we will provide the exact SPF value for your account, or check your cPanel Email Deliverability section where we auto-generate the correct records.
DKIM (DomainKeys Identified Mail)
What It Does
DKIM adds a digital signature to every outgoing email. The receiving server uses a public key (published in your DNS) to verify the signature, confirming that the email was actually sent by an authorized server and that the message content has not been tampered with in transit.
How It Works
- Your mail server generates a pair of cryptographic keys: a private key (kept secret on the server) and a public key (published in DNS).
- When sending an email, your server uses the private key to create a digital signature of the email's headers and body.
- The signature is added to the email as a DKIM-Signature header.
- The receiving server retrieves your public key from DNS and uses it to verify the signature.
- If the signature is valid, the email passes DKIM. If it has been modified, it fails.
Example DKIM DNS Record
Record name: default._domainkey.yourdomain.com
Record type: TXT
Record value: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQE... (your public key)
How to Set Up DKIM
- Generate DKIM keys through your email provider. In cPanel, go to Email Deliverability and DKIM is generated automatically. In Google Workspace, go to Admin → Apps → Google Workspace → Gmail → Authenticate Email.
- Add the DKIM public key as a TXT record in your DNS.
- Verify the setup by sending a test email and checking the headers for a "DKIM: pass" result.
DMARC (Domain-based Message Authentication, Reporting & Conformance)
What It Does
DMARC ties SPF and DKIM together and tells receiving servers what to do with emails that fail authentication. Without DMARC, servers may accept, reject, or quarantine failed emails at their own discretion. DMARC gives you explicit control over that decision and sends you reports about who is using your domain to send email.
How It Works
- You publish a DMARC record in your DNS (a TXT record at
_dmarc.yourdomain.com). - The record specifies your policy:
none(monitor only),quarantine(send to spam), orreject(block entirely). - When an email fails both SPF and DKIM, the receiving server follows your DMARC policy.
- The receiving server sends aggregate reports to your specified email address, showing who is sending email from your domain and whether it passed or failed authentication.
Example DMARC Record
Record name: _dmarc.yourdomain.com
Record type: TXT
Record value: v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; pct=100
DMARC Policies Explained
| Policy | Action | When to Use |
|---|---|---|
p=none |
Monitor only, deliver all emails | Initial setup, gathering data |
p=quarantine |
Send failing emails to spam | After confirming legitimate senders pass |
p=reject |
Block failing emails entirely | Maximum protection, after thorough testing |
Recommended DMARC Rollout
- Week 1–4: Start with
p=noneto collect reports without affecting email delivery. Analyze reports to identify all legitimate email sources. - Week 5–8: Move to
p=quarantinewithpct=25(apply to 25% of failing emails). Monitor for false positives. - Week 9–12: Increase to
pct=100. If no legitimate emails are being affected, you are ready for the final step. - Week 13+: Move to
p=rejectfor maximum protection. Continue monitoring reports.
How SPF, DKIM, and DMARC Work Together
"Think of SPF as a guest list (who is allowed to send), DKIM as a tamper-proof seal (proof the email is genuine and unmodified), and DMARC as the policy enforcement (what to do with gatcrashers). You need all three for comprehensive email security."
Here is the flow when an email arrives at a receiving server:
- Server checks SPF: Is the sending server authorized? Pass or fail.
- Server checks DKIM: Is the email digitally signed and unmodified? Pass or fail.
- Server checks DMARC: Does SPF or DKIM pass, AND does the domain align? If both fail, apply the DMARC policy (none/quarantine/reject).
- Server sends a DMARC report to the domain owner with the results.
Tools for Setup and Testing
- MXToolbox (mxtoolbox.com) — Check your SPF, DKIM, and DMARC records. Run a domain health check to see all email-related DNS records.
- DMARC Analyzer (dmarcanalyzer.com) — Free DMARC report parsing and visualization. Helps you understand who is sending email from your domain.
- mail-tester.com — Send a test email and get a detailed score with SPF, DKIM, and DMARC status.
- Google Postmaster Tools — Free tool from Google showing your domain's email reputation, spam rate, and authentication results for emails sent to Gmail.
- cPanel Email Deliverability — Built into cPanel, automatically generates and validates SPF and DKIM records for domains hosted on your server.
Common Mistakes
- Forgetting a sending service in SPF. If you use Mailchimp for newsletters but forgot to include their servers in your SPF record, those emails will fail SPF. Audit all services that send email from your domain before setting up SPF.
- Having multiple SPF records. A domain should have only one SPF TXT record. If you have multiple, they can conflict and cause failures. Merge them into a single record using
include:statements. - Skipping DMARC. SPF and DKIM without DMARC leave a gap: receiving servers know the email failed authentication but have no policy on what to do about it. Always set up DMARC to complete the chain.
- Going straight to
p=reject. Start withp=noneand monitor reports. Jumping to reject without testing can block your own legitimate emails if any sending service is misconfigured. - Not monitoring DMARC reports. The reports tell you if someone is spoofing your domain and if your legitimate emails are passing authentication. Use a free service like DMARC Analyzer to parse and visualize them.
Serverlys Tip: All Serverlys hosting plans include email hosting with automatic SPF and DKIM configuration via cPanel's Email Deliverability tool. We recommend adding a DMARC record as well — our support team can help you set one up correctly for your domain.
Frequently Asked Questions
Do I need all three (SPF, DKIM, and DMARC)?
Yes. Each one serves a different purpose: SPF verifies the sending server, DKIM verifies the message integrity, and DMARC enforces policy and provides reporting. Missing any one of them leaves a gap in your email security. Major providers like Google and Yahoo require all three for bulk senders.
Will setting up SPF/DKIM/DMARC stop all spam from my domain?
It will prevent unauthorized parties from sending emails that pass authentication checks for your domain. However, if an attacker sends spoofed emails and the receiving server does not check DMARC (some older or poorly configured servers), the email may still be delivered. The good news is that all major email providers (Gmail, Outlook, Yahoo) fully support DMARC enforcement.
Can I set these up myself or do I need a developer?
You can set them up yourself. All three are DNS TXT records that you add through your domain registrar or hosting provider's DNS management. If you are comfortable editing DNS records, it takes about 30 minutes. If not, your hosting provider's support team or a developer can do it in minutes.
How long does it take for SPF/DKIM/DMARC to take effect?
DNS changes typically propagate within 1–24 hours (usually much faster). After adding the records, test with MXToolbox or mail-tester.com to confirm they are active. DMARC reports take 24–48 hours to start arriving since they are sent daily by receiving servers.
What happens if I only have SPF but not DKIM or DMARC?
SPF alone provides basic sender verification, but without DKIM, there is no way to verify the email content has not been modified. Without DMARC, receiving servers have no enforcement policy and may handle failures inconsistently. Google and Yahoo now require all three for senders sending more than 5,000 emails per day, and this requirement is expanding to all senders.