Skip to main content
AI on the Line: The Voice Phishing Threat, December 1
Blog
Agentic Email Security

How to Set Up DKIM: DNS Records, Signature Verification, Key Rotation, and Multiple Providers

NOVEMBER 11, 202627 MIN READ
Adaptive TeamAdaptive Team

Read summarized version with

How to Set Up DKIM: DNS Records, Signature Verification, Key Rotation, and Multiple Providers

Key takeaways

  • DKIM proves a limited claim: A pass shows that the signing domain controlled the private key and that the signed content arrived intact. It does not make the visible From address trustworthy.
  • Every sender needs its own selector: Inventory corporate, transactional, marketing, and third-party senders, and give each provider a unique selector in the authoritative DNS zone.
  • The private key stays with the signing system: DNS publishes only the public key, so administrators can delegate record publication without ever sharing the private key.
  • Received headers confirm the result: A delivered message showing dkim=pass, the expected s= selector, and an aligned d= domain is the strongest evidence that a sender is configured correctly.
  • Rotation runs in parallel: Publish a new selector, switch signing, and retire the old key only after mail signed with it has aged out.

Want more from Adaptive in your Google results?

Add Adaptive as a preferred source on Google

IT and email administrators who know how to set up DKIM can prove message origin and integrity to receiving mail systems. Those systems can then verify that an authorized domain signed a message and that its content was not altered in transit. The guide walks through sender inventory, key generation, text (TXT) records and canonical name (CNAME) delegations, and signing activation for Google Workspace, Microsoft 365, Zoho Mail, self-hosted servers, and third-party platforms.

It also explains how to read Authentication-Results headers and diagnose failures in DNS, selectors, signatures, and alignment. It then shows how SPF (Sender Policy Framework), DKIM, and DMARC (Domain-based Message Authentication, Reporting, and Conformance) work as distinct controls. DKIM authenticates the signing domain. It does not prove that the visible From address is trustworthy, so a DKIM pass cannot by itself stop spoofing, business email compromise (BEC), or social engineering.

Operational safety matters as much as configuration. A leaked private key, overwritten selector, stale DNS record, or message-changing gateway can turn a correct deployment into an authentication gap. The sections below show how to validate each sender, manage selectors across domains and providers, and rotate keys without interrupting mail. They also show how to pair technical controls with employee training against spear phishing, vishing, smishing, and AI-generated cyberattacks.

For protection against the social engineering that still reaches authenticated inboxes, explore Adaptive Security's email security platform.

Set up DKIM: email administrator reviewing DNS records and mail server signing configuration on dual monitors.

What Is DKIM and How Does It Authenticate Email?

To understand how to set up DKIM, start with what DomainKeys Identified Mail (DKIM) proves. DKIM is an email authentication method that allows a sending domain to attach a cryptographic signature to a message. The receiving system checks that signature against a public key published in DNS.

A valid result confirms that the signed content was not altered after signing and that the signer controls the private key associated with the domain named in the signature.

DKIM Authentication Mechanics

DKIM authentication follows a defined path from message creation to verification. The outbound mail service selects a private key and a selector associated with the sending domain. It canonicalizes the message, calculates a cryptographic hash of the body, hashes the selected headers, and uses the private key to generate a signature. The service inserts the result into a DKIM-Signature header before the message leaves the sender's mail system.

The recipient's mail server reads the signature and extracts the signing domain from d= and the selector from s=. It combines those values to form a DNS lookup such as:

selector._domainkey.example.com

The DNS response contains the public key that corresponds to the sender's private key. The receiving system recomputes the body hash and compares it with the bh= value in the header. It then uses the public key to verify the b= signature over the signed headers. If both checks succeed, the receiver records a DKIM pass.

The DomainKeys Identified Mail (DKIM) Signatures specification (RFC 6376, 2011) defines this process as a claim of responsibility by the signing domain. That claim identifies the signing domain only. It says nothing about the person who wrote the message.

RFC 6376, edited by Dave Crocker, Tony Hansen, and Murray Kucherawy, states the boundary directly. It says that "DKIM separates the question of the identity of the Signer of the message from the purported author of the message." Security teams should read a pass result with that distinction in mind.

A concise setup sequence follows:

  1. Generate a DKIM key pair through the email provider or sending platform.
  2. Publish the public key as a TXT record at selector._domainkey.example.com, or publish the CNAME records the provider supplies.
  3. Keep the private key inside the authorized sending service and never publish it.
  4. Enable DKIM signing for outbound mail.
  5. Send a test message and confirm that the receiving system reports dkim=pass.
  6. Rotate selectors and keys under a documented DNS and mail-service change process.

DKIM does not encrypt email. Encryption protects confidentiality by making message content unreadable to parties without the decryption key. DKIM creates a verifiable signature, so recipients can detect changes to signed content and identify the domain that accepted responsibility for signing it. A signed message remains readable in transit and at rest unless a separate encryption technology protects it.

DKIM also differs from SPF. Sender Policy Framework checks whether the server or IP address that delivered a message is authorized to send mail for the envelope domain. DKIM checks a signature attached to the message and can remain valid when email passes through forwarding systems that change the sending server.

Neither mechanism alone establishes that a message is safe. DMARC adds policy and alignment logic by evaluating whether an authenticated domain aligns with the visible From domain.

What Do the d=, s=, h=, bh=, and b= Tags Mean?

A DKIM-Signature header uses tag-value pairs. These tags tell the receiving system which domain signed the message, where to find the public key, what content was covered, and how to verify the cryptographic result.

  • d= signing domain: Identifies the domain claiming responsibility for the message. It also supplies the domain portion of the DNS key lookup.
  • s= selector: Identifies the specific key record within the signing domain. A domain can operate several selectors for different providers, systems, environments, or key-rotation periods.
  • h= signed headers: Lists the message headers included in the signature calculation, such as From, To, Subject, and Date. RFC 6376 requires the From header to be signed, which ties the displayed author address to the signature.
  • bh= body hash: Contains the base64-encoded hash of the canonicalized message body, or the signed portion of it. If the body changes and the new hash does not match, verification fails.
  • b= signature value: Contains the base64-encoded cryptographic signature generated over the selected headers and the DKIM-Signature header itself, with the b= value treated as empty during calculation.

A typical header might begin like this:

DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=mail2026;

h=from:to:subject:date; bh=...; b=...

The d= and s= values guide the DNS lookup. The h= value defines the signed headers. The bh= value allows the receiver to test body integrity, while b= allows it to validate the cryptographic signature. If any required value is missing, malformed, or inconsistent with the message, the receiving system should treat the signature as invalid.

How Do Public and Private DKIM Keys Work?

DKIM uses asymmetric cryptography, which means the private and public keys perform different jobs. The outbound mail service uses the private key to sign messages. The public key is published in DNS so receiving systems can verify those signatures without gaining the ability to create new ones.

Store the private key only within the mail provider, outbound gateway, or signing infrastructure authorized to send for the domain, because it is the one secret that must stay within that system. If a cyberattacker obtains it, that cyberattacker can generate messages that pass DKIM verification for that selector until the key is revoked or removed. Publishing the private key in DNS, placing it in source code, or sharing it through ordinary email defeats the authentication model.

The public key belongs in a DKIM record, a DNS TXT record under the selector namespace. For a domain of example.com and selector mail2026, the record appears at mail2026._domainkey.example.com. The record includes a key type and public-key value, commonly represented by k=rsa and p=. DNS providers often split long TXT values into quoted strings, and the receiving system concatenates those strings before using the key.

Selectors make controlled key rotation practical because a new key can be published under a new selector while the old one stays live. Replacing a key under an active selector without a transition plan can cause delayed messages to fail authentication even when the sender's configuration is otherwise correct.

What Does DKIM Prove, and What Does It Not Prove?

A successful DKIM result proves three limited but valuable facts. The signing domain controlled the private key used to produce the signature. The receiving system located the corresponding public key through DNS. The signed body and headers still match the cryptographic values calculated when the message was signed.

A DKIM pass does not prove that the visible From address is legitimate. A cyberattacker can send a message from attacker.example with a valid DKIM signature while displaying trusted-company.example in the From field. The signature can be authentic for the cyberattacker's domain and still support a deceptive message.

DKIM also cannot show that the sender is a trusted organization or that the content is safe. A cyberattacker can resend a validly signed message to new recipients, which is called replay. A signature covers only the headers listed in h= and the body portion counted by the body hash, so unsigned elements can still change.

DKIM therefore belongs in a layered email-authentication program. Configure SPF, DKIM, and DMARC together, verify alignment with the visible From domain, and monitor authentication results. Employees should learn that authentication indicators are signals and that none of them guarantees safety.

