Facebook tracking pixel

MailGenius

DKIM Record Setup: The 2026 Playbook That Actually Works

You've published the DKIM TXT record, checked that it resolves, and still watched your campaign land in Junk. The DNS dashboard says everything is configured. Your sending platform says the domain is authenticated. Yet the message headers tell a different story.

That situation is common because DKIM record setup has two separate parts. First, the public key must be available in DNS. Second, the platform sending the message must sign mail with the matching private key, selector, and domain. A correct DNS record can't authenticate an email that was never signed.

Why Your Emails Still Land in Spam Even With DKIM Published

A marketer recently described a familiar sequence. They added a DKIM TXT record, checked it with a DNS lookup tool, and saw the expected public key. The campaign still appeared in a filtered folder. The initial assumption was that the DNS record must be wrong.

Often, it isn't.

The record may be perfectly valid while the email service isn't using it. Many platforms let you publish a record first and enable signing later. Until signing is enabled, outbound messages won't contain a useful DKIM-Signature header. DNS proves that a public key exists. It doesn't make the sending system use the corresponding private key.

Practical rule: A resolved DKIM record is only half a setup. Always verify a real message, not just the DNS screen.

The three checks that expose the gap

Start by listing every system that sends mail with your domain in the visible From address:

  • Workspace mail: Google Workspace or Microsoft 365 may send employee and transactional messages.
  • Campaign traffic: Your email service provider may send newsletters, sequences, and automated journeys.
  • Operational mail: Your website, CRM, billing system, support desk, and scheduling tools may use separate relays.

The second failure is a selector mismatch. Suppose you publish selector2025, but the platform signs with selector2026. The receiving server queries the selector found in the message, not the selector you intended to publish. If that DNS name has no matching key, verification fails.

The third is a forgotten relay. A sales team might test Gmail, while the production campaign leaves through a separate ESP. The marketer sees one system working and assumes every sender is covered.

Check the raw headers of a delivered message and confirm dkim=pass, the signing domain in d=, and the selector in s=. If you're unsure how to check if emails are going to spam, start with the message headers and delivery folder, then trace the sending platform that handled the message.

How DKIM Actually Works Under the Hood

DKIM uses an asymmetric key pair. The sending system keeps the private key, while the domain publishes the matching public key in DNS. The private key signs selected message headers and the message body, producing a cryptographic value placed in a DKIM-Signature header.

That header contains several important tags. The d= tag identifies the signing domain, and the s= tag identifies the selector. Together, they tell the receiving server where to find the public key:

selector._domainkey.domain

The selector is not decoration. It creates a separate namespace under _domainkey, allowing a domain to maintain more than one active key. The DKIM specification defines how the s= and d= values combine into the DNS lookup used during verification.

An infographic illustrating the four-step process of how DKIM works to authenticate email messages.

What the receiver verifies

The receiving server reads the signature, retrieves the public key from DNS, and recalculates the message hash. It checks the selected headers and body against the signature. If the public key, selector, signing domain, and message content all line up, the receiver can report a DKIM pass.

A failure doesn't necessarily mean the key is fraudulent. It can indicate that the message changed after signing, the DNS key is unavailable, or the sender used a different selector than the administrator published.

Canonicalization controls how tolerant the verification process is of limited formatting changes. This matters when messages pass through forwarding systems or gateways that alter whitespace or line endings. It won't rescue a message whose body has been materially rewritten, but the signing platform's chosen canonicalization method can affect resilience in transit.

The important operational distinction is simple: DNS stores the public half, while the sending platform must actively use the private half.

Generating Your Key Pair and Formatting the Record

A new selector should use a 2048-bit RSA key. RFC 8301 requires at least 1024 bits and recommends 2048-bit keys, which remains the practical production baseline in current DKIM setup guidance. Older systems may accept 1024-bit keys, but a new deployment should use 2048 bits unless the sending platform imposes a documented limitation.

If your team operates its own mail infrastructure, generate the key pair with tooling supported by the signing service. An OpenSSL-based workflow should cover four steps:

  • Create the private key: Generate a 2048-bit RSA private key and restrict access to the signing service.
  • Extract the public key: Export the public portion in a format suitable for DNS.
  • Normalize the payload: Remove line breaks and unnecessary whitespace from the base64 public-key output.
  • Build the TXT value: Begin with v=DKIM1; k=rsa; p= and append the complete public key.

The private key must stay out of DNS. Publish only the public key at a hostname such as selector._domainkey.example.com. Use a selector name that helps identify the sending platform or rotation period, without placing sensitive information in the label. If several platforms send for the domain, give each one its own selector so their keys can be rotated independently.

The long-record trap

A 2048-bit RSA public key is typically about 370 to 450 base64 characters, while a 1024-bit key is typically about 180 to 220 characters, according to DKIM key length guidance. DNS editors commonly limit an individual TXT string to 255 characters, so a 2048-bit key may not fit as one quoted value.

Split the value into consecutive quoted strings within one TXT record. DNS concatenates those strings when it returns the record. Do not create separate TXT records for the same selector, and do not add spaces inside the base64 payload.

