All Articles
Outbound14 min read

SPF, DKIM, and DMARC Explained: The Complete Email Authentication Guide

Email authentication protects your domain from spoofing and keeps your messages out of spam. This guide explains SPF, DKIM, and DMARC from scratch, with step-by-step setup for Google Workspace and Microsoft 365.

Why Email Authentication Matters More Than Ever

In February 2024, Google and Yahoo began enforcing new email authentication requirements for bulk senders. Any domain sending more than 5,000 emails per day to Gmail addresses must have valid SPF, DKIM, and DMARC records, or their emails will be rejected outright. Microsoft followed in early 2025 with similar requirements for Outlook.com and Hotmail. These are not optional best practices. They are enforced requirements that affect deliverability.

Even if you are not a bulk sender, email authentication is essential. Without it, anyone can send emails that appear to come from your domain (a technique called spoofing), your emails are more likely to land in spam, and your domain reputation suffers over time. Email authentication is the foundation of email deliverability. Everything else, warmup, content quality, list hygiene, matters less if your authentication is broken.

This guide explains all three authentication protocols from the ground up: what they do, how they work, and exactly how to set them up. By the end, you will have a complete, properly configured email authentication stack that protects your domain and maximizes deliverability.

SPF: Sender Policy Framework

What SPF Does

SPF tells receiving mail servers which servers are authorized to send email on behalf of your domain. When you send an email from jeff@yourdomain.com, the receiving server looks up your domain's SPF record to check whether the sending server's IP address is on the authorized list. If the IP matches, SPF passes. If it does not match, SPF fails, and the email is more likely to be flagged as spam or rejected.

Think of SPF as a guest list for your domain. You publish a list of approved senders (Google Workspace, your email marketing platform, your CRM), and any server not on the list is treated as unauthorized. Without SPF, there is no guest list at all, meaning anyone can claim to be sending from your domain.

How SPF Works Technically

SPF is implemented as a DNS TXT record on your domain. When a receiving mail server gets an email claiming to be from yourdomain.com, it queries DNS for the TXT record at yourdomain.com, reads the SPF policy, extracts the list of authorized IP addresses and domains, checks whether the sending server's IP matches any entry, and returns a pass, fail, softfail, or neutral result. The SPF check happens automatically during SMTP delivery, before the email reaches the recipient's inbox.

SPF Record Syntax

An SPF record starts with v=spf1 (the version identifier) and contains one or more mechanisms that define authorized senders. Here are the most common mechanisms:

include: - Authorizes all IPs listed in another domain's SPF record. Example: include:_spf.google.com authorizes all Google Workspace sending IPs. ip4: - Authorizes a specific IPv4 address or range. Example: ip4:192.168.1.1 or ip4:192.168.1.0/24. ip6: - Same as ip4 but for IPv6 addresses. a - Authorizes the IP address(es) in your domain's A record. mx - Authorizes the IP address(es) of your domain's MX (mail exchange) servers.

Every SPF record ends with an 'all' mechanism that defines what happens to senders not explicitly authorized. The three options are: -all (hard fail: unauthorized senders are rejected), ~all (soft fail: unauthorized senders are flagged but not rejected), and ?all (neutral: no policy). For maximum security, use -all. For initial setup when you are still identifying all legitimate senders, use ~all and switch to -all once you are confident the record is complete.

Step-by-Step SPF Setup for Google Workspace

Step 1: Log into your DNS provider (GoDaddy, Cloudflare, Namecheap, Route 53, etc.). Step 2: Navigate to DNS management for your domain. Step 3: Create a new TXT record with these settings - Host/Name: @ (or leave blank, depending on your provider), Type: TXT, Value: v=spf1 include:_spf.google.com ~all, TTL: 3600 (or default). Step 4: If you use additional sending services, add their include statements before the ~all. For example, if you also use Mailchimp and SendGrid: v=spf1 include:_spf.google.com include:servers.mcsv.net include:sendgrid.net ~all. Step 5: Save the record and wait for DNS propagation (up to 48 hours, but usually under 1 hour).

Step-by-Step SPF Setup for Microsoft 365

The process is identical to Google Workspace except for the include value. For Microsoft 365, your SPF record should be: v=spf1 include:spf.protection.outlook.com ~all. If you use additional services, add their includes: v=spf1 include:spf.protection.outlook.com include:sendgrid.net ~all.