When a message passes technical controls but still looks suspicious, employees remain the final decision point, supported by phishing simulations that rehearse email authentication and social-engineering signals.

What Do Administrators Need Before They Set Up DKIM?

Before administrators set up DKIM, they should collect the permissions, domains, sending services, and key-management decisions that determine whether the configuration will work. Inventory every system that sends mail, map each sender to the domain customers see, and confirm who controls the relevant DNS zones.

Treat private keys as production secrets, and test every configured sender from an external mailbox before declaring the DKIM setup complete.

Planning to set up DKIM: IT team inventories outbound email senders, domains, and DNS ownership before configuration.

1. Inventory Every Outbound Sender

Create a sender inventory that covers more than the primary email platform. Record each visible From domain or subdomain, provider, sending purpose, technical owner, administrator, DNS owner, expected volume, and supported DKIM method, such as a TXT record or CNAME delegation.

Include four sender groups:

  • Corporate senders: Microsoft 365, Google Workspace, on-premises Exchange, help desks, ticketing systems, and executive mailboxes.
  • Transactional senders: Billing, invoices, password resets, account alerts, product notifications, and customer-support workflows.
  • Marketing senders: Email marketing, newsletters, event platforms, recruiting campaigns, and customer lifecycle automation.
  • Third-party senders: CRM platforms, payment processors, survey tools, application infrastructure, and agencies sending on the organization's behalf.

Do not rely on memory or a marketing team's list. Review DNS zones, Simple Mail Transfer Protocol (SMTP) credentials, application configurations, vendor contracts, and mail-flow logs. A small business can manage this inventory in one shared spreadsheet. An enterprise should assign an owner to each business unit and reconcile the inventory with procurement and identity teams.

List the exact domains and subdomains used in visible From addresses, such as example.com, billing.example.com, and news.example.com. A provider sending as billing@example.com requires different alignment planning from one sending as billing@billing.example.com.

Administrators also need access to each sending platform and authoritative DNS access for every domain involved. Platform access allows administrators to generate or retrieve selector records and activate signing, while DNS access allows them to publish the public key record.

If different teams hold those permissions, establish a handoff before starting and document who approves each change. Record the owner responsible for provider changes, key rotation, and decommissioning in the organization's change management plan.

2. Choose Selectors, Key Length, and Key Storage

A DKIM selector is the label that tells receiving mail systems which public key to retrieve. One domain can have multiple selectors because each provider can use a distinct label and because organizations need separate selectors for key rotation, staged migrations, or different sending services. For example, helpdesk._domainkey.example.com, marketing._domainkey.example.com, and crm._domainkey.example.com can coexist without conflict.

Create a naming convention before providers generate records. Use names that identify the service and environment, such as helpdesk, txn-prod, marketing, or vendorname-prod. Avoid generic names such as dkim1 when several teams manage the same zone.

Never assign the same selector to two providers on the same domain. Each selector should resolve to one active signing key, and a second provider can overwrite or conflict with the first provider's record and cause verification failures.

Prefer provider-generated keys over online key generators, whose operators could retain, log, or reuse a private key. The sending provider already knows the required algorithm, selector format, and record syntax, and it can often manage rotation without exposing private material to another website.

Organizations that must generate keys internally should use an approved secrets-management process. Never paste private keys into a browser tool, ticket, chat channel, or shared document, and restrict access to the service account that signs messages. Publish only the public key in DNS.

Choose a 2048-bit RSA key when the provider supports it and the DNS and receiving environments accept the resulting record. The Cryptographic Algorithm and Key Usage Update to DomainKeys Identified Mail (DKIM) standard (RFC 8301, 2018) sets 1024 bits as the minimum RSA key size for signers and recommends at least 2048 bits. Keep the private key in the provider's protected key store or the organization's approved secrets vault.

Record the selector owner, creation date, rotation procedure, and decommissioning date. This record prevents a departing employee or retired vendor from leaving an unknown signing key active. It also gives the team a clear action when a key must be replaced.

3. Decide Between TXT Records and CNAME Delegation

Use the record type that the sending provider specifies, even when general DKIM examples show a different one. A TXT configuration publishes the provider's public key directly at a selector such as selector._domainkey.example.com. A CNAME configuration delegates that selector to a provider-managed hostname, allowing the provider to maintain the public key and handle rotation from its own infrastructure.

Create a decision record for every sender that states the required type, hostname, target or public-key value, time to live (TTL), key length, and rotation owner. Never create both a TXT and a CNAME record at the same selector.

Confirm that no existing record uses the selector, and preserve the old selector during migration until messages signed with it have aged out. Record the choice in the sender inventory so the DNS team publishes the exact type each provider expects.

How Do Administrators Generate DKIM Keys and Choose a Selector?

Key generation is the first technical step of any DKIM setup. Create a public/private key pair, publish only the public key in DNS, and configure the mail system to sign messages with the private key. Most email providers generate both keys inside the administrator console.

Teams running their own mail infrastructure can use OpenSSL to create and extract the keys manually. Choose a selector that identifies the signing context, protect the private key as a production secret, and test the configuration before sending from the domain.

1. Generate DKIM Keys Through the Email Provider

Provider-generated keys are usually the simplest option because the platform creates the key pair, formats the DNS record, and connects the signing key to its outbound mail service. Open the provider's domain authentication or email security settings, select the domain to authenticate, and choose DKIM. The interface typically asks for a selector and key length before displaying the DNS record.

Use a 2048-bit key wherever the provider supports it. It provides stronger protection than a 1024-bit DKIM key and is appropriate for modern deployments. Some older mail servers, DNS management systems, and legacy integrations still require 1024-bit keys because of compatibility constraints. Treat 1024-bit support as a temporary migration requirement and plan to move those senders to 2048-bit keys.

A DKIM key setup involves three values:

  • Selector: The label that identifies which DKIM key signed the message.
  • Public key: The value published in a TXT record under the selector's DNS name.
  • Private key: The secret value used to sign outgoing mail. Providers that manage signing themselves usually retain it without displaying it.

If the provider supplies a private key for a third-party mail relay or self-managed gateway, transfer it through the provider's approved secure method. Only the signing process and authorized administrators should be able to access the key.

Copy the DNS hostname and TXT value exactly as shown. A typical record uses a name such as selector1._domainkey.example.com, although the provider may require a different format. Do not add the selector twice or insert quotation marks unless the DNS host specifically requires them. Formatting errors can prevent receiving mail servers from finding a valid key.

2. Generate a DKIM Key With OpenSSL

OpenSSL is the practical option for administrators who operate their own SMTP server, mail transfer agent (MTA), application relay, or dedicated outbound gateway. Create a restricted directory for the key material before generating anything, then limit access to the account that runs the signing service.

The following commands create a 2048-bit RSA private key and extract its public key:

umask 077

mkdir -p /etc/dkim/keys/example.com

chown dkim:dkim /etc/dkim/keys/example.com

chmod 750 /etc/dkim/keys/example.com

openssl genpkey -algorithm RSA \

-pkeyopt rsa_keygen_bits:2048 \

-out /etc/dkim/keys/example.com/selector1.private

openssl pkey \

-in /etc/dkim/keys/example.com/selector1.private \

-pubout \

-out /etc/dkim/keys/example.com/selector1.public

The OpenSSL 3.3 genpkey documentation describes the command used to generate the private key. The commands set the RSA key size explicitly so the administrator can confirm the intended strength from the command itself.

The umask 077 setting prevents newly created files from being readable by other local users. Set the permissions after generation:

chmod 600 /etc/dkim/keys/example.com/selector1.private

chmod 644 /etc/dkim/keys/example.com/selector1.public

chown dkim:dkim /etc/dkim/keys/example.com/selector1.private

chown dkim:dkim /etc/dkim/keys/example.com/selector1.public

Replace dkim:dkim with the service account and group used by the mail-signing software. The private key should normally be readable only by that service account. The public key does not require the same restriction because it is intended for DNS publication. Keeping both files in one controlled directory simplifies administration.

Do not commit the private key to Git, copy it into a container image that many teams can pull, or store it in a general-purpose shared drive. Use a secrets manager, encrypted configuration store, or tightly controlled host filesystem. Backups require the same protection as the live key because an exposed backup can be used to sign fraudulent messages.

OpenSSL writes the public key in Privacy-Enhanced Mail (PEM) format, which includes header and footer lines. DNS does not use those lines. Extract the base64 body before placing it in the TXT record:

awk '

/BEGIN PUBLIC KEY/  {capture=1; next}

/END PUBLIC KEY/   {capture=0}

capture {printf "%s", $0}

' /etc/dkim/keys/example.com/selector1.public

Copy the resulting one-line value into the p= field of the DNS record. A generic DKIM TXT record looks like this:

selector1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=PUBLICKEY_VALUE"

