Quick Answer

To set up DKIM: 1) Generate DKIM keys in your ESP's dashboard (they'll provide the public key), 2) Add the public key as a TXT or CNAME record in your DNS at selector._domainkey.yourdomain.com, 3) Enable DKIM signing in the ESP, 4) Verify by sending a test email and checking headers for dkim=pass. Most ESPs provide copy-paste DNS records—the setup is mostly DNS configuration.

How to Set Up DKIM for Any ESP: Complete Guide

By Braedon·Mailflow Authority·Email Authentication·Updated 2026-03-31

DKIM Setup Overview

DKIM (DomainKeys Identified Mail) cryptographically signs your emails, proving they weren't modified in transit and came from an authorized sender. DKIM is one of the three pillars of email authentication, alongside SPF and DMARC.

The setup process:

  1. ESP generates a key pair (public + private)
  2. You add the public key to your DNS
  3. ESP signs outbound mail with the private key
  4. Receivers verify signatures using your public key

Step 1: Generate DKIM Keys

In Your ESP Dashboard

Every ESP has a domain authentication section. Common locations:

ESPLocation
SendGridSettings → Sender Authentication → Authenticate Your Domain
MailgunSending → Domains → DNS Records
PostmarkSender Signatures → Add Domain
MailchimpSettings → Domain Verification
KlaviyoSettings → Domains → Add Domain
HubSpotSettings → Domain & URLs → Connect a domain

The ESP generates:

  • Private key: Kept by the ESP, used for signing
  • Public key: Given to you for DNS
  • Selector: A name to identify this key (e.g., s1, k1, google)

Generated Output Example

Your ESP provides something like:

DNS Record Type: TXT (or CNAME) Host: s1._domainkey.yourdomain.com Value: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ...

Or for CNAME: Host: s1._domainkey.yourdomain.com Target: s1.domainkey.sendgrid.net

Step 2: Add DNS Records

Log into your DNS provider and add the record exactly as provided.

For TXT Records

FieldValue
Host/Names1._domainkey (or full FQDN depending on provider)
TypeTXT
ValueThe DKIM key string from your ESP
TTL3600 (or default)

For CNAME Records

FieldValue
Host/Names1._domainkey
TypeCNAME
TargetThe target domain from your ESP
TTL3600

Practitioner note: CNAME records are easier to maintain—when the ESP rotates keys, they update their end and your DNS automatically follows. TXT records require manual updates during key rotation. Choose CNAME when offered.

DNS Provider Examples

Cloudflare:

  1. DNS → Add record
  2. Type: CNAME (or TXT)
  3. Name: s1._domainkey
  4. Target/Content: [ESP-provided value]

GoDaddy:

  1. DNS Management → Add
  2. Type: CNAME or TXT
  3. Host: s1._domainkey
  4. Points to / Value: [ESP-provided value]

Step 3: Enable DKIM Signing

Some ESPs start signing automatically once DNS is verified. Others require manual activation.

Check your ESP dashboard:

  • SendGrid: Click "Verify" after adding DNS
  • Mailgun: Domain status shows "Active" when verified
  • Postmark: Click "Verify DNS" then "Verify DKIM"
  • Google Workspace: Admin Console → Apps → Gmail → Authenticate email → Start Authentication

Step 4: Verify DKIM Works

Method 1: Send Test Email

  1. Send email from your ESP to a Gmail account
  2. Open the email in Gmail
  3. Click three dots → "Show original"
  4. Look for Authentication-Results:
dkim=pass [email protected] header.s=s1 header.b=abc123

dkim=pass confirms DKIM is working.

Method 2: MXToolbox DKIM Lookup

  1. Go to MXToolbox DKIM Lookup
  2. Enter your domain and selector (e.g., yourdomain.com and s1)
  3. Check that the key is found and valid

Method 3: dig Command

dig TXT s1._domainkey.yourdomain.com +short

Should return your DKIM public key.

ESP-Specific Setup Guides

SendGrid

  1. Settings → Sender Authentication → Domain Authentication
  2. Enter your domain, choose DNS host
  3. Add the provided CNAME records (usually 3 records for DKIM + SPF)
  4. Click "Verify"

Mailgun

  1. Sending → Domains → Add New Domain
  2. Add provided TXT records for DKIM
  3. Wait for verification (automatic)

Postmark

  1. Sender Signatures → Add Domain
  2. Copy the DKIM TXT record
  3. Add to DNS
  4. Click "Verify DKIM"

Google Workspace

  1. Admin Console → Apps → Google Workspace → Gmail
  2. Authenticate email → Generate new record
  3. Choose key length (2048-bit recommended)
  4. Add TXT record to DNS
  5. Start authentication

Microsoft 365

  1. Microsoft 365 Defender → Email & collaboration → Policies
  2. DKIM → Select domain → Enable
  3. Add provided CNAME records
  4. Wait for propagation and enable

Common Setup Issues

"DKIM record not found"

  • Check the selector is correct (case-sensitive in some DNS providers)
  • Wait for DNS propagation (15-60 minutes)
  • Verify record is at selector._domainkey.domain.com, not selector._domainkey

"DKIM signature verification failed"

  • Key mismatch: Regenerate keys in ESP and update DNS
  • Record too long: Some DNS providers truncate long TXT records. Use CNAME if available
  • Wrong record type: Make sure you're using TXT if ESP specifies TXT

"Key too long for DNS"

DKIM 2048-bit keys exceed some DNS providers' single-string limit. Solutions:

  • Use CNAME instead of TXT
  • Split the key into multiple strings (some ESPs do this automatically)
  • Contact DNS provider about TXT record limits

Practitioner note: The "record not found" error after setup is almost always propagation timing or a typo in the selector name. Wait an hour before troubleshooting further.

Multiple ESP Setup

You can have DKIM for multiple ESPs simultaneously—each uses different selectors:

google._domainkey.yourdomain.com → Google Workspace
s1._domainkey.yourdomain.com → SendGrid
smtp._domainkey.yourdomain.com → Mailgun

All can coexist. Receiving servers use the selector specified in the email's DKIM-Signature header to look up the correct key.

If you need help setting up DKIM for a complex multi-ESP configuration, schedule a consultation.

Sources


v1.0 · March 2026

Frequently Asked Questions

How do I get DKIM keys from my ESP?

In your ESP's dashboard, look for 'Domain Authentication', 'Sender Authentication', or 'Email Authentication'. The ESP generates a key pair and gives you the public key to add to DNS.

Where do I add the DKIM DNS record?

Add a TXT (or CNAME) record at selector._domainkey.yourdomain.com. The selector is provided by your ESP (e.g., s1, google, k1). The value is the public key or CNAME target.

How do I verify DKIM is working?

Send a test email to Gmail, open it, click three dots → Show original, and look for 'dkim=pass' in Authentication-Results. Or use MXToolbox DKIM Lookup with your selector.

Do I need DKIM if I already have SPF?

Yes. SPF and DKIM serve different purposes. DKIM survives email forwarding (SPF doesn't), and DMARC alignment can use either. Both should be configured.

Can I use DKIM for multiple ESPs?

Yes. Each ESP uses different selectors, so multiple DKIM records can coexist. You might have google._domainkey for Workspace and s1._domainkey for SendGrid.

Want this handled for you?

Free 30-minute strategy call. Walk away with a plan either way.