Common SPF Mistakes

Mistake 1: Multiple SPF records. Your domain should have exactly ONE SPF TXT record. If you have two (which happens when different team members add SPF records at different times), both are invalid. The fix is to merge all include statements into a single record.

Mistake 2: Exceeding the 10-lookup limit. SPF has a hard limit of 10 DNS lookups. Each include: statement counts as one lookup, and nested includes count toward the total. If your SPF record requires more than 10 lookups, the entire check fails. Common offenders are companies using 6+ sending services. The fix is to use SPF flattening tools like AutoSPF or SPF.io, which replace include statements with direct IP addresses, eliminating nested lookups.

Mistake 3: Forgetting to add sending services. If you set up SPF with only Google Workspace but also send through HubSpot, Intercom, and Mailchimp, emails from those services will fail SPF. Audit every service that sends email from your domain and ensure they are all included in your SPF record.

Mistake 4: Using ?all instead of ~all or -all. The neutral (?all) policy provides essentially no protection and no deliverability benefit. At minimum, use ~all. Once your record is complete and tested, upgrade to -all.

DKIM: DomainKeys Identified Mail

What DKIM Does

DKIM adds a cryptographic signature to every email you send, proving that the email was actually sent by your domain and has not been modified in transit. While SPF verifies which servers can send on your behalf, DKIM verifies that the specific email content is authentic and unaltered. Together, SPF and DKIM provide comprehensive sender verification.

How DKIM Works Technically

DKIM uses public-key cryptography, the same technology that secures HTTPS websites. Here is the process: Your email server generates a pair of cryptographic keys: a private key (kept secret on the server) and a public key (published in your DNS). When you send an email, your server uses the private key to create a digital signature of the email headers and body. This signature is added as a DKIM-Signature header in the email. When the receiving server gets the email, it reads the DKIM-Signature header to find out which domain and selector were used. It looks up the public key in DNS using the selector. It uses the public key to decrypt the signature. It compares the decrypted signature to the actual email content. If they match, DKIM passes, proving the email is authentic and unmodified.

The 'selector' is an identifier that allows you to have multiple DKIM keys for the same domain. For example, Google Workspace uses selector google, so the DKIM public key is published at google._domainkey.yourdomain.com. You might also have a selector for your marketing platform at mailchimp._domainkey.yourdomain.com. Each selector has its own key pair.

DKIM Setup for Google Workspace

Step 1: Go to the Google Admin Console (admin.google.com). Step 2: Navigate to Apps, then Google Workspace, then Gmail, then Authenticate email. Step 3: Select your domain and click 'Generate new record.' Choose a DKIM key bit length of 2048 (stronger than 1024; use 1024 only if your DNS provider does not support 2048-bit TXT records). Step 4: Google will generate a TXT record value. Copy it. Step 5: Go to your DNS provider and create a new TXT record - Host/Name: google._domainkey (Google provides the exact host value), Type: TXT, Value: the string Google generated (starts with v=DKIM1; k=rsa; p=...). Step 6: Wait for DNS propagation (up to 48 hours). Step 7: Return to the Google Admin Console and click 'Start authentication.' Google will verify the DNS record and begin signing outgoing emails.

DKIM Setup for Microsoft 365

Step 1: Go to the Microsoft 365 Defender portal (security.microsoft.com). Step 2: Navigate to Email and collaboration, then Policies and rules, then Threat policies, then Email authentication settings, then DKIM. Step 3: Select your domain. Step 4: Microsoft will display two CNAME records you need to add to your DNS. They typically look like: selector1._domainkey.yourdomain.com CNAME selector1-yourdomain-com._domainkey.yourdomain.onmicrosoft.com, and selector2._domainkey.yourdomain.com CNAME selector2-yourdomain-com._domainkey.yourdomain.onmicrosoft.com. Step 5: Add both CNAME records in your DNS provider. Step 6: Wait for propagation, then return to the Defender portal and enable DKIM signing.

Verifying DKIM Is Working

Send a test email to a Gmail account and open it. Click the three dots menu in the top right of the email, then 'Show original.' Look for 'DKIM: PASS' in the authentication results header. Alternatively, use mail-tester.com: send an email to the address they provide and check the DKIM section of the report. You can also use the command-line tool dig to verify your DNS record: dig TXT google._domainkey.yourdomain.com (replace with your actual selector and domain).