The signing software may require a specific file path or private-key format. Follow that software's configuration syntax. The private key stays in the signing configuration, and only the public key goes into the DNS record.

3. Design Selectors for Identification and Rotation

Use selectors that identify the operational context without exposing sensitive information. Names such as 2026a, marketing1, ses1, or outbound-eu1 make rotation and troubleshooting easier than generic labels such as default. Avoid spaces, punctuation that the DNS provider rejects, and names that reveal internal hostnames or employee identities.

Separate selectors are useful when several systems send mail for the same domain. Assign one selector to a cloud email provider, another to a marketing platform, and a third to an internally managed relay. Each system can sign with its own private key while recipients retrieve the matching public key from a distinct DNS record.

Selectors also support organizational separation, because departments and subdomains with independent mail systems or policies can each use their own selectors.

For example, finance1._domainkey.example.com and news1._domainkey.example.com can identify separate signing contexts, while mail from alerts.example.com can use a selector under that subdomain.

Plan rotation before the first key enters production. The naming scheme should leave room for a successor selector so that each rotation can publish a new record alongside the old one.

Never reuse one private key across unrelated providers when separate selectors are available. With separate keys, a provider compromise, configuration error, or accidental disclosure affects only the associated signing context. Every other system authorized to send mail for the domain keeps its own key.

DKIM setup in DNS: administrator publishing a selector TXT record in the domain's authoritative DNS zone.

Where Should the DKIM Record Be Published in DNS?

Publish the DKIM public key at selector._domainkey.example.com, using the selector and key supplied by the email provider. Setting up DKIM depends on this DNS step for any provider that uses a TXT or CNAME record. Choose a TXT record when the provider supplies a v=DKIM1 value, or publish the supplied CNAME records when the provider delegates key management.

Before testing, confirm that the record exists on the authoritative nameservers and that the hostname, value, TTL, and proxy settings match the provider's instructions.

Identify the Selector and Domain

Copy the selector, signing domain, and record type from the service that sends email for the organization. Provider selectors are short labels such as s1, google, mail2026, or selector1. The receiving system combines that selector with the signing domain to locate the public key in DNS.

If the provider supplies the selector s1 and the sending domain is example.com, the fully qualified DKIM record name is:

s1._domainkey.example.com

The _domainkey label is required. Do not publish the key at example.com, _domainkey.example.com, or s1.example.com, because mail systems query only the selector-specific hostname. DKIM key discovery follows the selector format defined in the DKIM specification, which connects the selector to the signing domain in the message's d= tag.

Some providers display a trailing dot, as in s1._domainkey.example.com., which marks the name as fully qualified. Some control panels add it automatically, while others reject it when entered manually.

Publish a DKIM TXT Record When the Provider Supplies a Public-Key Value

A TXT record contains the DKIM tags and public key that receiving mail servers use to verify signatures. A generic record looks like this:

Name or Host: s1._domainkey

Type: TXT

TTL: 3600

Value: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...

The v=DKIM1 tag identifies the record as DKIM. The k=rsa tag identifies the key type in this example, and the p= tag contains the base64-encoded public key. Copy the complete value from the provider. Do not replace it with an abbreviated example, add spaces inside the key, or manually reformat the character string.

The host field depends on the DNS provider's interface. In a domain-level DNS zone for example.com, the field commonly accepts only s1._domainkey because the provider appends .example.com automatically. If the interface requests a fully qualified record name, enter s1._domainkey.example.com. Entering the full name into a field that appends the domain can create an incorrect record such as s1._domainkey.example.com.example.com.

The two record types differ in what the organization publishes and maintains:

Configuration detail TXT record CNAME delegation
What is published The DKIM public-key value A pointer to the provider’s DKIM hostname
Typical record value v=DKIM1; k=rsa; p=... s1.provider-example.com
Key management The organization or its email administrator manages the published key The email provider manages the target key
Rotation work Publish a new selector with a new TXT value, then retire the old one Follow the provider’s CNAME rotation process
Common failure Truncated key, wrong host, or malformed quotes Incorrect target, proxying, or duplicate domain suffix

Use CNAME Records When the Provider Delegates DKIM

Some email services never supply a long TXT value. They provide one or more CNAME records, one per selector, and each CNAME points from a hostname under the organization's domain to a hostname controlled by the provider.

For example:

Name or Host: s1._domainkey

Type: CNAME

TTL: 3600

Target: s1.example-mail-provider.com

Name or Host: s2._domainkey

Type: CNAME

TTL: 3600

Target: s2.example-mail-provider.com

Publish the records exactly as supplied. Do not convert them into TXT records, copy the provider's target into a TXT value, or publish only one record when the service provides two. Separate selectors support key rotation, multiple sending systems, and different mail streams.

A CNAME delegation handles key lookup and does not contain the public key itself. The receiving mail server follows the CNAME and retrieves the TXT record from the provider's target hostname, allowing the provider to rotate the underlying key without requiring changes to the organization's DNS zone.

Do not place a DKIM CNAME behind a content delivery network, web proxy, or DNS proxy. DKIM lookup depends on ordinary DNS resolution, which proxying can break. If the DNS dashboard offers a proxy toggle, set the record to DNS-only.

Enter Values Correctly in the DNS Provider Interface

DNS dashboards use different labels for the same fields. One provider may call the hostname "Name," another "Host," and a third "Record." The required information remains the same: record name, type, value or target, and TTL.

Quotation marks frequently cause errors. Most web-based DNS panels expect the TXT value without surrounding quotation marks:

v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...

DNS systems display TXT data with quotation marks as part of their presentation format. Manually entering extra quotes can make the value invalid or cause verification to fail. Some providers show the value with quotes because they are documenting a command-line tool. A web form still needs the value without those quotes.

Long DKIM keys create additional formatting risks. Some DNS systems display a long TXT value across multiple quoted strings, while others accept one continuous field. Do not truncate or alter the key. If the provider supplies multiple strings, preserve their order and add no spaces or characters where the strings join.

When the DNS host requires manual segmentation, split the key into quoted strings of 255 characters or fewer without changing any characters. If the interface imposes a length limit, use the provider's documented DNS format or ask the DNS administrator to publish the record through an API.

Set the TTL and Publish to Authoritative Nameservers

A TTL controls how long recursive DNS resolvers cache the record. A value of 3,600 seconds, or one hour, is a practical starting point for a new DKIM record. It allows corrections without leaving an error cached for an entire day. A lower TTL can make troubleshooting changes visible sooner, while a higher TTL reduces repeated DNS queries after the record is stable.

The DNS provider's hosted zone is not always the authoritative source for the domain. The registrar, cloud account, web host, and DNS provider can be separate organizations. Check the domain's nameserver delegation and publish the DKIM record where the authoritative nameservers point. Adding the record to an inactive hosting account does not change what receiving mail servers see.

Amazon Route 53 and similar DNS interfaces often display a fully qualified record name with a trailing dot. The same host-field rule applies there: enter the full name only where the interface expects one, so the domain appears only once. After saving, query the public record with a DNS lookup tool and confirm that the returned hostname and value match the provider's instructions.

Delegate the DNS Task Without Sharing the Private Key

A DNS administrator can handle DKIM publication without ever seeing the private key. The administrator needs only the selector, record type, hostname, TTL, and public value or CNAME target. The private key must remain with the mail-sending service or signing system because it creates the DKIM signature.

Send the provider-generated record through an approved internal channel, then ask the administrator to return the published hostname and record type for confirmation. If the DNS host supports delegated access, grant the narrowest permission required to create or edit the record and remove temporary access after verification.

After publication, check the record from outside the corporate network. If a lookup fails, review the hostname, record type, value formatting, authoritative nameservers, CNAME proxy setting, and any cached record that remains active.

How to Configure DKIM for Each Email Service and Mail Server

Configure DKIM for each email service or mail server that sends messages using the organization's domain. To set up DKIM on any platform, obtain the provider's selector and DNS record, then publish that record in the authoritative DNS zone. Wait for validation, activate signing, and send a test message. Confirm that the delivered header shows the expected signing domain, selector, and dkim=pass result.

Treat every sending service separately. Corporate, transactional, marketing, and customer-support mail often use different domains, subdomains, or selectors.

1. Confirm the Sending Domain and DNS Authority

Identify every platform that sends mail with the organization's domain in the visible From address. Corporate mail might use example.com, while marketing automation uses marketing.example.com and application notifications use notify.example.com. Each provider must sign with a private key whose matching public record exists in the authoritative DNS zone for the signing domain.

Use a dedicated subdomain for marketing or transactional platforms that the organization does not directly control. This separates their sending reputation from employee mail and makes ownership clearer during incident response. A sender using d=marketing.example.com needs its DKIM record under marketing.example.com, and a record under the parent example.com does not cover it.

