TeneoSMTP RELAY

Blog / DKIM

Step-by-step guide · DKIM

Rotate a DKIM key without a minute of unsigned mail.

Publish the new key next to the old one, then move the signing over. Don't replace anything. Six steps, two waits, and what goes wrong when you skip one.

Short answer

How do you rotate a DKIM key safely?

Publish the new key under a new selector and sign with it only once the record is visible. Keep the old record for at least seven days, then revoke it with an empty p= instead of deleting it. That's how RFC 6376 intended selectors to work.[1]

Rather not do this by hand?

On Teneo, two of these six steps are yours, and both are one DNS record. You publish the new record. The console checks it every hour, switches the signing when the key matches, removes the old key on day 7 and tells you when to revoke the old record.

See it happen

What receivers see at each step.

Step through the rotation. On the left is what DNS returns, on the right what your server signs with. Then skip a step and watch it break.

example.be · DKIM rotationT+0

    Step 0

    DNS · what receivers findTXT
    s2026-04._domainkey
    s2026-10._domainkey
    Signer · what you send withs=
    New messages
    Still in a queue somewhere
    What if you

    The six steps

    Publish, check, switch, wait, revoke.

    RFC 5863 sets the order[2], and M3AAWG's 2019 best practices add the timings.[4] Each step shows what to do on the left and what the source says on the right.

    1. 01Minutes

      Generate the new pair and pick a new selector

      Use 2048 bits. Put a date in the selector so you never reuse one by accident.

      # new selector, dated s2026-10._domainkey.example.be
      Signers "SHOULD use RSA keys of at least 2048 bits."
      RFC 8301 [3] · Gmail requires 1024+, recommends 2048 [5]
    2. 02Minutes

      Publish the new record. Don't sign with it yet.

      The new key sits on the signing server, but it isn't the default yet.

      "Wait for the DNS modification(s) to propagate before signing any email."
      M3AAWG BCP, 2019 [4]
    3. 035 min to 48 h

      Check the record is visible, and that it's the right one

      Don't just "wait a while." Query a public resolver, not your own server, and compare the p= you get back with the key you generated.

      $ dig +short TXT s2026-10._domainkey.example.be @1.1.1.1 "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEF..." # matches the key you generated? then go to step 4
      "Check that the new public key is visible on each of your public DNS servers."
      Word to the Wise, 2014 [9] · Cloudflare's auto TTL is 300 s [8], Google allows up to 48 h [5]
    4. 04Instant

      Switch signing to the new key

      From now on, every new message carries the new selector. Mail that's already queued still carries the old one, and it keeps verifying because the old record is still there.

      "The signer begins generating signatures using the new key pair" only after it "verifies correct registration of the key record."
      RFC 5863 [2]
    5. 057 to 30 days

      Keep the old record for at least seven days

      Receivers check DKIM when a message arrives, not when it was sent. A deferred message can arrive days later.

      Keep it "unchanged in the DNS for a minimum of seven days, and up to 30 days."
      M3AAWG BCP, 2019 [4]
    6. 06Then stop

      Revoke the old key. Don't delete the selector.

      Publish the old selector with an empty key. A receiver that finds this "gravestone" knows the key was retired. A receiver that finds nothing can't tell your old key from a forgery.

      # before s2026-04._domainkey TXT "v=DKIM1; k=rsa; p=MIGfMA0G..." # after: revoked, not deleted s2026-04._domainkey TXT "v=DKIM1; k=rsa; p="
      "A gravestone for an old selector." … "Do not delete the selector entry for public key 1."
      RFC 5863 [2] · M3AAWG [4]

    Where it goes wrong

    Two mistakes. You won't see either one.

    Your sending server shows no error in either case. Only the receivers see the failure.

    Mistake 1 · the common one

    Signing too early

    New DNS
    Signing
    publishswitchvisible

    Mail goes out with a selector that some resolvers can't find yet. Each of those messages gets PERMFAIL (no key for signature)[1]. If SPF doesn't align, DMARC fails too, and under p=reject the mail is thrown away.

    It can get worse: a resolver that looked up the selector before it existed caches the "not found" for your SOA minimum, which can be hours.[7]

    FixPublish first, check it's visible from outside, then sign.

    Mistake 2 · the mirror image

    Retiring too early

    Old DNS
    In transit
    switchdeletedday 7

    You switch signing on Monday morning and delete the old record that afternoon because "it's done." Anything signed before the switch and still queued fails when it arrives: a receiver that was deferring, a batch waiting out a Microsoft rate limit.

    At Microsoft, SPF can't rescue it. High-volume senders to Outlook.com must pass both SPF and DKIM.[6]

    FixSet a reminder for day 7 when you switch, not after.

    Also worth knowing

    2048-bit keys don't fit in one string

    A DNS string holds up to 255 octets[7], so split the record into several quoted strings. Receivers join them back together.

    Also worth knowing

    Signing through a CNAME?

    Then your provider rotates the key, not you. With Microsoft 365's selector1/selector2, the new key "takes four days (96 hours)" to start signing.[6]

    Your checklist

    If you sign your own mail.

    Use this during the rotation. Tick each box as you go.

    0 of 7 done

    Or let the relay do the waiting

    One click, two DNS records, three emails.

    Doing it by hand leaves too many places to stop halfway, so we built the sequence into the console. Press Rotate key and publish the record from the first email. The relay checks DNS every hour, switches only when the p= matches exactly, and removes the old key on day 7. The third email tells you to revoke the old record.

    69 min

    until the new record was visible in a recent rotation. The relay switched at the next hourly check.

    Observed on our relay
    Over 9 in 10

    sending domains on our relay still signed with 1024-bit keys in October 2026. They all pass, which is the main reason they have not been rotated.

    Observed on our relay
    Inbox · from console.teneo.be
    Day 0
    09:12

    Publish a new DKIM record for example.be

    TXT for teneo20261020._domainkey, already split into strings. You'll keep signing with the current key until we can see the new one.

    1 · Your first action
    Day 0
    10:21

    example.be now signs with the new DKIM key

    The new key is visible in DNS and now signs your mail. Keep the old record in place until 27 October 2026.

    2 · Switched
    Day 7
    10:21

    Retire the old DKIM record of example.be

    The old key has been removed from our mail engine. Set the old record to an empty key. Do not delete it.

    3 · Your last action
    Every domain on Teneo gets its own key.Try it on a domain

    Questions

    Asked about rotation.

    How often should DKIM keys be rotated?

    M3AAWG's best practices, revised in 2019, say "at least every six months." They relaxed that from quarterly because twice a year "balances the risk of compromised keys and operational effort."[4] No RFC sets a period.

    What happens if I start signing before the DNS record is visible?

    Receivers return PERMFAIL (no key for signature). If SPF doesn't align, DMARC fails too, and a reject policy refuses the message. Resolvers may also cache the "not found" for as long as your SOA minimum allows.

    How long should the old key stay in DNS?

    At least seven days and up to thirty, so mail signed before the switch can still be verified when it arrives.[4]

    Should I delete the old selector or set p= to empty?

    Set it to empty. RFC 6376 treats an empty p= as a revoked key. A missing record looks the same as a forgery.[1]

    Is a 1024-bit DKIM key still acceptable in 2026?

    It still verifies. RFC 8301 sets 1024 bits as the minimum and recommends 2048.[3] Once rotation is routine, moving to 2048 costs you nothing extra.

    Sources · read October 2026 · no private communications used

    1. [1]RFC 6376, DomainKeys Identified Mail (DKIM) Signatures
    2. [2]RFC 5863, DKIM Development, Deployment, and Operations
    3. [3]RFC 8301, Cryptographic Algorithm and Key Usage Update to DKIM
    4. [4]M3AAWG DKIM Key Rotation Best Common Practices (M3AAWG078, rev. March 2019)
    5. [5]Google email sender guidelines and Workspace DKIM help pages
    6. [6]Microsoft Learn on DKIM in Microsoft 365; Outlook.com high-volume sender requirements
    7. [7]RFC 1034, RFC 1035 and RFC 2308 (DNS, string limits, negative caching)
    8. [8]Cloudflare and Route 53 TTL documentation
    9. [9]Word to the Wise, Steve Atkins, 2014
    10. [10]Spam Resource, Al Iverson, five DKIM tips, November 2024
    11. [11]Public mailop archive posts, 2017 and 2020

    Teneo observations come from our own console in October 2026 and are reported as shares only.

    Read next

    Rotate yours from the console

    One click, and the console does the waiting.

    Free plan, 100 messages a day for as long as you like. Every domain gets its own key, and every message shows up in your delivery log.

    Start for Free Talk to us

    We use Google Analytics and Google Ads cookies only with your consent. The one thing we store without asking is your cookie choice. More in our privacy page.

    Required

    Always on

    Remembers your cookie choice on this device. Nothing else.

    Analytics (Google Analytics)

    OnOff

    Shows us which pages people read and where they come from, so we can improve the site.

    Advertising (Google Ads)

    OnOff

    Tells us which ads bring visitors and sign-ups, so we know which ads are worth paying for.