DMARC: Domain-based Message Authentication, Reporting, and Conformance

What DMARC Does

DMARC builds on top of SPF and DKIM. It tells receiving servers what to do when an email fails SPF and DKIM checks, and it provides a reporting mechanism so you can monitor who is sending email from your domain. DMARC answers the question: 'When authentication fails, should the email be delivered anyway, sent to spam, or rejected outright?'

Without DMARC, each receiving server makes its own decision about how to handle authentication failures. Some might deliver the email anyway, some might spam it, and some might reject it. DMARC gives you, the domain owner, control over that decision. It also provides visibility: DMARC reports tell you every IP address that sent email using your domain, whether authentication passed or failed, and how many messages were sent. This data is invaluable for identifying unauthorized senders (spoofing) and misconfigured legitimate senders.

DMARC Policy Options

DMARC has three policy levels, and you should implement them in order.

p=none: Monitor mode. Emails that fail authentication are delivered normally, but you receive reports. This is the starting point. Use it to collect data on who is sending from your domain before enforcing any policy. Stay in none for at least 2-4 weeks.

p=quarantine: Emails that fail authentication are sent to the recipient's spam/junk folder. This is the intermediate step. Move to quarantine once you are confident that all legitimate senders pass SPF and DKIM. Monitor reports for 2-4 weeks at quarantine before escalating.

p=reject: Emails that fail authentication are rejected entirely and never delivered. This is the strongest policy and the ultimate goal. It fully protects your domain from spoofing. Only move to reject when you are certain that every legitimate sender is authenticated. A misconfigured reject policy will block real emails.

How to Create a DMARC Record

A DMARC record is a DNS TXT record published at _dmarc.yourdomain.com. Here is the step-by-step process.

Step 1: Go to your DNS provider. Step 2: Create a new TXT record - Host/Name: _dmarc, Type: TXT, Value: v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; ruf=mailto:dmarc-reports@yourdomain.com; fo=1. Let us break down each tag: v=DMARC1 is the version identifier. p=none is the policy (start with none). rua= is the email address where aggregate reports are sent (daily summaries). ruf= is the email address where forensic reports are sent (individual failure details). fo=1 generates forensic reports for any authentication failure.