Provider interfaces change frequently, so treat menu names as interface-dependent. The underlying sequence remains stable: generate or retrieve the provider's selector, publish the supplied record, validate it, activate DKIM signing, and inspect a delivered message.

The table below summarizes that sequence for common platforms:

Platform Prerequisites Record type Activation step Verification method
Google Workspace Gmail enabled, administrator access, and selected domain Selector TXT record under _domainkey Select Start authentication after DNS publication Review Authentication-Results for dkim=pass
Microsoft 365 Custom domain added to the tenant and Defender portal or Exchange Online PowerShell access Two CNAME records, selector1 and selector2 Enable the domain after both CNAMEs resolve Check portal status and message headers
Zoho Mail Domain added and administrator access Selector TXT record under _domainkey Verify the selector, then enable DKIM Confirm selector verification and dkim=pass
Third-party email platform Sending domain or subdomain configured in the platform Provider-supplied TXT or CNAME Complete domain authentication in the platform Inspect headers and provider delivery logs
Self-hosted OpenDKIM Private key, selector, MTA integration, and authoritative DNS access Selector TXT record under _domainkey Reload OpenDKIM and the mail transfer agent Use dig and inspect the DKIM signature

2. Configure DKIM for Google Workspace

Google Workspace administrators obtain the key from the Admin console. Interface labels can move, but the current path is generally Apps, Google Workspace, Gmail, then Authenticate email. Select the domain, choose Generate New Record, and use a 2048-bit key when the DNS host supports it. The Set up DKIM page in Google Workspace Help (2026) identifies the selector and TXT value to copy into DNS.

Google normally supplies a TXT record with a host such as google._domainkey and a value beginning with v=DKIM1. If another sender already uses the google selector, generate a different selector so the existing record is not overwritten. Add the record at the DNS host for the exact domain selected in the Admin console. Some DNS providers append the domain automatically, so enter only google._domainkey when the zone is already example.com.

Return to Authenticate email after the TXT record is publicly visible, then select Start authentication. Send a message to an external mailbox and inspect its full headers. A successful result includes a DKIM-Signature header with the expected d= domain and s= selector, plus an Authentication-Results line showing dkim=pass.

For a subdomain, select or configure that subdomain as its own sending identity if Google Workspace exposes it in the domain menu. Publish the record in the subdomain's authoritative zone and verify that the signature aligns with the address in the From header.

A TXT record at google._domainkey.example.com does not cover mail signed with d=marketing.example.com, whose key belongs at google._domainkey.marketing.example.com.

3. Configure DKIM for Microsoft 365

Microsoft 365 publishes its provider-managed keys through two DNS CNAME records, so administrators do not handle a TXT public key. Add the custom domain to Microsoft 365, open the DKIM area in the Defender portal, and select the domain. Attempting to enable signing prompts Microsoft to display the exact CNAME targets for that tenant. The How to Use DKIM for Email in Your Custom Domain page on Microsoft Learn (2026) identifies the displayed values as authoritative.

The two hostnames are:

selector1._domainkey

selector2._domainkey

Microsoft supplies a target for each. The pattern resembles:

selector1-<custom-domain-with-dashes>._domainkey.<initial-domain-prefix>.<partition>-v1.dkim.mail.microsoft

selector2-<custom-domain-with-dashes>._domainkey.<initial-domain-prefix>.<partition>-v1.dkim.mail.microsoft

Replace the placeholders only with the values Microsoft generates. Newer tenants can include a dynamic partition character, so copying an older example can produce an invalid target. Publish both CNAMEs in the custom domain's authoritative DNS zone. Do not create TXT records for Microsoft 365 DKIM, and do not add the full domain to the hostname field when the DNS provider appends the zone automatically.

After Microsoft detects both CNAMEs, enable Sign messages for this domain with DKIM signatures in the domain details. A temporary CnameMissing status means Microsoft cannot find one or both records.

Check for a missing selector2, a duplicated domain suffix, a TXT record published where a CNAME belongs, an incorrect dash pattern, or a CNAME published in the wrong DNS zone. Query both records with nslookup -type=CNAME or dig CNAME before retrying activation.

PowerShell provides an optional administrative route. After connecting to Exchange Online, inspect the configuration with:

Get-DkimSigningConfig -Identity example.com |

Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME

If the domain has no configuration, create one with:

New-DkimSigningConfig -DomainName example.com -Enabled $false

Copy the returned Selector1CNAME and Selector2CNAME values into DNS, then activate signing with:

Set-DkimSigningConfig -Identity example.com -Enabled $true

The initial example.onmicrosoft.com domain is automatically DKIM-signed by Microsoft 365. Custom domains and subdomains require their own configuration. Administrators who manage an onmicrosoft.com identity should use the tenant's generated configuration, because custom-domain CNAMEs do not apply to it.

4. Configure DKIM for Zoho Mail

Zoho Mail administrators obtain the selector and public key from the Admin Console. Interface labels can vary, but the usual path is Domains, select the domain, open Email Configuration, choose DKIM, and select Add. Enter a selector such as zoho, choose the available key length, and copy the generated TXT value.

Publish the TXT record at <selector>._domainkey. For example, a sender using marketing.example.com might publish zoho._domainkey.marketing.example.com, depending on how Zoho represents the sending domain. If the DNS host appends the zone automatically, enter only the portion before the zone name, such as zoho._domainkey.marketing in an example.com zone. Return to Zoho after propagation, select Verify, and enable DKIM once the selector validates.

Multiple Zoho selectors support separate teams or sending streams. Use distinct selectors or subdomains for corporate, transactional, and marketing mail when separate ownership, rotation, or reputation controls are required. Every selector must resolve to the public key corresponding to the private key Zoho uses for that stream.

5. Configure OpenDKIM on a Self-Hosted Mail Server

Self-hosted mail requires direct control of both the signing service and the mail transfer agent. Generate a selector-specific key pair, store the private key with permissions that prevent ordinary users from reading it, and place the public key in a TXT record at <selector>._domainkey.example.com.

Configure OpenDKIM with the signing domain, selector, private-key path, and socket used by the MTA. Connect the MTA to OpenDKIM, reload both services, and send a message externally. Query the public record with dig TXT <selector>._domainkey.example.com, then inspect the message for d=example.com, the matching s= selector, and dkim=pass.

6. Authenticate Third-Party Sending Platforms

Transactional, marketing, customer-support, and CRM platforms usually provide a domain-authentication screen that generates either a TXT record or one or more CNAME records. Select the custom sending domain, copy every hostname and value exactly, publish them in authoritative DNS, and return to the platform to complete verification. Authenticating the corporate mailbox provider does not authenticate a separate marketing platform.

When DMARC alignment is required, confirm that the platform's DKIM d= value matches the domain or subdomain used in the visible From address. Test each stream independently because a passing corporate message does not prove that transactional or marketing mail is signing correctly.

After all senders pass, document each selector, DNS record, owner, and rotation process. Connect repeated authentication failures to broader phishing response and email reporting workflows so the security team can investigate recurring failures as signals of a broader problem.

How to Verify a DKIM Setup With DNS Queries and Message Headers

Verification confirms that a DKIM setup works for real mail. Query the selector's public key, send a controlled message through each intended mail system, and inspect the received headers. Confirm dkim=pass, verify that the selector and signing domain match the approved configuration, and check DMARC alignment before treating the domain as fully authenticated.

1. Check the Public Key With dig or nslookup

Experience the Adaptive platform

Take a free tour

Start by confirming that the selector is publicly resolvable. If the selector is selector1 and the sending domain is example.com, query:

dig TXT selector1._domainkey.example.com

The response should contain a TXT record beginning with a tag such as v=DKIM1, followed by a public key in the p= value:

selector1._domainkey.example.com. 300 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..."

The exact record depends on the email provider. Some providers publish the key directly as TXT, while others publish a CNAME at selector1._domainkey.example.com that points to a provider-controlled hostname. Either configuration must resolve from outside the corporate network.

The equivalent nslookup query is:

nslookup -type=TXT selector1._domainkey.example.com

An empty response indicates a wrong selector, missing record, or DNS propagation issue. A malformed key, truncated value, unexpected quotation marks, or missing DKIM tags requires a DNS correction before message testing.

Test the record through independent resolvers because a local answer does not prove that recipients can see the same key:

dig @8.8.8.8 TXT selector1._domainkey.example.com

dig @9.9.9.9 TXT selector1._domainkey.example.com

The organization's own recursive resolver can be queried the same way:

dig @192.0.2.53 TXT selector1._domainkey.example.com

The answers should contain the same selector and public key. A result from one resolver but not another points to propagation delay, stale caching, split-horizon DNS, an incorrect authoritative nameserver, or a record published in the wrong DNS zone. Resolve that inconsistency before testing delivery.

