Set Up SPF, DKIM, and DMARC for SendGrid: Step-by-Step DNS Guide

Authenticating SendGrid requires publishing 3 delegated CNAME records (emXXXX, s1._domainkey, and s2._domainkey) for Automated Security (or adding include:sendgrid.net to your root SPF record for manual security) and publishing a _dmarc TXT policy. These records replace SendGrid's shared bounce domain with yours. The setup ensures 100% DMARC alignment and inbox placement.

SendGrid Email Authentication Specification (Automated CNAMEs vs Manual TXT Records)

SendGrid Domain Authentication (formerly called Whitelabel) replaces the default sendgrid.net return-path address and shared signing domain with your own custom domain across 3 DNS layers: a branded bounce subdomain (emXXXX) for SPF alignment, dual s1._domainkey and s2._domainkey selectors for 2048-bit DKIM signing, and a root _dmarc TXT policy. SendGrid enables Automated Security by default, which uses 3 CNAME records so SendGrid manages SPF IP updates and DKIM key rotation automatically without consuming any of your root domain's 10 SPF lookups. The table below details every DNS record used in a production SendGrid authentication setup:

Protocol / Function Type Host / Name Field Points To / Value SPF Lookup Cost
1. Automated Return-Path (SPF Alignment) CNAME em1234 u1234567.wl001.sendgrid.net 0 lookups on root @ (Evaluated on em1234 subdomain)
2. Automated DKIM Key #1 (Primary) CNAME s1._domainkey s1.domainkey.u1234567.wl001.sendgrid.net 0 lookups
3. Automated DKIM Key #2 (Rotation) CNAME s2._domainkey s2.domainkey.u1234567.wl001.sendgrid.net 0 lookups
4. Root SPF Include (Manual Security / Fallback) TXT @ v=spf1 include:sendgrid.net ~all +2 total DNS lookups (1 top-level + 1 nested ab.sendgrid.net)
5. DMARC Policy Record TXT _dmarc v=DMARC1; p=none; rua=mailto:dmarc@example.com; 0 lookups
6. Optional Link Branding (Click Tracking) CNAME (x2) url1234 and 1234567 sendgrid.net 0 lookups

Choosing between Automated Security (ON) and Manual Security (OFF) dictates your operational maintenance burden. Automated Security requires publishing 3 CNAME records (emXXXX, s1._domainkey, and s2._domainkey), allowing SendGrid to rotate 2048-bit keys and update sending IP pools without customer intervention. Turning Automated Security OFF forces administrators to publish raw MX and TXT records (using the legacy selector smtpapi._domainkey and requiring include:sendgrid.net in root SPF), creating manual maintenance overhead outlined in our guide on Email Authentication.

Step 1: How to Start Domain Authentication in the SendGrid Dashboard (4 Steps)

