Outbound Wiki

DKIM signing

How DomainKeys Identified Mail adds cryptographic signatures that receiving servers can verify.

DKIM, short for DomainKeys Identified Mail, is an authentication method that helps validate mail from a domain.1 The sender hashes selected headers and the body, signs the hash with a private key, and adds a DKIM-Signature header. The receiver retrieves the public key from DNS and checks the signature.2 DKIM checks whether the message was altered in transit.3 The signature stays valid while intermediate systems leave the signed parts alone.4 An outbound gateway can change those parts by adding a footer.5 Set up DKIM in this order: identify the sending service, create the key pair, publish the public key, enable signing, then test the message after its full route.

Before you configure

Find every service that sends mail for the domain and check whether DKIM already exists. The setup path varies by email service.6 Cloud-based services automate some of the configuration, so look for a DKIM control in the administration panel or contact the service provider.78

A domain may already have DKIM configured by default, so check before creating a new record.9 A free DKIM checking tool can show whether the domain already has a working setup.10

Check which service signs each type of outbound mail, whether the domain already has a public key in DNS, and whether an outbound gateway sits between the sending service and the recipient. Continue once you know which system will sign the message and which system controls the DNS record.

Generate the key pair

Choose the route that matches your sending architecture. The source system needs the private key, and the public key must reach DNS.

If you configure DKIM directly on email servers, generate an RSA public and private key pair.11 Use the recommended 2048-bit size.12 The source email system uses the private key to digitally sign important parts of outbound messages.13

Review what the service signs before enabling it. Depending on the source email system, signed headers can include From, To, Subject, MIME-Version, Content-Type, Date, and other message-header fields.14 Identify the private key used for signing and the public key that belongs in DNS.

Publish the public key in DNS

Publish the public half of the pair for the signing domain so receiving systems can retrieve the material they need to read the signature.

The DNS record type depends on the email system. Microsoft 365 uses CNAME records, while other email systems might use TXT records.15 Receiving servers use the domain's public DKIM key to read the signature and authenticate messages from that domain.16

Use the record values supplied by the service that generated the key. Keep the signing domain visible in your checks because the d= value in the DKIM-Signature header identifies it.17

Enable signing and test the full route

Publishing the DNS record prepares verification. The sending system must still add a signature to the message that leaves it.

Make sure the email is DKIM signed before you treat the setup as complete.18 Send a controlled message through each real sending path, including any gateway. Inspect the raw message and confirm the signing domain in the DKIM-Signature header. Then check whether the receiver can retrieve the public key and verify that the signature matches the message content.19

If the check fails, work backward through the route. Compare the signing domain with the DNS record, then inspect anything that changes the message after signing. A failed DKIM validation can lead to quarantine or rejection according to the configured conditions.20

Rotate and maintain the keys

Treat rotation as a planned configuration change. Keep the signing service, DNS record, and selector in the same change record so a future failure can be traced quickly.

DKIM keys do not expire, though periodic rotation is recommended every 12 months.21 When rotating, create a new key with a new selector and follow the same setup steps.22 Test the new route before treating the rotation as finished.

What not to do

Use these checks to catch failures that a basic DNS lookup can miss.

  • Do not leave outbound gateway settings unverified. Those settings can interfere with DKIM.23
  • Do not treat DKIM as a spam filter. It does not filter or identify spam on its own.24
  • Do not make a configuration change without a recovery plan, because DKIM misconfiguration can have serious consequences.25

Tool for this

Sending from your own mailboxes, safely paced

Intedat covers the basics here properly. It sends from the Gmail, Microsoft 365 or SMTP mailbox you already own, shows SPF, DKIM and DMARC checks for a custom domain and rechecks them, and the daily limit per mailbox tops out at 100 inside a sending window you set per workflow. It will not warm a mailbox up for you, so that part stays your job.

Open Intedat

Sources

  1. 1
    “DomainKeys Identified Mail (DKIM) is a method of email authentication that helps validate mail sent from your Microsoft 365 organization to prevent spoofed senders that are used in business email compromise (BEC), ransomware, and other phishing attacks.”
  2. 2
    “Signing happens at the sender — the sending platform takes the message body and selected headers, hashes them, signs the hash with the private key, and adds a DKIM-Signature header. Verification happens at the receiver — they pull the public key from DNS, recompute the hash, and check the signature.”
  3. 3
    “The primary purpose of DKIM is to verify that a message wasn't altered in transit.”
  4. 4
    “The digital signature is stored in the DKIM-Signature header field in the message header and remains valid as long as intermediate email systems don't modify the signed parts of the message.”
  5. 5
    “Outbound gateways can be set up to modify outgoing messages, for example by adding a footer to the bottom of every message.”
  6. 6
    “How you go about creating and implementing a DKIM key will vary depending on your email service.”
  7. 7
    “If you use a cloud-based email service, your DKIM configuration will be automated to some extent.”
  8. 8
    “Look for a DKIM option in your administration panel, or contact your service provider.”
  9. 9
    “You might not need to set up DKIM if your domain already has DKIM set up by default, or if you bought your domain from a Google partner when you signed up for Google Workspace.”
  10. 10
    “To check if DKIM is already set up for your domain, use one of many free tools available on the internet.”
  11. 11
    “If you are configuring DKIM on your email servers directly, you will need to generate an RSA public/private key pair.”
  12. 12
    “We recommend you use a 2048-bit key.”
  13. 13
    “One or more private keys are generated for a domain and are used by the source email system to digitally sign important parts of outbound messages.”
  14. 14
    “From, To, Subject, MIME-Version, Content-Type, Date, and other message header fields (depending on the source email system).”
  15. 15
    “The corresponding public keys are stored in DNS records for the signing domain (CNAME records in Microsoft 365; other email systems might use TXT records).”
  16. 16
    “Receiving servers use your public DKIM key to read the DKIM signature and authenticate messages they get from your domain.”
  17. 17
    “The signing domain is identified by the d= value in the DKIM-Signature header field.”
  18. 18
    “the email is DKIM signed”
  19. 19
    “The receiving server retrieves the matching public key from DNS and verifies that the signature matches the message content.”
  20. 20
    “If this DKIM validation fails, such emails are quarantined or rejected based on the conditions set by you when DKIM validation fails.”
  21. 21
    “DKIM keys do not expire, but you should rotate them periodically (we suggest every 12 months).”
  22. 22
    “Create a new key with a new selector and follow the same steps as above.”
  23. 23
    “If you use outbound gateways, you must verify that the settings don't interfere with DKIM.”
  24. 24
    “DKIM does not filter or identify spam on its own.”
  25. 25
    “However, its setup and maintenance are more complex compared to SPF and DMARC, which can result in serious consequences if misconfigured.”