2. Send Controlled Test Messages

After DNS resolves correctly, send test messages through every mail path expected to sign messages. Do not test only from a desktop client if the organization also sends through a marketing platform, ticketing system, customer relationship management platform, website, payroll service, or transactional email provider. Each system can use a different selector and signing domain.

Use a controlled test matrix with at least one message sent from the domain under review to a test mailbox at an independent receiving provider. Send plain text first, followed by an HTML message with an attachment if those formats represent production traffic. Use a distinctive subject, such as "DKIM verification test," to associate the received headers with the correct message.

Test messages should represent the actual sender address and delivery path. A relay, forwarding service, or mailing list can modify the final headers and invalidate the signature. Run a separate test for each outbound service, since one passing result does not cover the whole organization.

Record the sending address, recipient address, sending system, selector, and test time before sending. This record creates an audit trail for DNS changes, key rotations, and provider migrations. The same discipline applies to phishing simulation and email testing, although authentication validation should stay separate from employee performance testing.

A message reaching the inbox has not necessarily passed DKIM. Delivery and authentication are separate outcomes. Open the message's raw source or "show original" view and inspect the authentication headers added by the receiving provider.

3. Read the Authentication-Results Header

Find the Authentication-Results header first. It summarizes the receiving system's evaluation of SPF, DKIM, and DMARC. A passing result typically resembles:

Authentication-Results: receiver.example;

dkim=pass header.i=@example.com header.s=selector1;

spf=pass smtp.mailfrom=example.com;

dmarc=pass header.from=example.com

The decisive value is dkim=pass. It means the recipient used the public key associated with the selector and validated the message signature. Confirm that the header identifies the expected selector after header.s= and the expected signing domain after header.d= or header.i=, depending on which field the receiver reports.

A failure result requires a different troubleshooting path:

Authentication-Results: receiver.example;

dkim=fail (body hash did not verify) header.s=selector1;

dmarc=fail header.from=example.com

This result shows that DNS worked. The receiving system found a public key and attempted cryptographic validation, but the message no longer matched the signed content. A body modified in transit, a footer added by a relay, an incompatible canonicalization setting, or a signing configuration mismatch can produce this result.

Other results identify different problems:

  • dkim=none generally means the message did not contain a usable DKIM signature.
  • dkim=neutral means the message was signed but the signature could not be processed, and some receivers report a missing public key this way.
  • dkim=temperror indicates a temporary lookup or processing problem.
  • dkim=permerror often indicates a permanent configuration problem, such as an invalid key record or malformed signature.

Treat each result as a separate troubleshooting path, and avoid repeated DNS changes while diagnosing the failure.

4. Inspect the DKIM-Signature Header

Locate the DKIM-Signature header after reviewing Authentication-Results. It identifies the signing system and the message content covered by the signature:

DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=selector1;

c=relaxed/relaxed; q=dns/txt; t=1713182400;

h=from:to:subject:date:message-id;

bh=BASE64BODYHASH;

b=BASE64_SIGNATURE;

The s= value is the selector and must match the DNS name that was queried. For s=selector1 and d=example.com, the receiving system looks for the public key at:

selector1._domainkey.example.com

The d= value is the signing domain. Compare it with the domain the email service is expected to use. A provider might sign mail with example.com, mail.example.com, or its own service domain. The result is correct only when that signing domain matches the approved architecture and the organization's DMARC alignment requirements.

The h= field lists the message headers covered by the signature. The bh= field contains the body hash, while the b= field contains the signature generated from the headers and body hash. Routine verification does not require manually calculating these values because the receiving system performs the cryptographic check and reports the outcome in Authentication-Results.

A dkim=pass result means the signature and signed content validated against the published key, but it does not show that the message passed DMARC.

5. Separate DKIM Validation From DMARC Alignment

DKIM can pass while DMARC fails when the signing domain does not align with the domain shown to the recipient:

From: billing@example.com

DKIM-Signature: d=mailer.vendor.example; s=selector1

Authentication-Results: receiver.example; dkim=pass; dmarc=fail

The cryptographic signature is valid, but mailer.vendor.example is not aligned with example.com under the organization's DMARC policy. Configure the provider to sign with the organization's domain, use an aligned subdomain where appropriate, or correct its domain-authentication settings. Review SPF alignment as well because DMARC passes when either an aligned DKIM result or an aligned SPF result succeeds.

6. Document the Successful Result

Finish each verification with a record another administrator can reproduce. Document the test date, sender, recipient, sending system, selector, signing domain, resolver addresses, DKIM result, DMARC result, and any relay or forwarding service involved.

A complete record should show that the selector resolved through multiple independent resolvers and that the received message contained the expected s= and d= values. It should also show dkim=pass in Authentication-Results.

Repeat the workflow after rotating keys, changing providers, adding an outbound service, or modifying DNS. DKIM verification is complete only when the public record, signing configuration, and received-message headers agree.

How Do SPF, DKIM, and DMARC Work Together in a DKIM Setup?

When administrators set up DKIM, they should treat SPF, DKIM, and DMARC as three separate checks. Together, the three controls show that an email claiming to come from the organization's domain is authorized and unaltered. SPF verifies the sending server, DKIM verifies the message signature and signing domain, and DMARC compares those results with the visible From domain before applying a policy.

A message can pass SPF or DKIM and still fail DMARC, particularly after forwarding or when a third-party sender signs with the wrong domain. A side-by-side comparison of SPF vs. DKIM vs. DMARC shows where each control stops.

What Does SPF Authorize?

SPF checks whether the connecting server is authorized to send mail for the envelope sender domain, also called the Return-Path domain. Domain owners publish authorized mail servers and services in a DNS TXT record, and the receiving mail system checks whether the connecting IP address appears in that record.

SPF does not inspect the message body, protect the visible From address by itself, or prove that the message remained unchanged. It validates the sending infrastructure identified by the envelope sender. A cyberattacker sending from an unauthorized server can fail SPF. A legitimate marketing platform, by contrast, can pass SPF for its own infrastructure without authenticating the organization's visible From domain.

SPF becomes fragile when messages travel through forwarding services. A forwarder typically relays the message from its own infrastructure, which the original sender's SPF record does not list. The forwarded message can therefore fail SPF even when the original sender configured SPF correctly.

Keep SPF records within the limit of 10 DNS lookups set by RFC 7208, authorize every legitimate third-party sender, and remove services that no longer send mail. An outdated record creates authentication gaps and gives cyberattackers more room to imitate trusted domains.

Organizations with many cloud services face another SPF constraint. Each vendor added to the record increases administrative complexity, and excessive DNS lookups can turn a clean pass into an SPF evaluation error. Document which provider sends transactional, marketing, support, and internal mail before editing the record. That inventory supports DKIM, which can preserve authentication when SPF breaks during forwarding.

How Does DKIM Protect Message Integrity and Authenticate a Domain?

DKIM checks whether a domain that controls the signing key signed the message and whether the signed content stayed intact in transit. The sending system signs selected headers together with a hash of the message body. The receiving system retrieves the public key from DNS, checks the signature, and reads the signing domain from the d= tag.

The d= value identifies the domain asserting responsibility for the signature. A provider might sign a message with d=mailer.example.net while the visible From address shows billing@example.com. That signature can be cryptographically valid, but it does not automatically authenticate example.com for DMARC purposes.

DKIM is particularly valuable during forwarding because the signature travels with the message. If the forwarder does not modify signed content, the original DKIM result can remain valid even when the forwarder's IP address fails the original sender's SPF policy.

Mailing lists complicate this protection by adding footers, changing subject lines, or rewriting content, which can invalidate a DKIM signature. List administrators should preserve DKIM where possible, and domain owners should monitor reports for legitimate traffic that fails after redistribution.

A valid DKIM signature supplies a consistent domain-level signal, but it cannot guarantee inbox placement or stop every spoofing attempt. RFC 6376 frames DKIM as a way to associate a domain with a message through a verifiable signature, so a DKIM pass alone does not make the visible From address trustworthy.

What Does DMARC Align and Enforce?

DMARC checks whether SPF or DKIM authenticated the same organizational domain shown in the visible From header. A DMARC record does not replace SPF or DKIM. DMARC evaluates their results, checks alignment, and tells receiving systems what to do when neither method passes alignment.

A message can pass DKIM but fail DMARC. Suppose the visible From address is finance@example.com, but the sender signs with d=vendor-mail.com. The DKIM signature is valid, so DKIM passes. If SPF fails or authenticates only an unrelated domain, neither result aligns with example.com, and DMARC fails. The receiving system then follows the domain's DMARC policy, such as monitoring the message, sending it to spam, or rejecting it.

