SendGrid: SPF, DKIM and DMARC setup
Your app sends through Twilio SendGrid, and a receiver reports an SPF, DKIM or DMARC failure. The fix is SendGrid's domain authentication: a few CNAME records that put SPF and DKIM on your own domain.
The DNS records SendGrid asks for
Start domain authentication under Sender Authentication in SendGrid, then copy the records it shows. With automated security on, which is the default, they look like this. example.com is your domain.
- CNAME
Name
em<nnnn>.example.comValueu<id>.wl<id>.sendgrid.netReturn-Path subdomain. It carries SPF, which SendGrid keeps up to date. The label is random unless you set a custom return path. - CNAME
Name
s1._domainkey.Valueexample.com s1.domainkey.u<id>.wl<id>.sendgrid.netDKIM. SendGrid hosts the key. - CNAME
Name
s2._domainkey.Valueexample.com s2.domainkey.u<id>.wl<id>.sendgrid.netDKIM, second key. - TXT
Name
_dmarc.example.comValuev=DMARC1; p=none;SendGrid suggests a starting DMARC record. If you already have one, keep yours: a domain has only one DMARC record.
With automated security off, SendGrid gives an MX and an SPF TXT record on the em subdomain and a DKIM TXT record instead, and you update them yourself when your account changes. Link branding is a separate set of CNAMEs for tracked links; it does not affect SPF, DKIM or DMARC.
Which check aligns with DMARC
- Yes: SPF aligns in relaxed mode. The Return-Path is
em<nnnn>.example.com, a subdomain of your From domain. Relaxed is the DMARC default. - Careful: SPF does not align with
aspf=s, because theemsubdomain is not exactly your From domain. SendGrid's fixes: switch to relaxed alignment, or send from a subdomain and set a custom return path that matches it. - Yes: DKIM aligns once the DKIM CNAMEs verify, because the keys sit under your domain.
DKIM alignment alone is enough for DMARC to pass. Until domain authentication is complete, recipients may see “via sendgrid.net” next to your From address.
Common mistakes
- The DNS host adds your domain twice. SendGrid names GoDaddy, Amazon Route 53 and Namecheap as hosts that append your domain. Enter
em<nnnn>, notem<nnnn>.example.com. - Sending from a subdomain you didn't authenticate. Subdomains don't inherit authentication from the parent domain. Authenticate the domain that appears in your From address.
- The DNS host rejects underscores in CNAME names. Then you can't use automated security. Turn it off and add the MX and TXT records instead.
- A selector clash. If another service already uses SendGrid's DKIM selector names on your domain, set a custom DKIM selector during setup.
- A custom return path that already exists. If the name matches an existing CNAME, the new record replaces it. Check your existing records first.
- Cloudflare proxy. Keep these CNAMEs DNS only (grey cloud). Cloudflare recommends DNS only for email and domain verification records.
Check your setup
- Check your domain with MailDoctor (form below) for SPF, DKIM, DMARC and the rest.
- Check the keys with the DKIM key checker, using the selector from each DKIM CNAME name: the part before
._domainkey(s1ands2in SendGrid's example). - Check your root SPF record with the SPF lookup counter. The automated security setup itself adds nothing to it.
- Send yourself a message through SendGrid and paste its headers into the email header analyzer. It shows the Return-Path, the DKIM domain, and which of them aligns.
Marketing mail: with subscription tracking on, SendGrid adds List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click. See List-Unsubscribe headers.
Sources, checked 27 November 2026: Configure domain authentication · Everything about DMARC · Troubleshooting DMARC failures and alignment · Cloudflare proxy status
Check the domain you send from. Grade, problems and the exact records to fix them.