Step 3: Save the record and verify it using a DMARC checker tool (MXToolbox, dmarcian.com, or dmarc-tester.com). Step 4: Wait 2-4 weeks for reports to accumulate. The aggregate reports are XML files that are difficult to read raw, so use a DMARC analytics tool (dmarcian, Valimail, PostmarkApp's free DMARC tool) to parse and visualize them. Step 5: Review the reports to identify all legitimate senders. Ensure each one passes SPF and/or DKIM. Fix any that do not. Step 6: Once all legitimate senders pass authentication, update the policy from p=none to p=quarantine. Monitor for another 2-4 weeks. Step 7: If no legitimate emails are being quarantined, update to p=reject.

The DMARC Ramp-Up Strategy

Jumping straight to p=reject is dangerous because you might block legitimate emails from services you forgot to authenticate. The safe approach is a gradual ramp using the pct= tag, which specifies what percentage of failing emails the policy applies to.

Week 1-4: v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com (monitor only, no enforcement). Week 5-6: v=DMARC1; p=quarantine; pct=10; rua=mailto:dmarc@yourdomain.com (quarantine 10% of failures). Week 7-8: v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc@yourdomain.com (quarantine 50%). Week 9-10: v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc@yourdomain.com (quarantine all failures). Week 11-12: v=DMARC1; p=reject; pct=10; rua=mailto:dmarc@yourdomain.com (reject 10% of failures). Week 13-14: v=DMARC1; p=reject; pct=50; rua=mailto:dmarc@yourdomain.com (reject 50%). Week 15+: v=DMARC1; p=reject; rua=mailto:dmarc@yourdomain.com (full reject). This 15-week ramp-up may seem slow, but it is the safest path to full DMARC enforcement. Rushing it risks blocking real emails, which causes far more damage than a few extra weeks of monitoring.

How SPF, DKIM, and DMARC Work Together

Each protocol handles a different aspect of email authentication, and they are designed to work as a system.

SPF verifies the sending server. It answers: 'Is this server authorized to send email for this domain?' DKIM verifies the email content. It answers: 'Is this email genuinely from this domain and unmodified in transit?' DMARC ties them together. It answers: 'What should happen when SPF and/or DKIM fail, and how should the domain owner be notified?'

For an email to pass DMARC, it needs to pass either SPF or DKIM (not both, either one). However, passing both is strongly recommended because it provides redundancy. If SPF breaks (maybe you forgot to update the record when adding a new sending service), DKIM still protects you, and vice versa.

There is one more nuance: DMARC requires 'alignment,' meaning the domain in the SPF check or DKIM signature must match the 'From' header domain that the recipient sees. This prevents scenarios where a spammer passes SPF on their own domain but sets the visible 'From' address to your domain. Alignment ensures that the authenticated domain matches the domain the recipient actually sees.

Testing and Validation Tools

MXToolbox

MXToolbox is the go-to diagnostic tool for email infrastructure. Their SuperTool (mxtoolbox.com/SuperTool.aspx) lets you check SPF records, DKIM records, DMARC records, blacklist status, and MX records, all from one interface. Use MXToolbox after making any DNS changes to verify they propagated correctly. They also offer a free DMARC report analyzer that parses the XML reports into readable tables.

Mail-tester.com

Mail-tester.com provides a holistic email quality score. Send an email to their unique test address, and within seconds you get a 1-10 score with detailed feedback on SPF, DKIM, DMARC, content quality, and blacklist status. A perfect 10/10 score means your authentication is configured correctly and your email content is clean. We recommend running a mail-tester check after initial setup, after any DNS changes, and monthly as an ongoing health check.

DMARC Analyzer Tools

Raw DMARC aggregate reports are XML files that are essentially unreadable without a parsing tool. Free options include PostmarkApp's DMARC tool (dmarc.postmarkapp.com), which provides weekly digests of your DMARC reports, and dmarcian, which offers a free tier for low-volume domains. Paid tools like Valimail, Agari, and OnDMARC provide more sophisticated analytics, alerting, and automated policy management for enterprise domains.

Google Postmaster Tools

Google Postmaster Tools (postmaster.google.com) shows how Gmail specifically evaluates your domain. It reports domain reputation, spam rate, authentication success rate (SPF, DKIM, DMARC), and encryption percentage. This is the most authoritative data source for Gmail deliverability because it comes directly from Google. Set it up for every domain you send from.

Common Authentication Mistakes and Fixes

Mistake: SPF Record Missing for a Sending Service

Symptom: Emails from HubSpot, Intercom, or another service land in spam despite authentication being 'set up.' Cause: The service was not added to the SPF record. Fix: Add the service's include statement to your SPF record. Check the service's documentation for the exact include value. HubSpot: include:hubspot.com. Intercom: include:intercom.io. Mailchimp: include:servers.mcsv.net. Sendgrid: include:sendgrid.net.

Mistake: DKIM Not Enabled for Third-Party Services

Symptom: Emails from a marketing platform pass SPF but fail DKIM. Cause: You set up DKIM for Google Workspace or Microsoft 365 but did not enable DKIM signing in your other sending services. Fix: Go into each service's settings and enable DKIM. Most platforms provide a CNAME or TXT record to add to your DNS, along with instructions for verification. This is separate from your Google/Microsoft DKIM setup, each service needs its own DKIM configuration.

Mistake: DMARC at p=reject Before Validating All Senders

Symptom: Legitimate emails from your company are being rejected by recipients. Cause: You moved to p=reject before confirming that all sending services pass SPF and DKIM. Fix: Roll back to p=quarantine or p=none immediately. Review DMARC reports to identify which senders are failing authentication. Fix each one, then gradually ramp the policy back up using the pct= approach.

Mistake: SPF Record Exceeds 10-Lookup Limit

Symptom: SPF checks return a 'permerror' result, and emails fail authentication. Cause: Your SPF record has too many include statements, exceeding the 10 DNS lookup maximum. Fix: Use an SPF flattening service to resolve includes into direct IP addresses. Alternatively, audit your sending services and remove any that are no longer in use. It is common for SPF records to accumulate stale includes from services that were tried and abandoned.

Mistake: Incorrect DMARC Alignment

Symptom: SPF and DKIM both pass, but DMARC still fails. Cause: The SPF and DKIM authenticated domains do not match the 'From' header domain (alignment failure). This often happens with third-party services that authenticate using their own domain rather than yours. Fix: Configure the third-party service to use custom DKIM (your domain) rather than their default domain. Most reputable services support this. In your DMARC record, you can also set aspf=r and adkim=r for 'relaxed' alignment, which allows subdomain matching (e.g., mail.yourdomain.com aligns with yourdomain.com).

Special Considerations for Cold Email

Cold email has specific authentication requirements beyond what standard transactional and marketing email needs. Here are the key considerations.

Use Secondary Domains

Never send cold email from your primary company domain. Buy secondary domains (getacme.com, triacme.com, acme-outbound.com) dedicated to cold outreach. This protects your primary domain's reputation if a cold email campaign triggers spam complaints. Each secondary domain needs its own complete SPF, DKIM, and DMARC setup.

Authenticate Every Sending Service

If you use Instantly for cold email, Apollo for sequences, and HubSpot for marketing, each service must be authenticated in your SPF record and have DKIM enabled. A single unauthenticated service can drag down your overall domain reputation.

Set Up DMARC Monitoring on Secondary Domains

Many companies carefully configure DMARC on their primary domain but ignore their secondary outbound domains. This is a mistake. Set up DMARC with rua reporting on every domain you send from, including secondary domains. Monitor the reports to catch authentication issues early.

Forward DNS Verification

Some inbox providers also check reverse DNS (PTR records) and forward DNS (A records) for the sending server. If you are using a dedicated IP for sending, ensure your PTR record resolves to a hostname under your domain, and that hostname's A record resolves back to the IP. This bidirectional DNS verification is an additional trust signal that complements SPF, DKIM, and DMARC.

The Authentication Setup Checklist

Here is the complete checklist for setting up email authentication from scratch. Follow these steps in order.

1. Inventory all services that send email from your domain (Google Workspace, Microsoft 365, HubSpot, Mailchimp, Intercom, SendGrid, Instantly, Apollo, etc.). 2. Create or update your SPF record with include statements for every service. Verify the total lookup count is under 10. 3. Enable DKIM signing in Google Workspace or Microsoft 365. Add the DNS records they provide. 4. Enable DKIM signing in every third-party sending service. Add their DNS records. 5. Create a DMARC record with p=none and rua reporting. 6. Verify all records using MXToolbox and mail-tester.com. 7. Monitor DMARC reports for 2-4 weeks. 8. Fix any authentication failures you discover. 9. Upgrade DMARC to p=quarantine. Monitor for 2-4 weeks. 10. Upgrade to p=reject using the pct= ramp-up approach. 11. Set up Google Postmaster Tools for every domain. 12. Run monthly mail-tester.com checks as ongoing monitoring.

How GTME Sets Up Authentication for Clients

At GTME, email authentication setup is the first thing we do for every outbound client. We audit existing DNS records, identify misconfigured or missing authentication, set up SPF, DKIM, and DMARC across primary and secondary domains, configure DMARC reporting and monitoring, and validate everything with deliverability testing. Our clients never have to learn SPF syntax or parse XML DMARC reports because we handle the entire technical infrastructure.

If your email authentication is misconfigured, or if you are not sure whether it is set up correctly, our team can audit your setup in 24 hours and fix any issues. Visit gtmeagency.com/services to learn about our outbound infrastructure packages, or test your current email setup for free at gtmeagency.com/tools.

Summary

SPF, DKIM, and DMARC are the three pillars of email authentication. SPF authorizes which servers can send from your domain. DKIM cryptographically signs your emails to prove authenticity. DMARC tells receiving servers what to do when authentication fails and sends you reports. All three are required by Gmail, Yahoo, and Outlook for bulk senders as of 2025, and they significantly improve deliverability for all senders.

The setup process takes 1-2 hours for the initial DNS records, but the DMARC ramp-up from p=none to p=reject takes 15+ weeks if done safely. Do not rush it. A broken DMARC policy that blocks legitimate emails is worse than no DMARC at all. Monitor your reports, fix issues as they arise, and ramp gradually.

Email authentication is invisible when it works, and catastrophic when it does not. Take the time to set it up correctly, and you will have a deliverability foundation that supports every email you send, from marketing campaigns to cold outreach to transactional notifications. Skip it, and you are building your email program on sand.

Need help implementing this?

GTME builds the systems described in this article. Book a call and we'll show you what it looks like for your business.

Book a Strategy Call

GTM insights, weekly

Get articles like this in your inbox every week. No fluff.

Want us to build this for you?

Every article we write is based on systems we've built for real clients. Let's build yours.