DMARC alignment can be relaxed or strict. With relaxed alignment, the authenticated domain and visible From domain can share the same organizational domain even when their subdomains differ. For example, d=mail.example.com can align with From: example.com. With strict alignment, the domains must match exactly, which provides tighter control but requires precise coordination across subdomains, vendors, and business units.

A DMARC record commonly includes a policy tag such as p=none, p=quarantine, or p=reject, along with reporting instructions. Each DMARC policy level carries different enforcement consequences. Start with monitoring to identify legitimate senders, correct SPF and DKIM failures, and move toward enforcement when authorized traffic consistently aligns.

An immediate reject policy can disrupt invoices, customer notifications, or newsletters from an overlooked provider, so verify every sender before tightening enforcement.

The Domain-Based Message Authentication, Reporting, and Conformance (DMARC) specification (RFC 9989, 2026) defines DMARC as a policy framework that combines SPF and DKIM authentication with identifier alignment. In practice, DMARC passes when at least one method both passes and aligns with the visible From domain. It does not require both SPF and DKIM to pass.

What Happens During Forwarding, Mailing Lists, and Third-Party Sending?

Forwarding exposes the difference between SPF and DKIM, because SPF often fails at the forwarder while an unmodified DKIM signature survives the same route. Organizations should configure DKIM for every legitimate sending platform and avoid relying on SPF as the only anti-spoofing control.

Third-party senders need domain-specific configuration, because authorizing a vendor in SPF alone does not make its mail align with the visible From domain. A payroll provider, customer relationship platform, or marketing service should sign with a domain aligned to the organization's visible From domain, such as d=example.com or an approved subdomain.

If the provider signs only with its own domain, mail can pass DKIM while failing DMARC. Require each provider to document its envelope sender, DKIM signing domain, selector, and alignment behavior before production use.

Mailing lists create another failure point because they can alter the subject, body, or headers. If the list breaks DKIM and the forwarder also changes the sending path, both authentication methods can fail. Use DMARC aggregate reports to identify the list, forwarding service, or vendor responsible. The organization can then adjust the sending configuration, use a dedicated aligned subdomain, or accept the delivery tradeoff based on the message's business importance.

These controls also reduce business email compromise exposure by giving receiving systems stronger signals for classifying unauthorized messages. They do not eliminate BEC because cyberattackers can compromise a real mailbox, register lookalike domains, or persuade employees through other channels.

Pair domain authentication with verification procedures and phishing simulations that rehearse BEC and vendor impersonation. Employees should verify unusual payment or account-change requests even when an email passes technical checks.

Which Authentication Result Should Administrators Expect?

Use this decision table when testing a sender after DKIM setup:

DKIM result SPF result DMARC result Likely action
Pass and aligned Pass and aligned Pass Continue monitoring and maintain both configurations.
Pass and aligned Fail Pass Keep DKIM healthy, investigate forwarding or SPF authorization, and confirm reporting.
Pass but not aligned Pass and aligned Pass DMARC can pass through aligned SPF, but configure aligned DKIM for forwarding resilience.
Pass but not aligned Pass but not aligned Fail Correct the d= domain, envelope sender, or visible From domain.
Fail Pass and aligned Pass Investigate the DKIM key, selector, or message modification. Aligned SPF currently carries DMARC.
Fail Fail Fail Treat the sender as unauthorized until the legitimate source is identified and repaired.

The practical sequence runs in order: sender inventory, SPF authorization, DKIM key publication, d= domain confirmation, and DMARC in monitoring mode. Review aggregate reports for third-party senders, forwarded mail, and mailing lists before tightening policy.

Correct alignment failures before raising enforcement, so that legitimate mail keeps passing while unauthorized mail is rejected or quarantined. The three controls remain distinct: SPF checks infrastructure authorization, DKIM protects message integrity and supplies domain authentication, and DMARC turns those signals into an aligned anti-spoofing policy.

Troubleshooting a DKIM setup: engineers compare message headers and DNS query results to locate the failing hop.

How Should Administrators Troubleshoot DKIM Failures?

Troubleshooting a DKIM setup starts by separating DNS publication problems from signing, alignment, and message-handling problems. A DNS failure means the recipient cannot retrieve the public key. A signature failure means the message signature does not validate against the key or message content.

A forwarding or modification failure occurs after the sender signs the message and another system changes the headers or body. Preserve the active selector, verify each hop with raw headers, and test delivery to multiple recipients and providers. Do not delete a working selector during an incident because removing it can turn a narrow failure into a complete authentication outage.

How Do DNS and Selector Errors Cause DKIM Failures?

DNS and selector errors prevent the receiving server from finding the public key at the exact hostname named in the DKIM-Signature header. The receiver typically queries a name such as selector1._domainkey.example.com. An incorrect selector, hostname, record type, or authoritative nameserver therefore breaks validation even when the email platform reports that DKIM is enabled.

Start with the selector shown in the message header, because the selector displayed in an administration console may differ from the one the sender actually used. Run:

dig +short TXT selector1._domainkey.example.com

dig +short CNAME selector1._domainkey.example.com

dig +trace selector1._domainkey.example.com

An NXDOMAIN response means the queried name does not exist. In Microsoft 365, CnameMissing means the service cannot find a required CNAME at the expected hostname. An empty response or a "no key for signature" comment indicates that the TXT record is absent, published under the wrong selector, or published in a different DNS zone than the one the nameservers serve.

The dig +trace output shows whether the domain delegates to the nameservers that were edited. If the delegated nameservers differ from the ones that were edited, correct the delegation before changing records. Query the record from multiple resolvers, and allow the TTL of any previously cached answer to expire before declaring the change failed.

Preserve the active selector while testing a new selector. Never replace a known-good record with a copied value from an incomplete console view.

How Do Signature and Alignment Errors Differ?

Signature errors concern cryptographic validation. Alignment errors concern whether the authenticated domain matches the visible sender domain. A "no key for signature" comment points to DNS or selector resolution. A body-hash mismatch points to altered body content. A signature mismatch with an intact body hash points to a public key in DNS that does not match the private key in use, or to altered signed headers, while a malformed public key usually produces a permanent error.

Inspect the full Authentication-Results and DKIM-Signature headers. Confirm that d= names the intended signing domain, that s= matches the selector that was queried, and that bh= and b= are present and intact.

A malformed or truncated TXT value can result from pasting a long public key as one unsupported string or wrapping it incorrectly. Stray quotation marks and splits that lose part of the value cause the same failure. DNS TXT records can contain multiple quoted segments, but the resolver must return the complete key without accidental characters or missing portions.

Duplicate selectors create a separate risk. Two TXT records at the same selector can cause ambiguous key retrieval, while a new key published under an old selector can leave senders signing with a stale private key. A new selector for each rotation avoids both problems.

Check alignment separately through the From address, the d= value, and the DMARC results. Do not treat every authentication failure as a DKIM key problem.

What Causes Message-Modification and Forwarding Failures?

Message-modification failures occur when a system changes signed content after the outbound sender creates the DKIM signature. Disclaimers added after signing, subject-line tags, footer insertion, MIME re-encoding, line-ending changes, and body rewriting can invalidate the body hash.

For the message path being validated, DKIM signing should occur after content-generating systems and immediately before the message leaves the organization. An outbound gateway, secure email relay, archiving service, data-loss prevention system, or mailing list may modify the message after signing. In that case, move DKIM signing to that final outbound stage or configure the intermediary to preserve signed content.

Forwarding services often expose this problem because they pass along a message while changing headers or body structure. Test the original sender, forwarding path, and final recipient separately.

Recipient-specific failures usually point to a path difference, since a universally broken key would fail everywhere. Compare raw headers from Gmail, Microsoft-hosted mail, a corporate gateway, and an external mailbox. If direct delivery passes but a mailing list fails, inspect the list's footer, subject prefix, and resend behavior.

If one receiving provider fails while others pass, compare that provider's resolver response and the message version it received. Target the failing hop and leave the active selector in place.

Which DKIM Symptoms Map to Which Fixes?

The table below maps common symptoms to their likely causes and corrective actions:

Symptom Likely cause Diagnostic command or header clue Corrective action
NXDOMAIN Incorrect hostname, selector, or DNS delegation dig +trace on the selector hostname Correct the hostname or authoritative nameservers, then retest
“no key for signature” Missing TXT, missing CNAME target, stale selector, or wrong record type s= in DKIM-Signature; dig TXT and dig CNAME Publish the key at the exact selector and preserve the active record
CnameMissing Provider-required CNAME was omitted or placed at the wrong host dig +short CNAME on the selector hostname Add the required CNAME at the provider-specified hostname
Intermittent verification DNS propagation or resolver caching Query multiple public resolvers and authoritative servers Wait through the TTL, verify consistency, and avoid repeated destructive edits
Invalid or truncated key Malformed TXT syntax, incomplete copy, or unsupported line handling TXT response lacks the full p= value Reconstruct the TXT value exactly and validate the complete public key
Duplicate selector Multiple TXT records or an old key sharing the selector dig TXT on the selector returns conflicting values Use a new selector for rotation and remove duplicates after the incident is contained
Signature mismatch Published public key does not match the signing key, or headers or body changed dkim=fail; body-hash or canonicalization clues Reconcile sender keys and stop post-signing message changes
Passes direct mail but fails forwarded mail Forwarder, list footer, or downstream gateway alteration Compare raw headers and body across recipients Identify the modifying hop and have it preserve signed content

