Get your free beta license ↗
Mail · Rspamd

DKIM fails after the key changed

Last updated 30 Nov 2026
Summary

Receiving servers report that a domain's DKIM signature fails after its key is rotated. If the domain's DNS is hosted elsewhere, publish the missing record for the new key Rspamd uses.

Symptoms

After you run urbestack-mail-dkim-rotate, receiving servers report that the domain's DKIM signature fails. A receiving server that runs Rspamd adds the following header.

Output
Authentication-Results: mx.example.org;
	dkim=none ("invalid DKIM record") header.d=example.com header.s=s20261130 header.b=TrRAWVev;

The header.s field gives the selector used to sign the message. Other servers may report the failure as dkim=permerror or dkim=fail.

Cause

urbestack-mail-dkim-rotate creates a key under a dated selector such as s20261130. A second rotation on the same day uses s20261130a. Rspamd starts signing with the new key immediately.

UrbeStack publishes the new key's record in the domain's DNS zone on this server. It keeps the previous selector's record until the next rotation so receiving servers can verify mail still in transit. It removes older records.

When the domain's DNS is hosted elsewhere, receiving servers find no key for the new selector until you copy the record to that DNS host.

Resolution

  1. Use the following command to find the selector in use and the DNS records. dkim_selector shows the selector Rspamd signs with, and dkim lists each record's name and content.

    urbestack-mail-domain-get --name example.com
  2. At the DNS host, add a TXT record using the name and content for the selector in use. In this example, the record name is s20261130._domainkey.example.com.

  3. Check the public DNS response. It should show the TXT record you published.

    dig +short TXT s20261130._domainkey.example.com
  4. Rotate a key only when you can publish its record immediately. Rspamd starts signing with the new key as soon as you rotate it.