A safe structure looks like this:

"v=DKIM1; k=rsa; p=first-part..." "remaining-base64..."

The editor may display the chunks differently, but the resolved value must reconstruct one continuous public key. Store the private key in a protected secret store, record which platform signs with each selector, and plan rotation without removing the active key before the platform has switched.

Publishing the DKIM Record Across Major DNS Hosts and ESPs

The publish step varies more by interface than by protocol. Cloudflare usually presents a straightforward TXT editor and may handle quotation marks for you. GoDaddy can split long values in its interface, while Route 53 often expects the fully qualified record name and may use a trailing dot in DNS-style notation.

The hostname still follows the same pattern:

selector._domainkey.domain.com

Google Workspace and Microsoft 365 generally generate the selector and key material inside the administration console. You add the requested DNS record, wait for it to become visible, and then return to the platform to enable DKIM signing. The DNS step alone doesn't activate mail signing.

Third-party ESPs often use CNAME delegation instead of asking you to paste a long RSA key. SendGrid, Mailgun, and Postmark may provide CNAME targets that point from your selector hostname to infrastructure controlled by the provider. In that model, the ESP manages the underlying TXT record, while your DNS zone publishes the delegation record. Follow the exact record type the platform provides. Don't substitute TXT for CNAME because the hostname looks similar.

Platform Record Type Who Owns the Key Common Trap
Cloudflare TXT or provider-specified record Your domain or platform Manually adding quotation marks when the editor already handles them
GoDaddy TXT or provider-specified record Your domain or platform Long values being split or altered by the editor
Route 53 TXT or CNAME, depending on sender Your domain or ESP Incorrect fully qualified name or trailing-dot handling
Google Workspace Platform-generated DNS record Google generates and uses the key Publishing the record but not enabling signing
Microsoft 365 Platform-generated DNS record Microsoft generates and uses the key Confusing the tenant's requested selector with another sender
Third-party ESP Often CNAME delegation ESP manages the underlying key Treating a CNAME target like a TXT public key

DNS-only checklist

Before testing a message, confirm:

  • Record name: The selector and _domainkey label are in the correct order.
  • Record type: It matches the platform's instructions.
  • Payload integrity: The public key hasn't been truncated or reformatted.
  • Duplicate control: There isn't a second conflicting record for the same selector.
  • TTL awareness: Existing DNS caches may delay visibility during deployment or rotation.

For a provider-specific explanation of Gmail email authentication, check the signing settings in the Google administration console after DNS publication. The same principle applies across platforms: publish first, then enable the signer.

Validating That Your Record Resolves and Signs Correctly

Validation needs three layers because each catches a different failure. A DNS checker can confirm that a public key is visible, but it can't prove that your ESP signs mail. A message header can show a signature, but it may reveal that the sender used the wrong selector.

Layer one, inspect the DNS response

Query the exact hostname built from the selector and signing domain. A typical lookup is:

dig TXT selector._domainkey.domain.com +short

The response should contain the DKIM version, key type, and public key fields:

  • v=DKIM1: Identifies the record as a DKIM key record.
  • k=rsa: Identifies the key type in a common RSA deployment.
  • p=: Contains the complete base64 public key.

If the output is truncated, split incorrectly, or missing the p= value, fix the DNS record before testing mail. A long key may return as several strings, but those strings must form one continuous value when interpreted by the resolver.

Layer two, use a parsed record check

A public parser such as MXToolbox SuperTool or Google's DNS lookup tools can expose formatting problems that are easy to miss in a DNS editor. This is particularly useful when a host automatically adds quotes, inserts line breaks, or stores two independent TXT records under the same selector.

Screenshot from https://example.com/screenshots/gmail-authentication-results.png

Don't treat a green DNS result as proof of delivery. It only means the lookup returned something that the tool could parse. The key must also correspond to the private key used by the sending service.

Layer three, inspect a real message

Send a message through the production path to a Gmail inbox. Open the raw message and find Authentication-Results. You want to see dkim=pass, with the expected signing domain and selector.

The exact values matter. If your DNS record exists at selectorA._domainkey.example.com, but the header says s=selectorB, the test is a failure even if selectorB happens to pass through another key. A pass under the wrong domain can also leave DMARC alignment broken.

Use a DKIM checker tool to supplement header review, not replace it. Test messages should come from every meaningful sender, including your CRM, website, transactional provider, and employee mailbox platform.

Allow for DNS propagation and TTL caching before diagnosing a new record. A resolver that cached a previous negative answer can continue returning “not found” after the record has been corrected. Test from more than one network if the result seems inconsistent.

The stronger operational model treats DKIM as a lifecycle, not a publish-once task. Independent operational guidance recommends rotating keys every 6 to 12 months, especially for active sending systems, as described in selector-based rotation guidance. A clean rollover uses two selectors:

  1. Publish the new public key under a new selector.
  2. Wait for DNS visibility.
  3. Change the sender to sign with the new selector.
  4. Keep the old selector published for a drain period of 7 to 14 days.
  5. Remove the old selector after delayed or queued messages have had time to clear.

