The DKIM Record is your cryptographic seal of authenticity for email. If you’ve ever configured Exchange Online, managed DNS, or investigated deliverability issues, understanding and mastering the DKIM Record is non‑negotiable. In this instructor‑style guide, I’ll teach you exactly what DKIM does, how it complements SPF and DMARC, how to deploy it in Microsoft 365, how to avoid the most common pitfalls I see in the field, and how to validate, rotate, and operationalize DKIM like a pro.
This lesson mirrors how I train admins in enterprise environments—clear concepts, hands‑on steps, and practical guardrails.
Table of Contents
What Is DKIM and Why the DKIM Record Matters
At its core, DomainKeys Identified Mail (DKIM) adds a digital signature to outbound messages. Receiving servers verify that signature using a public key published in your DNS—that public key lives in your DKIM Record. If the signature is valid, it proves two things:
- Domain Authorization: The message was sent by (or through) a server authorized by your domain.
- Message Integrity: The content wasn’t altered in transit.
Where SPF authenticates the sending server’s IP for a domain, the DKIM Record authenticates the message content using asymmetric cryptography. When used together with DMARC, DKIM becomes a cornerstone of email trust and deliverability.
Key takeaways:
- The DKIM Record is a DNS TXT record that publishes your public key.
- Outbound messages are signed with your private key.
- Recipients fetch your public key from DNS (via your selector hostname) to verify the signature.
- DKIM is resilient to forwarding and intermediate relays—an advantage over SPF in many real‑world scenarios.
How DKIM Works Steps by Steps
Here’s the exact flow I walk junior admins through:
- Your MTA applies a DKIM signature:
When Exchange Online sends your message, it uses your private key to sign selected headers and the body. - Selector and domain are stamped:
The signature includes a selector (e.g.,selector1) and a **d=domain** (e.g.,yourdomain.com). - Recipient queries DNS:
The receiving system looks up your DKIM Record at: selector1._domainkey.yourdomain.com - Public key verification:
The recipient uses the public key from that DKIM Record to verify the signature. If it matches, the message is both authorized and untampered. - DMARC alignment check (if configured):
DMARC evaluates whether the d= domain in DKIM aligns with the message’s visible From: domain. A pass here strengthens DMARC outcomes, even if SPF is neutral or fails.
DKIM vs. SPF vs. DMARC — The Big Picture
- SPF: Says, “These servers are allowed to send for my domain.” (IP‑based check)
- DKIM: Says, “This message was signed by my domain and hasn’t been altered.” (cryptographic check via the DKIM Record)
- DMARC: Says, “If SPF or DKIM fail (considering alignment), do X.” (policy layer: none/quarantine/reject)
In practice, I insist on all three. SPF without DKIM will struggle with forwarding. DKIM without DMARC won’t enforce policy. The DKIM Record is thus a critical piece of a well‑architected authentication stack.
Core Components of a DKIM Record
A DKIM Record is a DNS TXT record published at:
<selector>._domainkey.<yourdomain>
Common fields you’ll see inside the TXT value:
v=Version (typicallyDKIM1)k=Key type (usuallyrsa)p=Public key (base64 encoded, no spaces)- Optional tags like
t=flags (e.g.,t=yfor testing),h=headers list,n=notes (rare)
Example DKIM Record (simplified):
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFA...
In Microsoft 365, you don’t manually paste the v= tag Microsoft provides full TXT values for you to publish. But it’s essential to recognize the anatomy so you can troubleshoot confidently.
Selectors Explained (Why selector1 and selector2 Matter)
The selector is a label that lets you publish multiple DKIM keys simultaneously—for rotation and redundancy. In Exchange Online, Microsoft uses two selectors per domain by default, commonly:
selector1._domainkey.yourdomain.comselector2._domainkey.yourdomain.com
This allows you to rotate keys (switch which selector is active) without downtime. Your DKIM Record entries live under these selector hostnames, and Exchange Online signs messages with one of them based on your configuration.
Exchange Online: How to Publish and Enable the DKIM Record (Step‑by‑Step)
Here’s the battle‑tested process I teach and implement:
1) Prep: Identify Your Sending Domains
List every accepted domain you send mail from. You’ll need to enable DKIM for each domain with its own DKIM Record pair of selectors.
2) Get the CNAMEs from the Microsoft 365 Admin Center
- Go to Security → Email & Collaboration → Policies & rules → Threat policies → Email authentication settings
- In DKIM, select your domain. Microsoft provides two CNAME targets (for
selector1andselector2).
You will publish CNAME records that point to Microsoft’s hosted DKIM public keys for your tenant.
They look like:
selector1._domainkey.yourdomain.com CNAME selector1-yourdomain-com._domainkey.<initialdomain>.onmicrosoft.com
selector2._domainkey.yourdomain.com CNAME selector2-yourdomain-com._domainkey.<initialdomain>.onmicrosoft.com
Why CNAME? Because Microsoft hosts and rotates the public keys for you. Your DKIM Record (as a CNAME) delegates lookups to Microsoft’s maintained key endpoints.
3) Publish the CNAMEs in Your DNS
Use your DNS provider’s panel to add both CNAMEs. Ensure:
- Correct hostnames (no trailing dots unless your DNS UI requires them)
- Proper TTL (15 min to 1 hr is typical for agility)
- No conflicting TXT records on the same selector hostnames
4) Wait for DNS Propagation
Give it a few minutes (or up to an hour). Validate via nslookup/dig that your DKIM Record hostnames resolve to Microsoft’s CNAME targets.
5) Enable DKIM in the Admin Center (or PowerShell)
Back in Microsoft 365 DKIM settings, Enable for the domain. Once enabled, outbound mail starts being signed. Your DKIM Record path is now active.
6) Test Messages and Inspect Headers
Send a test email to an external mailbox (e.g., Gmail). View Original Message and confirm:
DKIM-Signatureheader exists- Authentication Results show
dkim=pass (signature was verified) - DMARC shows aligned
dkim=pass(if DMARC is enabled)
Best Practices I Enforce on Every Tenant
1) Always Use Both Selectors
Maintain both selector CNAMEs so you can rotate keys without service interruption. Your DKIM Record strategy depends on this.
2) Key Length and Security
Microsoft 365 uses strong RSA key sizes by default. If you self‑host DKIM elsewhere, use 2048‑bit keys (or stronger where supported). Your DKIM Record must contain the matching public key.
3) Plan for Regular Key Rotation
Rotate at least annually (or semi‑annually for higher security). With two selectors, you can:
- Introduce a new key on
selector2 - Flip signing to
selector2 - Retire
selector1after safe overlap
This keeps your DKIM Record fresh and limits exposure if a key is ever compromised.
4) Align with DMARC
Set your DKIM domain (d=) to align with your visible From: domain or organizational alignment via DMARC. This ensures DMARC pass even if SPF stumbles on forwards. Your DKIM Record is only half the equation—alignment is the other half.
5) Document Every Domain and Flow
Maintain an internal notes for:
- Accepted domains
- Selector names
- DKIM Record states (enabled/disabled)
- Rotation schedules
- Testing procedures
This avoids surprises during audits or staff turnover.
Common DKIM Mistakes (and How I Fix Them)
1) Publishing TXT Instead of CNAME (for M365)
With Microsoft 365, you generally publish CNAMEs (not raw TXT public keys). Publishing the wrong record type breaks lookups of your DKIM Record chain.
Fix: Replace TXT with CNAME as provided in the portal.
2) Typos in Selector Hostnames
One stray character and your DKIM Record can’t be found. Remember it’s selectorX._domainkey.yourdomain.com.
Fix: Copy/paste from the admin center; validate with nslookup.
3) Enabling Before DNS Propagates
Enabling DKIM before the DKIM Record resolves leads to dkim=temperror or dkim=none.
Fix: Validate DNS first, then enable.
4) Confusing SPF, DKIM, and DMARC Roles
Some admins think DKIM replaces SPF. It doesn’t. Your DKIM Record complements SPF. You need both, plus DMARC.
Fix: Keep all three enabled and aligned.
5) Forgotten Rotation
Stale keys increase risk. Your DKIM Record should change periodically.
Fix: Calendarize rotation twice a year.
Validating Your DKIM Deployment
- DNS Resolution nslookup -type=cname selector1.domainkey.yourdomain.com nslookup -type=cname selector2.domainkey.yourdomain.com Both should resolve to Microsoft’s endpoints. Since the DKIM Record is CNAME‑based, TXT lookups occur downstream.
- Send Real Mail to External Inboxes
Use Gmail, Outlook.com, Yahoo. Inspect the original message:- Look for
DKIM-Signatureheader - Authentication Results should show
dkim=pass
- Look for
- Check DMARC Reports (If Enabled)
In your aggregate reports, you should see DKIM pass for your domain. Your DKIM Record is effectively validating real traffic. - Use Third‑Party Tools
SPF/DKIM/DMARC checkers can confirm your DKIM Record is visible to the world.
Teaching DKIM to Junior Admins — My Proven Lesson Plan
- Concept: Cryptographic signing, DKIM vs. SPF, what the DKIM Record is.
- Hands‑On: Publish selectors as CNAMEs in DNS; enable in M365.
- Validation: Inspect headers, DMARC aggregates, and third‑party tools.
- Operations: Key rotation, incident response, and documentation discipline.
I also stress that the DKIM Record is a living control—don’t “set and forget.”
Advanced Topics for Pros
Subdomain Strategy
For marketing or bulk mail, consider subdomains like:
mail.yourdomain.comnews.yourdomain.com
Each with its own DKIM Record and DMARC policy. This protects your root domain’s reputation.
ARC and Forwarding
Authenticated Received Chain (ARC) helps preserve auth results across complex routing. While ARC is separate, DKIM stability under forwarding is a huge advantage over SPF. Your DKIM Record ensures downstream verifiers can still validate signatures.
Third‑Party Senders
If you use ESPs (SendGrid, Mailchimp, etc.), they’ll ask you to publish their DKIM CNAMEs/TXTs under your domain so they can sign as you. Keep these DKIM Record entries separate and clearly documented.
DKIM in Incident Response
If a private key is compromised or suspected:
- Switch selectors to the alternate key (pre‑published).
- Revoke/retire the compromised selector’s DKIM Record after safe propagation.
- Audit sending paths and third‑party integrations.
- Tighten DMARC temporarily if needed.
- Communicate with stakeholders on trust impact and remediation.
This is why I emphasize having two selectors and documented rotation steps. Your DKIM Record should enable swift, controlled recovery.
Practical Templates and Examples
Microsoft 365 (Per Domain)
Publish in DNS (CNAMEs):
selector1._domainkey.yourdomain.com CNAME selector1-yourdomain-com._domainkey.<initialdomain>.onmicrosoft.com
selector2._domainkey.yourdomain.com CNAME selector2-yourdomain-com._domainkey.<initialdomain>.onmicrosoft.com
Then Enable DKIM in the Microsoft 365 admin center.
If Self‑Hosting DKIM (Non‑M365 MTAs)
You’d publish a TXT DKIM Record like:
selector1._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq...IDAQAB"
Ensure your MTA signs using the matching private key and selector.
DMARC Policy (Complementary)
To enforce authentication outcomes alongside your DKIM Record:
_dmarc.yourdomain.com TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; adkim=s; aspf=s"
Use p=none while observing, then move to quarantine or reject as confidence grows.
Troubleshooting Quick Reference
dkim=none: DKIM disabled or DKIM Record not found.
Check selectors and CNAME resolution; ensure enabled in admin center.dkim=temperror: Temporary DNS failure.
Validate DNS health; avoid premature enabling after changes.dkim=permerror: Malformed DKIM Record or unsupported tags.
Rebuild the record using provider guidance; avoid stray characters and quotes.dkim=fail (bad signature): Content changed post‑signing (e.g., an intermediate hop altered headers/body).
Review relays, disclaimers, or in‑transit modifications; ensure canonicalization settings are compatible.
Governance: Keep Your DKIM Program Healthy
- Ownership: Assign DKIM ownership (not just “email team”), with change control.
- Monitoring: Review DMARC aggregate reports weekly.
- Rotation: Scheduled rotations and post‑rotation validation.
- Change Management: Any new sender/ESP triggers a DKIM Record review.
- Runbooks: Clear, versioned procedures for enablement, testing, rotation, and incident response.
This turns DKIM from a one‑time project into a sustained control that continuously protects your brand and deliverability.
Final Thoughts
Getting the DKIM Record right isn’t optional—it’s essential. In Exchange Online and beyond, DKIM is your cryptographic proof that messages are truly yours and haven’t been tampered with. With selectors, CNAME‑based publishing, disciplined rotation, DMARC alignment, and rigorous validation, you’ll create a resilient, high‑trust email posture.
Use the practices I’ve taught here—exactly as I implement them in enterprise tenants—and your DKIM Record will do heavy lifting for both security and deliverability. Pair this with SPF and a well‑tuned DMARC policy, and you’ll have a modern, hardened email identity that ISPs trust and attackers hate.