SendGrid: authenticate your domain
What this guide is for
SendGrid (Twilio) sends your emails from its servers. Domain authentication lets SendGrid sign your messages with DKIM for your domain and use a subdomain of yours as the return-path, which also aligns SPF.
Expected records
With Automated Security (on by default), SendGrid provides three CNAME records:
| Type | Name (host) | Value |
|---|---|---|
| CNAME | em1234 (return-path subdomain) |
u1234567.wl.sendgrid.net |
| CNAME | s1._domainkey |
s1.domainkey.u1234567.wl.sendgrid.net |
| CNAME | s2._domainkey |
s2.domainkey.u1234567.wl.sendgrid.net |
| TXT (DMARC) | _dmarc |
v=DMARC1; p=none; rua=mailto:[email protected] |
- The numbers (
em1234,u1234567) are specific to your account: copy the values shown by SendGrid. - The return-path subdomain CNAME handles SPF: no include needs to be added to your root domain's SPF record in this mode.
- If Automated Security is turned off, SendGrid provides MX and TXT records instead. DKIM names always contain an underscore (
_domainkey).
Steps in SendGrid
- In the SendGrid console, open Settings > Sender Authentication.
- Start domain authentication (Authenticate Your Domain), choose your DNS host and enter the domain you send from.
- Leave Automated Security checked, unless your host rejects underscores in CNAME records.
- On the Install DNS Records page, copy the three CNAME records to your DNS host.
- Return to SendGrid and click Verify. DNS propagation can take up to 48 hours.
Precautions:
- If your host automatically appends the domain, enter the relative name (
em1234,s1._domainkey) to avoidem1234.example.com.example.com. - Before adding the CNAME records, check that no record already exists under the same names.
Check the setup
- In Sender Authentication, the domain should show as verified.
- Check a CNAME from the command line:
dig cname s1._domainkey.example.comshould return a target undersendgrid.net. - Send a test email to Gmail and check for
DKIM: PASSwith your domain. - Run a new scan in this tool: the
s1ands2selectors should be detected.
DMARC
Publish a single TXT record at _dmarc.<your domain>, starting with monitoring:
v=DMARC1; p=none; rua=mailto:[email protected]
Read the reports for a few weeks, check that all your legitimate mail passes, then move gradually to p=quarantine and p=reject.