SendGrid DKIM: Custom Domain Authentication & DMARC Alignment

Authenticate a SendGrid domain: the three CNAMEs with Automated Security, how the Return-Path CNAME creates SPF alignment, and the TXT alternative.
3 min read
Updated 2026-11-04
Brand Specific
sendgriddkimdmarcesp

SendGrid can send with nothing but an API key, and that is the trap: unauthenticated mail leaves with SendGrid-branded Return-Paths and signatures, receivers still attribute it to your domain, and DMARC fails. Domain authentication — publishing SendGrid's records so mail is signed and enveloped with your domain — takes about fifteen minutes and fixes all of it.

This guide covers the Sender Authentication flow, Automated Security on and off, and why those records produce DMARC alignment.

What you need

  • A SendGrid account with access to Settings > Sender Authentication.
  • DNS write access. Cloudflare-specific pitfalls are in the Cloudflare DNS guide.
  • DMARC basics: the goal is alignment, not merely passing checks.

Step 1: Start domain authentication

  1. In SendGrid, open Settings > Sender Authentication and click Authenticate Your Domain.
  2. Enter your sending domain — yourdomain.com, or better, a subdomain such as mail.yourdomain.com.
  3. Pick your DNS provider from the list so SendGrid pre-formats the host names, or "Other".
  4. Decide whether to enable link branding and a branded Return-Path; both add mail-related records.

Step 2: Automated Security on — three CNAMEs

With Automated Security enabled (the default and the recommended path), SendGrid asks for exactly three CNAMEs:

s1._domainkey.yourdomain.com    CNAME  s1.domainkey.u123456.wl.sendgrid.net
s2._domainkey.yourdomain.com    CNAME  s2.domainkey.u123456.wl.sendgrid.net
em1234.yourdomain.com           CNAME  return.sendgrid.net
  • s1 and s2 are the DKIM keys. SendGrid signs every message with d=yourdomain.com through a selector that resolves via these CNAMEs, so DKIM passes and aligns with your From domain. Because they are CNAMEs, SendGrid rotates keys without DNS edits on your side.
  • em1234 is the Return-Path domain. Instead of bouncing to @sendgrid.info, mail is enveloped from em1234.yourdomain.com — your own subdomain. SPF validates the Return-Path domain, so with include:sendgrid.net in the root record, SPF passes on a domain that matches your From domain under relaxed alignment.

Publish the records, then click Verify. Failures here are almost always a host-name issue; see Common mistakes.

Step 3: Automated Security off — the TXT alternative

If your DNS host cannot serve these CNAMEs (some enterprise setups restrict them), disable Automated Security and SendGrid provides TXT records:

em1234.yourdomain.com         TXT    v=spf1 include:sendgrid.net ~all
s1._domainkey.yourdomain.com  TXT    v=DKIM1; k=rsa; p=MIIBIjANBgkq...(public key)
s2._domainkey.yourdomain.com  TXT    v=DKIM1; k=rsa; p=...(second public key)

Alignment works identically, but you now own key management. 2048-bit values can exceed some providers' 255-character string limit and must be published exactly as given. Unless you have a hard constraint, prefer Automated Security.

SPF and DMARC around SendGrid

Either way, the root SPF record must authorize SendGrid — merged into one record, never a second v=spf1 TXT:

v=spf1 include:_spf.google.com include:sendgrid.net ~all

Check it with the SPF Checker or build it with the SPF Generator. Running Workspace or Microsoft 365 too? See the Google Workspace and Microsoft 365 guides; running two ESPs? Compare with the Mailgun guide.

DMARC lives in your DNS at _dmarc.yourdomain.com. Start at p=none with a rua address, read reports in the DMARC Report Analyzer, then escalate — generate the record with the DMARC Generator.

Verify with Authentication-Results

Send a test through the authenticated domain and inspect the raw message — Show original in Gmail, or the header analyzer:

spf=pass (sender SPF authorized) smtp.mail-from=em1234.yourdomain.com
dkim=pass (2048-bit key) header.d=yourdomain.com
dmarc=pass (p=none) header.from=yourdomain.com

What matters: header.d= equals your From domain, and the envelope domain in smtp.mail-from sits under your domain. Confirm the published records with the DKIM Checker (selector s1) and a TXT lookup, or sweep everything with the Email Health Check.

Common mistakes

  • DNS host appends the domain. Entering s1._domainkey.yourdomain.com at a provider that auto-appends creates a doubly-suffixed name and silent DKIM failure.
  • Proxying the CNAMEs. On Cloudflare all three must be DNS only; a proxied CNAME returns edge IPs and verification never succeeds.
  • Adding a second root SPF record. SendGrid's value must be merged into your existing record.
  • Sending before verification finishes. Unverified domains use SendGrid defaults — test traffic only after the domain shows verified.
  • Authenticating a different domain than the From header. SendGrid signs with the authenticated domain, but DMARC alignment compares it to the visible From domain.

Frequently asked questions

Why three CNAMEs instead of one?

Two carry DKIM selectors so SendGrid can rotate keys without a gap; one creates the aligned Return-Path subdomain. Each solves a different piece of DMARC.

Do I still need include:sendgrid.net with the Return-Path CNAME?

Yes. The CNAME makes the envelope domain yours, but SPF still has to authorize SendGrid's connecting IPs — and the em-subdomain inherits your root includes.

Subdomain or root domain authentication?

A dedicated subdomain isolates reputation and keeps bulk mail away from corporate mail, and is what SendGrid recommends for most senders. Authenticate the root only if From addresses must be name@yourdomain.com.

Was this guide helpful?