SendGrid Email Authentication Guide

How to set up SPF, DKIM, DMARC, and List-Unsubscribe for SendGrid. Provider-specific DNS records, step-by-step instructions, and the mistakes to avoid.

Check your domain while following this guide

Run a free SPF, DKIM, and DMARC check to see what is passing and what still needs fixing.

No signup required. Works on any domain.

Before you start

  • You need access to the DNS settings for your domain. This is usually at your domain registrar or DNS provider (Cloudflare, Namecheap, GoDaddy, etc.).
  • You need admin or settings access to your SendGrid account to generate DKIM keys and verify records.
  • DNS changes take time to propagate. After saving a record, wait at least 15-30 minutes before testing.

SPF Setup for SendGrid

SPF (Sender Policy Framework) is a DNS TXT record that lists which mail servers are allowed to send email on behalf of your domain. Receiving servers check it to decide whether to accept or flag your mail.

SendGrid uses CNAME-based domain authentication instead of a plain SPF TXT record. When you authenticate a domain in SendGrid, it creates a branded subdomain (like em.yourdomain.com) that handles SPF through CNAME delegation.

SendGrid uses CNAME-based domain authentication

Instead of a plain TXT record, SendGrid provides 6 CNAME records through its Sender Authentication wizard. These cover both SPF and DKIM in one flow.

Steps

  1. In SendGrid, go to Settings → Sender Authentication → Authenticate Your Domain.
  2. Enter your domain. SendGrid generates the CNAME records for you - follow the wizard.
  3. You add up to 6 CNAME records that SendGrid provides in the Sender Authentication wizard. SendGrid's system resolves SPF through those CNAMEs automatically.
  4. Add all the CNAME records to your DNS provider, then return to SendGrid and click Verify.
Watch out: Do not add a separate v=spf1 include:sendgrid.net ~all TXT record. Use the CNAME-based domain authentication instead.

DKIM Setup for SendGrid

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to outgoing email. Receiving servers verify the signature against a public key you publish as a DNS TXT record. A valid DKIM signature proves the message was not altered in transit and that it came from an authorized sender.