Rotating only the private key doesn't help. The receiver still retrieves the old public key, so the signature can't validate. Keep a simple inventory of selectors, key owners, DNS locations, and platform settings, then rotate on a calendar rather than waiting for an incident.

The supplied operational guidance also notes that stale signing keys can create negative signals in Google's bulk-sender evaluation and that Microsoft 365 may reject signing with a public key older than 12 months. Treat those provider behaviors as reasons to maintain key hygiene, not as a substitute for checking actual headers.

The video below demonstrates the kind of technical inspection that helps separate DNS visibility from message-level authentication.

Troubleshooting the DKIM Failures That Cost You the Inbox

Most failures become obvious once you compare three things side by side: the DNS hostname, the platform's active selector, and the header from a real message. The common mistake is checking only one of them.

Selector mismatch

An ESP might sign with selector2024 while DNS contains only selector2023. Read the s= value in Authentication-Results or DKIM-Signature, then query that exact selector. Don't guess based on the selector you remember configuring.

Broken split strings

A long base64 key can be split safely inside one TXT record. It fails when the editor creates separate records, inserts stray characters, or truncates one segment. A DNS response should reconstruct one continuous key. If it doesn't, remove the malformed record and republish it using the provider's documented multi-string format.

Propagation and negative caching

A newly published record may be visible from one resolver and absent from another. Stale negative answers can make a corrected record look broken for longer than expected. Check authoritative DNS and an external resolver before changing keys repeatedly.

Signing not enabled

The DNS record can be correct while the platform sends unsigned messages. Look for an activation control in Google Workspace, Microsoft 365, or your ESP. Then send a fresh message. Old messages won't gain a signature after you enable the feature.

Body changes after signing

A valid signature can fail if a relay modifies the signed body. Tracking pixels, rewritten links, footers, and gateway processing may alter content after the original signer has calculated the body hash. Identify which system made the last change, then configure signing at the final content-producing stage or prevent the relay from modifying signed content.

Debug in order: Read the header first, identify the actual selector and domain, then verify DNS. Rebuilding keys before those checks usually creates more confusion.

Putting DKIM Together With SPF and DMARC for 2026 Compliance

DKIM is one part of the authentication stack. SPF checks whether the sending infrastructure is authorized for the envelope sender. DKIM attaches a cryptographic signature to the message. DMARC evaluates whether SPF or DKIM aligns with the visible From domain and tells the receiving system how to handle failures.

Alignment is where many otherwise valid setups break. A message can pass DKIM for a provider-owned domain while the visible From address uses your brand domain. For DMARC alignment, the signing domain in d= needs to align with the header From domain, or SPF must provide the aligned pass.

A sensible policy progression starts with p=none, which lets you collect reports without instructing receivers to quarantine or reject. After you understand legitimate senders and fix alignment, move toward p=quarantine, then p=reject when your sending inventory is reliable. Don't advance policy while an unknown CRM or support platform is still sending unauthenticated mail.

The operational checklist

  • SPF: Authorize every legitimate sender and keep the record maintained.
  • DKIM: Enable signing in each platform and verify the active selector.
  • DMARC: Use reporting to find unauthorized or misaligned sources before enforcement.
  • From alignment: Make the DKIM signing domain compatible with the visible From domain.
  • Unsubscribe handling: Support one-click unsubscribe where bulk-sender rules require it.
  • Complaint control: Monitor spam complaints and keep the rate under 0.3%, as specified in the supplied bulk-sender guidance.
  • Testing: Send real messages through each production route and inspect mailbox-provider results.

Google, Yahoo, and Microsoft have tightened expectations around authentication and sending practices for bulk mail. The practical lesson isn't to collect records for a checklist. It's to operate a complete system where SPF, DKIM, DMARC, alignment, unsubscribe handling, and reputation monitoring agree.

A diagram outlining the four essential steps of email authentication: SPF, DKIM, DMARC, and domain alignment.


MailGenius checks SPF, DKIM, DMARC, message quality, blacklist status, and other inbox-placement signals through a test email, so you can confirm whether your DKIM record setup works at the mailbox-provider level. Visit MailGenius and run an email spam test before your next campaign, then fix the specific authentication or reputation issues it identifies.

Free Email Spam Test:

Will your Email Land in the Spam Folder?

Send an email to the address below to see your Spam Score:
loading...
MailGenius users test over 1M emails per year! By using our Email Tester, you will agree to our Privacy Policy and Terms of Service. The sending email address will receive emails from MailGenius. All tests are hosted on public links.

Try MailGenius Today

Run a Free Email Deliverability Test - Send an Email to the Address Below, then Click “See Your Score”:

Free Email Spam Test:

Will your Email Land in the Spam Folder?

Send an email to the address below to see your Spam Score:
loading...
MailGenius users test over 1M emails per year! By using our Email Tester, you will agree to our Privacy Policy and Terms of Service. The sending email address will receive emails from MailGenius. All tests are hosted on public links.

Try MailGenius Today