Test every correction with multiple recipients and providers, including a direct mailbox and the organization's normal forwarding or mailing-list path. Document the selector, DNS response, signing host, and final Authentication-Results value before closing the incident.

For organizations building a broader human-layer response around suspicious mail, phishing simulations can reinforce reporting behavior while infrastructure teams validate authentication paths. Authentication results and employee reports are separate signals, and both help security teams contain suspicious messages faster.

How Should Organizations Manage DKIM Selectors, Key Rotation, and Private Keys?

After teams set up DKIM, selector management becomes an ongoing operational control that outlasts the initial DNS change. Inventory every signer, plan selector rotation, protect private keys, verify headers during cutover, and document ownership and evidence for audits. Treat provider migrations, subdomain changes, registrar events, and suspected compromises as triggers to review the control.

1. Build a DKIM Inventory Before Rotation

Map every domain and subdomain that sends email, starting from the sender inventory built before setup. Undocumented selectors create blind spots and increase conflict risk during provider changes.

Record these fields for each signer:

  • Domain or subdomain
  • DKIM selector
  • Email provider
  • DNS record type
  • Key owner
  • Creation date
  • Planned rotation date
  • DNS TTL
  • Status, such as active, overlapping, retired, or revoked

Separate selectors for transactional, marketing, and corporate mail limit the effect of a compromised provider and make it clear which system signed each message. They also prevent two systems from managing the same selector with different public keys.

Assign one accountable owner to each record. The email administrator can operate the signer, while the DNS or infrastructure team controls publication. The inventory must identify who approves changes and who confirms successful delivery.

Connect the inventory to the organization's phishing response and email workflow so authentication failures found in DMARC aggregate reports and test messages reach the team responsible for remediation.

2. Plan Controlled Selector Rotation

DKIM key rotation should introduce a new record and leave the active one untouched until cutover. Generate a new public-private key pair through the provider or an approved key-management process. Publish the public key under a new selector, such as s2026q1, and allow time for the record to reach the resolvers that recipients use.

Activate the new signer after publication and send test messages through each relevant path. Inspect the received headers for the new selector, the expected signing domain, and a passing DKIM result. Test corporate, transactional, and marketing streams separately because a successful test from one provider does not prove that every sender has switched.

Keep the old public key published during the overlap period. Messages can remain in transit, queued, forwarded, or delayed after the new signer becomes active, and recipients still need the old key to validate those messages.

Remove the obsolete DNS record after messages signed with it have aged out according to mail-delivery and retention requirements. Disable or destroy the old private key and mark the selector retired in the inventory.

A selector conflict occurs when two systems publish different public keys under the same selector or when a provider reuses a selector controlled by another sender. Assigning a unique selector to each provider resolves the conflict. Do not delete a known-good record while active traffic still depends on it.

3. Protect Private Keys With Least Privilege

Store private keys in controlled secret storage with least-privilege access. Restrict retrieval and signing permissions to the services or administrators that require them, and record access for investigation and audit purposes.

Separate key generation, DNS publication, and signer activation when practicable. This separation creates an approval checkpoint and prevents one compromised account from changing both the public record and the signing system. Apply the same discipline during provider migration by issuing a new pair, assigning a new selector, validating headers, and revoking the former provider's key after its traffic stops.

Treat an exposed private key as compromised, even without confirmed fraudulent messages. Disable the affected signer, generate a replacement pair, publish a new selector, and activate the replacement. Revoke the compromised key promptly by publishing its selector with an empty p= value. A small amount of legitimate mail still in transit may fail, which is the lesser risk once a key is exposed.

Review recent signed messages, provider logs, DNS changes, and account activity to determine whether the key was used.

4. Govern Providers, Subdomains, and DNS Changes Together

Multi-provider environments need explicit ownership boundaries. Maintain separate selectors for each provider and subdomain, require change tickets for new senders, and review DNS records before onboarding a marketing or transactional service. A provider should not be able to alter unrelated selectors or the parent domain's DNS zone.

A registrar or DNS compromise requires a broader response than key replacement. Secure registrar accounts with multifactor authentication, review nameserver and DNS record changes, restore trusted records from an approved baseline, and investigate whether cyberattackers redirected mail or replaced DKIM keys. If zone integrity cannot be established, rotate affected selectors and credentials after recovery.

Document each rotation with the approver, key owner, selector, public record, activation time, verification headers, overlap period, removal time, and exceptions. Retain evidence that old records were removed only after dependent messages aged out. This documentation turns DKIM from an informal configuration into a repeatable control that survives staff changes, provider migrations, and audits.

How to Set Up DKIM Across Subdomains, Multiple Providers, and Enterprise Domains

To set up DKIM across enterprise domains, map every sending service to the exact domain or subdomain it uses and assign unique selectors. Record each DNS owner and rotation responsibility. Validate active selectors through DNS queries and message headers, then migrate or retire records only after delivery and authentication remain stable.

Treat DKIM as an ownership and continuity process, because adding records without clear ownership creates clutter and risk.

1. Assign a Signing Boundary to Each Subdomain

Start by deciding which domain should appear in the DKIM d= value for each mail stream. A corporate mailbox service can sign as corporate.example.com, a notification provider as notify.example.com, and a marketing platform as marketing.example.com. This separation keeps ownership traceable and prevents a change to one provider from disrupting unrelated mail.

A worked deployment might use corp2026._domainkey.corporate.example.com for the corporate mail provider, notify1._domainkey.notify.example.com for the transactional provider, and mktg1._domainkey.marketing.example.com for the marketing provider. Each provider receives only the selector and DNS record it needs.

Use a dedicated subdomain for marketing or transactional mail when those streams have different administrators, vendors, sending policies, or reputational risk.

Subdomain-specific signing limits the impact of provider changes. If a marketing provider is replaced, IT can change marketing.example.com without touching employee mail signed under corporate.example.com. Parked or unused domains should not retain forgotten DKIM records that imply an active sending relationship. Document whether each domain sends mail, receives mail only, or remains inactive.

2. Prevent Selector Collisions Across Providers

Selectors must be unique within the same signing domain. Two providers must not both use default for the same domain, because the shared selector creates a collision. Give each provider an owner-specific selector such as helpdesk, billing, crm2026, or campaigns2026, and include the environment when staging and production coexist.

For example, notify1._domainkey.notify.example.com and mktg1._domainkey.marketing.example.com do not collide because they belong to different subdomains. If both providers sign as example.com, they require distinct selectors such as billing2026._domainkey.example.com and campaigns2026._domainkey.example.com.

Maintain a selector register with the provider, business owner, DNS record owner, creation date, key rotation date, and retirement condition.

3. Migrate Providers Without Interrupting Delivery

A provider migration should run in parallel with the old signer, which stays active until the cutover is confirmed. Publish the new provider's selector, send controlled test messages, and confirm that the DKIM-Signature header shows the expected d= domain and s= selector. Keep the old selector available while queued messages, retries, and residual traffic still originate from the former service.

For instance, a company moving notifications can publish notify2 while notify1 remains active. The new provider signs with notify2, while monitoring confirms delivery, DKIM alignment, SPF behavior, and DMARC results. Disable the old provider only after message headers show no legitimate use of notify1, and assign a rollback owner who can restore the former configuration without recreating records from memory.

4. Audit Selectors Through DNS and Message Headers

A reliable audit compares what DNS publishes with what mail actually uses. Query each known selector with tools such as dig TXT selector._domainkey.example.com or an equivalent DNS inspection service, then sample headers from corporate, notification, marketing, support, and third-party systems.

Record selectors that resolve but never appear in legitimate messages, and investigate headers that reference selectors absent from the inventory. Continuous email security monitoring makes those gaps visible between audits.

Enterprise teams should assign DNS ownership explicitly when a subdomain is delegated to an agency, cloud platform, regional IT group, or managed service provider. The delegation record should identify who can change DKIM, who approves key rotation, how access is revoked, and where rotation evidence is stored. Governance, risk, and compliance (GRC) teams need this trail to demonstrate control over authentication changes, because a TXT record alone does not show who approved a change.