Generate your custom DNS records inside Twilio SendGrid by completing 4 configuration steps in the Sender Authentication wizard:

  1. Navigate to Sender Authentication: Open your SendGrid dashboard, select Settings from the left sidebar, click Sender Authentication, and choose Authenticate Your Domain under Domain Authentication.
  2. Select DNS Host and Link Branding Preferences: Pick your DNS provider from the dropdown menu (such as Cloudflare, Amazon Route 53, GoDaddy, or Namecheap, or select I'm not sure / Other Host) and leave Brand the links for this domain set to No unless configuring dedicated click-tracking hostnames.
  3. Enter the Sending Domain and Review Advanced Settings: Enter the primary domain used in your sender From address (such as example.com), expand Advanced Settings, and ensure the checkbox for Use automated security remains checked.
  4. Assign Custom Selectors and Generate Records: Enter a custom 3-character prefix (such as sgd or mta) under Custom DKIM Selector if existing services occupy the default s1 and s2 names, then click Next to display your unique CNAME records and DMARC TXT record.

Custom Return-Path configuration in Advanced Settings provides branding consistency. SendGrid assigns an automated random prefix like em1234.example.com for envelope bounce handling by default; checking Use a custom return path enables specifying an administrative label such as bounces.example.com while achieving full DMARC Alignment.

Step 2: How to Set Up SendGrid SPF (emXXXX CNAME vs include:sendgrid.net)

Configuring SPF Record authentication for SendGrid involves 2 distinct approaches depending on whether you deploy SendGrid's Automated Security emXXXX CNAME or merge include:sendgrid.net directly into your root domain's TXT record:

  1. Configuration A: Automated Security SPF via the emXXXX CNAME (Recommended): Publish the first CNAME record generated by SendGrid (Host: em1234, Value: u1234567.wl001.sendgrid.net). SendGrid sets the envelope Return-Path bounce address (RFC 5321.MailFrom) to bounces@em1234.example.com when transmitting an outbound email. Receiving mail servers evaluate SPF against em1234.example.com, which resolves directly to SendGrid's managed SPF record. This passes SPF authentication and relaxed DMARC alignment (aspf=r) without consuming any of your root domain's 10 DNS lookups.
  2. Configuration B: Adding include:sendgrid.net to Your Root Domain SPF Record: Organizations operating with Automated Security turned OFF (or requiring root domain authorization for SendGrid servers) add include:sendgrid.net into their existing root SPF string:
    # Standalone SendGrid root SPF record:
    v=spf1 include:sendgrid.net ~all
    
    # Combined with Google Workspace and Microsoft 365 (1 record total):
    v=spf1 include:_spf.google.com include:spf.protection.outlook.com include:sendgrid.net ~all

Publishing multiple v=spf1 records on the root domain invalidates SPF validation completely. Consolidating all authorized sending services into a single TXT entry preserves deliverability, while adding include:sendgrid.net consumes +2 DNS lookups toward The SPF 10-Lookup Limit Explained. Administrators verify record syntax using the SPF Record Checker or reduce nested lookups via the SPF Flattener.

Step 3: How to Set Up SendGrid DKIM (s1._domainkey and s2._domainkey CNAMEs)

Enable 2048-bit DKIM Explained cryptographic signatures in SendGrid by publishing both delegated _domainkey CNAME records (s1._domainkey and s2._domainkey) in your authoritative DNS zone across 3 operational steps:

  1. Copy DKIM CNAME Hostnames and Target Values: Retrieve the two DKIM CNAME records displayed in your SendGrid Domain Authentication screen:
    Type: CNAME | Host: s1._domainkey | Value: s1.domainkey.u1234567.wl001.sendgrid.net
    Type: CNAME | Host: s2._domainkey | Value: s2.domainkey.u1234567.wl001.sendgrid.net
  2. Add CNAME Records to Your Authoritative DNS Zone: Create both CNAME records inside your DNS manager. Enter only s1._domainkey and s2._domainkey in the Host/Name input box on DNS platforms like Cloudflare, GoDaddy, and Namecheap that append your domain name automatically.
  3. Disable HTTP Proxy Features on Mail DNS Records: Set the proxy status to DNS Only (Grey Cloud) in Cloudflare for em1234, s1._domainkey, and s2._domainkey so SendGrid's validation systems and destination mail servers query the actual CNAME targets directly.

Publishing dual DKIM selectors ensures zero-downtime key rotation. SendGrid signs active messages using s1._domainkey while maintaining s2._domainkey as a standby record, allowing automated 2048-bit key rotation without mail delivery disruption. Domain owners confirm record publication through the DKIM Record Checker and test DNS resolution via the CNAME Record Lookup.

Step 4: How to Configure DMARC for SendGrid (_dmarc TXT Record)

Complete SendGrid authentication and satisfy Gmail, Yahoo, and Microsoft bulk-sender requirements by publishing a single _dmarc TXT policy record on your root domain across 3 steps:

  1. Check for Existing DMARC Records: Confirm whether your domain already publishes a DMARC policy using the DMARC Record Checker. Domains maintain exactly one _dmarc TXT record that governs Google Workspace, Microsoft 365, and SendGrid simultaneously.
  2. Publish a Monitoring DMARC Policy with Reporting: Generate a Stage-1 monitoring policy using the DMARC Record Generator if your domain lacks an existing record, adding a designated rua=mailto: mailbox to collect aggregate XML reports:
    Host:  _dmarc
    Type:  TXT
    Value: v=DMARC1; p=none; sp=none; adkim=r; aspf=r; rua=mailto:dmarc-reports@example.com;
  3. Verify Records Inside SendGrid: Return to the SendGrid Sender Authentication screen, check I've added these records, and click Verify to confirm all records show green checkmarks.

SendGrid achieves dual DMARC alignment through automated records. Because em1234.example.com shares the root organizational domain of example.com, it passes relaxed SPF alignment (aspf=r). Signing headers with d=example.com guarantees relaxed and strict DKIM alignment (adkim=r and adkim=s).

How to Fix SendGrid DNS Verification Failed Errors (4 Common Provider Gotchas)

SendGrid's Verify button fails when your DNS provider alters CNAME targets with an HTTP proxy, doubles domain suffixes in Host fields, or restricts underscore characters in record names. The table below lists the 4 most common SendGrid verification errors and how to resolve each one across major DNS platforms:

Verification Error Symptom Root Cause in DNS Control Panel Exact Resolution
Cloudflare: All 3 CNAMEs fail to verify Cloudflare Proxy status (Orange Cloud) is active on emXXXX, s1._domainkey, or s2._domainkey. Edit all 3 CNAME records in Cloudflare and toggle proxy status to DNS Only (Grey Cloud).
GoDaddy / Namecheap: Record not found Entering s1._domainkey.example.com in the Host field created s1._domainkey.example.com.example.com. Remove the .example.com suffix so the Host field contains only s1._domainkey, s2._domainkey, and em1234.
s1._domainkey conflicts with existing service Another email platform or secondary SendGrid subuser already occupies s1._domainkey. Delete the pending authentication, restart the wizard, open Advanced Settings, and enter a unique Custom DKIM Selector (such as sg2).
Legacy DNS registrar rejects underscore (_) Older DNS systems block underscore characters in CNAME hostnames while allowing them on TXT records. Restart the SendGrid wizard with Automated Security unchecked (OFF) to publish raw TXT keys instead of CNAME records.

DNS providers such as GoDaddy and Amazon Route 53 require up to 15 minutes to synchronize records across authoritative nameservers, making a brief pause before clicking Verify helpful for avoiding false negative results. Finalizing your SendGrid SPF, DKIM, and DMARC setup through Automated Security establishes verifiable sender reputation. Deploying the emXXXX return-path CNAME alongside dual s1._domainkey and s2._domainkey records eliminates manual key rotation, while maintaining a single _dmarc TXT policy guarantees total DMARC compliance across global receiving inboxes.

Frequently Asked Questions

What is the SendGrid SPF record include value? +

The official SendGrid SPF mechanism is include:sendgrid.net (for example, v=spf1 include:_spf.google.com include:sendgrid.net ~all). Enabling SendGrid Domain Authentication with Automated Security (the emXXXX CNAME) authenticates SPF on that subdomain automatically without requiring include:sendgrid.net on your root domain.

Why does SendGrid give me CNAME records instead of TXT records for SPF and DKIM? +

By default, SendGrid enables Automated Security, which uses 3 CNAME records (emXXXX, s1._domainkey, and s2._domainkey) pointing to SendGrid's zone. This delegates SPF IP management and 2048-bit DKIM key rotation to SendGrid so your authentication never breaks during infrastructure updates.

Is adding include:sendgrid.net to my root SPF record necessary if I set up the 3 SendGrid CNAMEs? +

In practice, root SPF records close to the 10-DNS-lookup limit omit include:sendgrid.net and rely on the emXXXX CNAME (which costs 0 lookups on your root domain and passes DMARC alignment). Add include:sendgrid.net to your root SPF only if you disabled Automated Security.

Why is SendGrid's default v=DMARC1; p=none; record missing a rua= tag? +

In real-world setups, SendGrid generates a bare v=DMARC1; p=none; snippet simply to satisfy Gmail and Yahoo's minimum requirement without knowing where to send your reports. Always append rua=mailto:your-report-address@yourdomain.com; to receive daily XML visibility into who sends as your domain.

Last verified: 2026-10-31