Selector for SendGrid: s1 and s2 (CNAME records pointing to SendGrid's key infrastructure)

Steps

  1. In SendGrid, go to Settings → Sender Authentication → Authenticate Your Domain.
  2. Enter your domain. SendGrid generates 6 DNS records: 2 CNAME records for DKIM and 4 more for SPF and tracking.
  3. Add all 6 CNAME records to your DNS provider exactly as shown. The DKIM records look like s1._domainkey.yourdomain.com → s1.domainkey.uXXXX.wl.sendgrid.net.
  4. Return to SendGrid and click Verify. All 6 CNAMEs must resolve before domain authentication is complete.
Watch out: All 6 CNAME records must be published. Partial setup causes domain verification to fail. Do not add a manual DKIM TXT record.

Verify DKIM

  • Send a test email to a Gmail address and open it. Click the three-dot menu → "Show original". Look for dkim=pass in the authentication results.
  • From the command line:
    dig TXT s1._domainkey.yourdomain.com +short
  • Or use the InboxGreen DKIM checker.

DMARC Setup for SendGrid

DMARC (Domain-based Message Authentication, Reporting, and Conformance) ties SPF and DKIM together. It tells receiving servers what to do with mail that fails both checks, and sends you reports about who is sending email on behalf of your domain. DMARC also requires alignment: the domain in your visible From header must match the domain authenticated by SPF or DKIM.

SendGrid domain authentication automatically handles DMARC alignment when you use a custom authenticated sending domain. Sending from sendgrid.net as your From domain will fail DMARC.

The three-stage approach

StageDNS valueWhen to use it
Monitor v=DMARC1; p=none; rua=mailto:[email protected]; fo=1 Start here. Collects reports without blocking any mail.
Quarantine v=DMARC1; p=quarantine; pct=25; rua=mailto:[email protected]; fo=1 After 2-4 weeks at p=none with clean reports. Sends some failing mail to spam.
Reject v=DMARC1; p=reject; pct=100; rua=mailto:[email protected]; fo=1 Full protection once SPF and DKIM alignment is verified.

Publish the DMARC record

  1. Create a TXT record at host _dmarc (not @) with the p=none value above.
  2. Replace [email protected] with a real inbox that can receive XML report emails.
  3. Wait for DNS propagation, then verify with dig TXT _dmarc.yourdomain.com +short.
  4. After 2-4 weeks, review the reports and tighten the policy when alignment looks healthy.
Why DMARC fails even when SPF and DKIM pass: DMARC cares about alignment. The domain in the visible From header must match the domain SPF or DKIM authenticated. Forwarded mail and mailing list services often break alignment.

List-Unsubscribe for SendGrid

The List-Unsubscribe header gives inbox providers like Gmail and Outlook a machine-readable way to offer a one-click unsubscribe button. When it is present and valid, Gmail shows an "Unsubscribe" link next to the sender name without the recipient needing to scroll to the bottom of the email. This reduces spam complaints and protects your sender reputation.

How to enable it

  1. In your sending platform or email template, enable the List-Unsubscribe header option. Most platforms (SendGrid, Mailgun, Brevo, Shopify Email) have a toggle or a macro for this.
  2. Use a one-click HTTPS unsubscribe URL as the primary method. Include a mailto: address as fallback.
  3. Add the List-Unsubscribe-Post header to declare one-click support (required by Gmail's February 2024 guidelines for senders above 5,000 messages/day).

Example headers

List-Unsubscribe: <https://yourdomain.com/unsubscribe/TOKEN>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

Common mistakes

  • Using a broken or expired token in the unsubscribe URL. Inbox providers test the link periodically.
  • Only providing a mailto: link without a one-click HTTPS URL. Gmail and Outlook prefer the HTTPS method.
  • Not honoring the unsubscribe request immediately. Gmail requires that one-click unsubscribes are processed within two business days.

To verify, send a test email to a Gmail address and look at "Show original". You should see the List-Unsubscribe header in the raw message headers.

Verify All Four Records

After publishing all records, run these checks:

RecordCommandWhat to look for
SPF dig TXT yourdomain.com +short One TXT record starting with v=spf1
DKIM dig TXT s1._domainkey.yourdomain.com +short A TXT record starting with v=DKIM1
DMARC dig TXT _dmarc.yourdomain.com +short A TXT record starting with v=DMARC1
All three InboxGreen Free Check Green pass on SPF, DKIM, and DMARC

Common Mistakes with SendGrid

  • Adding a separate <code>v=spf1 include:sendgrid.net ~all</code> TXT record instead of using CNAME-based domain authentication.
  • Only adding some of the 6 CNAME records and wondering why domain verification stays pending.
  • Sending from <code>[email protected]</code> as the visible From address instead of your own authenticated domain.

Free Deliverability Scan

Check SPF, DKIM, DMARC and List-Unsubscribe for your domain in seconds.

Related Tools

SPF Lookup

See your live SPF record, count DNS lookups, and spot duplicate records or syntax problems.

DKIM Checker

Look up any DKIM selector on any domain. Confirms the key exists and shows its length.

DMARC Lookup

Fetch your live DMARC record, validate syntax, and check policy and reporting configuration.

Email Header Analyzer

Paste raw email headers to see SPF, DKIM, and DMARC results in one view.

SPF Generator

Build a valid SPF record from scratch for any combination of sending services.

DMARC Generator

Build a DMARC record with the right policy, pct, and rua settings for your stage.

TXT Lookup

See all TXT records on your domain to catch duplicate SPF records or missing entries.

DKIM Generator

Generate a 2048-bit DKIM key pair if your ESP requires you to manage your own keys.

Related Reading

SPF Errors and Fixes

PermError, duplicate records, softfail vs hardfail, and alignment failures.

DKIM Errors and Fixes

Selector not found, body hash mismatch, key length, and DMARC alignment.

DMARC Errors and Fixes

Alignment failures, missing reports, and how to safely move from p=none to p=reject.

Common Questions

What DNS records do I need for SendGrid?

For SendGrid, domain authentication uses CNAME records generated by SendGrid's Sender Authentication wizard. It does not use a plain SPF TXT record. Add the 3 to 6 CNAME records SendGrid provides, and SPF handling is taken care of automatically through those CNAMEs. Do not add a separate v=spf1 include:sendgrid.net ~all TXT record. You also need a DMARC TXT record at _dmarc.yourdomain.com.

How long does it take for SPF, DKIM, and DMARC to start working?

Most DNS changes propagate within 15 to 60 minutes, but the full TTL can extend to 48 hours on some registrars. Always wait at least 30 minutes before testing. If a change isn't showing up after an hour, use the SPF Lookup or DKIM Checker to query live DNS rather than relying on cached results.

Can I have two SPF records?

No. RFC 7208 requires exactly one SPF TXT record at your domain root. Two records cause a PermError regardless of their content. If you send through multiple services, merge all the includes into a single record: v=spf1 include:service1.com include:service2.com ~all. Use the TXT Lookup to confirm you only have one.

What DMARC policy should I start with?

Start with p=none to collect reports without affecting delivery. After 2 to 4 weeks of reports showing all legitimate sources passing alignment, move to p=quarantine at a low percentage (pct=10), then increase gradually. Move to p=reject only when you are confident every legitimate sending source aligns correctly.

Why does DMARC fail even though SPF and DKIM both pass?

DMARC requires alignment, not just a pass. SPF alignment means the envelope sender domain (the Return-Path address) must match your From: domain. DKIM alignment means the d= tag must match your From: domain. If your ESP signs with its own domain or uses its own envelope sender, both protocols pass independently but DMARC alignment fails. Fix this by enabling custom domain authentication at your ESP.