DKIM also feeds a high-level readiness review for Brand Indicators for Message Identification (BIMI). Before displaying a brand logo, confirm that relevant mail streams authenticate consistently, the DKIM d= domain aligns with the visible From domain, and DMARC enforcement meets the receiving mailbox provider's requirements. The organization also needs a compliant logo file, and some mailbox providers require a Verified Mark Certificate or Common Mark Certificate to display it.

The Implementation Guide from the BIMI Group outlines these prerequisites. Treat BIMI as an outcome of disciplined domain governance rather than a reason to create duplicate signing records.

5. Retire Unused Selectors Safely

Retire a selector only after confirming that no legitimate message headers reference it, the associated provider contract or integration is closed, and the business owner approves removal. Mark it as pending retirement, monitor for unexpected use, and remove the DNS record after the agreed observation period. Preserve the selector name, public key, ownership history, and retirement date in the change record.

This process protects continuity while removing stale trust paths. The final inventory should show every active domain, subdomain, selector, provider, delegated DNS owner, key rotation procedure, rotation contact, and rollback plan. That documentation gives IT a repeatable operating procedure and gives GRC a traceable record of who controls each signing identity.

After you set up DKIM, an employee verifies an authenticated payment request by phone before acting on it.

Why Human Risk Management Still Matters After Setting Up DKIM

A completed DKIM deployment strengthens machine verification. Employees are not expected to authenticate email themselves. DKIM gives receiving systems a cryptographic signal about whether a domain authorized a message and whether signed content changed in transit. Human risk management addresses the decisions people make after a message reaches them.

The Email Security Best Practices (ITSM.60.002) guidance from the Canadian Centre for Cyber Security (August 2025) treats authentication protocols, monitoring, and employee security awareness training as complementary parts of email defense.

What Can Email Authentication Controls Stop?

DKIM helps a receiving mail system verify that a message carries a valid signature associated with the sending domain and that signed content has not been altered. When paired with SPF and DMARC, it gives recipient systems stronger evidence for filtering, quarantining, or rejecting messages that fail domain-authentication checks. DMARC also gives organizations visibility into unauthorized sending sources through authentication reports.

That protection has a defined boundary. DKIM does not prove that the sender is trustworthy, that a request is safe, or that the account behind the message has not been compromised. A cyberattacker using a legitimate, authenticated domain can still send a convincing message.

DKIM also does not inspect a phone call, text message, collaboration-platform chat, or deepfake video. Authentication is a control for message provenance and integrity, but employee judgment still has to cover everything it cannot see.

Authentication reduces the volume of deceptive email that reaches employees, while human risk management addresses the requests that still get through.

How Does Authenticated-Domain Abuse Differ From Social Engineering?

Authenticated-domain abuse starts with a technically valid message. The cyberattacker might compromise a real mailbox, register a lookalike domain with working DKIM, or abuse a trusted third-party service. Because the message can pass authentication checks, employees must evaluate the request itself, including its urgency, payment instructions, unusual link destination, and demand for confidential information.

Social engineering is the manipulation layer that turns a message or conversation into an action. In spear phishing, cyberattackers personalize requests using open-source intelligence (OSINT). In BEC, they imitate an executive, supplier, or attorney to redirect funds or data. Vishing and smishing move the same pressure tactics into voice calls and text messages, while AI-generated social engineering can add a convincing synthetic voice, image, or video.

The operational response must separate two questions. Security teams should ask whether the message authenticated and where it originated. Employees should ask whether the request fits normal business processes and verify high-impact instructions through a trusted second channel.

A simple control matrix keeps ownership clear:

  • Email authentication: Validate sending-domain signals, signed content, and reported sending sources.
  • Security operations: Investigate authentication failures, unexpected sources, and recurring spoofing patterns.
  • Employees: Pause, assess context, and verify payment, credential, or data requests independently.
  • Managers and security leaders: Reinforce reporting without blame and use behavior data to target coaching.

Why Pair DKIM With Employee Phishing Awareness Training?

Technical controls reduce the number of deceptive messages that reach employees, but they cannot remove the need for safe decisions. The Phishing Attacks: Defending Your Organisation guidance from the UK National Cyber Security Centre describes phishing defense as a layered program combining technology, processes, and people. It also warns that no training package can teach users to spot every phishing attempt.

That limit means organizations should pair training with technical controls and a blame-free reporting culture. Employees should rehearse how to pause, verify, and report suspicious requests involving spear phishing, BEC, vishing, smishing, and AI-generated impersonation.

Authentication findings can show where employees need practice, such as verifying payment requests that arrive from trusted-looking domains, and that insight can guide phishing simulations and coaching. Pair those signals with measurable behavior such as reporting speed, verification of payment changes, and responses to multi-channel scenarios.

Organizations can connect DKIM implementation to AI-powered cybersecurity awareness training that reinforces safer decisions across email, voice, and messaging channels.

Email authentication helps receiving systems judge message authenticity and integrity. Employees provide the judgment required when an authenticated request still conflicts with policy, context, or established business practice. That judgment becomes stronger when teams repeatedly practice the verification habits that high-impact social engineering attempts are designed to bypass.

DKIM Setup FAQs

How Should Organizations Set Up DKIM When Multiple Email-Sending Providers Use the Same Domain?

To set up DKIM for several providers on one domain, assign each email-sending provider its own selector and publish each public key under that provider's selector. Then confirm that each service signs with the intended domain. Multiple providers can share one visible From domain because DKIM records are distinguished by selector, such as mail1._domainkey.example.com and marketing._domainkey.example.com.

Do not allow providers to overwrite one another's records. Inventory corporate, transactional, marketing, and support senders, and use a dedicated subdomain when ownership or reputation should remain separate. The Create and Manage a DKIM Record page from the UK National Cyber Security Centre pairs every new key with a new selector. Verify each stream in received headers before retiring any existing selector.

Why Does Microsoft 365 Require Two DKIM CNAME Records?

Microsoft 365 uses two DKIM CNAME records so it can maintain two selector targets and rotate signing keys without interrupting message authentication. Each record points from a selector under the custom domain to a Microsoft-managed public-key location, allowing Microsoft 365 to change the active key behind the CNAME.

Microsoft's DKIM documentation identifies the two-record pattern as part of custom-domain configuration. Publish both records exactly as provided, without changing the hostnames or targets, and enable DKIM only after DNS resolves correctly. If Microsoft 365 reports CnameMissing, check the authoritative DNS zone, the record spelling, and whether the DNS provider duplicated the domain name.

What Should Administrators Do When a DNS Provider Rejects or Truncates a Long DKIM TXT Value?

Use a provider-supported DKIM method that preserves the complete public key, such as correctly segmented TXT strings or CNAME delegation supplied by the email service. A truncated or malformed p= value prevents recipients from reconstructing the public key and causes DKIM verification to fail.

The same NCSC guidance shows the expected record name and value format. Confirm the published result with dig TXT selector._domainkey.example.com from more than one resolver. Never shorten the key manually, add a second conflicting record, or publish the private key while troubleshooting.

What Happens if a DKIM Private Key Is Leaked?

A leaked DKIM private key allows an unauthorized party to create valid signatures for the affected selector and signing domain until the key is revoked. The cyberattacker still needs a way to send mail, but recipients can treat forged messages as cryptographically signed, increasing phishing and business email compromise risk.

Disable the affected signer, generate a new key pair, publish its public key under a new selector, and activate the replacement. Revoke the compromised selector promptly by publishing it with an empty p= value. Review DNS, mail-platform, and access logs, and update incident-response records before restoring normal operations.

How Does DKIM Affect BIMI and Brand-Logo Display in Supported Inboxes?

DKIM supports BIMI indirectly by helping messages pass the authentication and alignment checks that BIMI implementations require, but DKIM alone does not display a brand logo. BIMI generally depends on DMARC enforcement, an aligned authenticated message, a valid BIMI record, and a properly formatted brand asset.

The All About BIMI page from the BIMI Group explains that BIMI requires strong SPF, DKIM, and DMARC authentication, with DMARC at enforcement, and uses a published logo specification. Configure DKIM for every legitimate sender, align the signing domain with the visible From domain where required, and test each mailbox provider because logo display remains provider-dependent.

Build Human Resilience Around Authenticated Email

A completed DKIM deployment strengthens domain trust, but email authentication does not address social engineering delivered through trusted accounts or other channels. A broader human-risk program gives employees practical training to recognize and report deceptive requests before they become incidents. Take a self-guided tour of Adaptive Security's cybersecurity awareness training platform. 

Adaptive Team

Adaptive Team

As experts in cybersecurity insights and AI threat analysis, the Adaptive Security Team is sharing its expertise with organizations.

Get started with Adaptive Security

Human and Agent Security for the AI Era.