DKIM verifies that an email came from the server that claims to have sent it

DKIM (DomainKeys Identified Mail) is a method that proves an email message wasn't altered after your mail server sent it. When you send an email from your domain, your server signs it with a private key — like a tamper-evident seal. The receiving server checks that signature against a public key published in your domain's DNS records. If the signature matches, the receiving server knows the message is genuine and hasn't been modified in transit.

DKIM doesn't encrypt your email or hide its contents. It only proves the message came from your domain and arrived unchanged. Think of it as a notarized stamp that says "this email left our server intact." Without DKIM, a spammer could send mail that appears to come from your domain, and the receiving server would have no way to tell the difference.

Most email providers now expect DKIM signatures on incoming mail. Gmail, Outlook, and corporate mail systems treat unsigned mail with suspicion — it's more likely to land in spam or be rejected entirely. If you're sending mail from your own server or through an SMTP service, setting up DKIM is usually required to reach inboxes reliably.

Key Takeaways

  • DKIM uses a private key on your mail server and a public key in your DNS to prove emails from your domain haven't been altered.
  • The receiving server checks the DKIM signature automatically; you don't need to do anything on the recipient's end.
  • Without DKIM, your mail is more likely to be flagged as spam or rejected by major email providers.
  • Setting up DKIM requires adding a DNS record to your domain and configuring your mail server or SMTP service to sign outgoing messages.
  • DKIM works alongside SPF and DMARC to form a complete email authentication system.

How DKIM signing and verification actually works

When your mail server sends an email, it generates a unique signature based on the message content and a private key stored on your server. This signature is added to the email header as a DKIM-Signature field. The signature is mathematically tied to the message — if even one character changes, the signature becomes invalid.

The receiving server extracts the signature from the email header and looks up your domain's public key in DNS. It uses that public key to verify the signature. If the math checks out, the message is authentic. If the signature doesn't match — because the message was altered, or because it wasn't actually signed by your server — the verification fails.

This process happens behind the scenes. The recipient never sees the DKIM record or the verification step. They just receive the email. But their mail server has already decided whether to trust it based on the signature check.

Setting up DKIM on your mail server or SMTP service

The exact steps depend on what you're using to send mail. If you run your own mail server (like Postfix or Exim), you'll install a DKIM signing tool, generate a key pair, and configure the server to sign outgoing messages. If you use a third-party SMTP service like SendGrid, AWS SES, or Mailgun, the service usually generates the keys and DNS record for you.

Most SMTP services provide a DNS record that looks like this: a TXT record with a name like default._domainkey.yourdomain.com and a long string of characters as the value. You add this record to your domain's DNS settings through your domain registrar or DNS provider. Once the record is live, receiving servers can find your public key and verify your signatures.

After you add the DNS record, wait 24 to 48 hours for it to propagate across the internet. Then send a test email and check whether the DKIM signature is present and valid. Most mail services let you view the full headers of a received email to see the DKIM-Signature field and the verification result.

DKIM, SPF, and DMARC work together

DKIM is one piece of a three-part authentication system. SPF (Sender Policy Framework) tells receiving servers which IP addresses are allowed to send mail from your domain. DMARC (Domain-based Message Authentication, Reporting and Conformance) is a policy that says what to do if SPF or DKIM fails — reject the mail, quarantine it, or allow it through anyway.

Together, these three standards make it much harder for attackers to impersonate your domain. SPF stops someone from sending mail from a random server and claiming it's from you. DKIM proves the message wasn't altered. DMARC enforces a policy so receiving servers know how strict to be. Most mail providers now check all three before deciding whether to deliver your message.

If you're setting up a mail server or SMTP service, configure all three. Start with SPF and DKIM, then add DMARC once those are working. This gives you the strongest possible authentication and the best chance of reaching inboxes.

Why receiving servers reject mail without DKIM

Email spam has become so common that major providers treat unsigned mail as suspicious. Gmail and Microsoft have both announced that they will reject mail from domains that don't publish SPF and DKIM records. Corporate mail systems often have even stricter rules — they may reject anything that fails DKIM verification.

If your mail isn't reaching inboxes, the first thing to check is whether DKIM is set up and working. Most mail services provide a way to view the headers of a received email. Look for the line that says something like "DKIM: PASS" or "DKIM: FAIL". If it says FAIL, your signature isn't matching — usually because the DNS record isn't published yet, or because your mail server isn't signing messages.

Even if mail does arrive without DKIM, it's more likely to be filtered into spam. Users may not see it, or it may be marked with a warning. Setting up DKIM removes that friction and ensures your mail is treated as legitimate.

Common DKIM setup mistakes

The most frequent problem is publishing the DNS record incorrectly. DKIM records are long and contain special characters. If you copy and paste the record and miss a character, or if you add extra spaces or line breaks, the receiving server won't be able to read it. Always copy the entire record from your mail service and paste it exactly as provided, without editing.

Another common mistake is using the wrong DNS record name. DKIM records have a specific format: selector._domainkey.yourdomain.com. The selector is usually "default" or a number like "1", but your mail service will tell you which one to use. If you use the wrong selector, receiving servers won't find your public key.

A third issue is not waiting long enough for DNS to propagate. DNS changes can take up to 48 hours to spread across the internet. If you add the record and test when ready, it may fail. Wait at least a few hours, then test again. You can use online DKIM checkers to see whether your record is live and readable.

Testing whether DKIM is working

Send a test email to yourself or a colleague and view the full headers. In Gmail, click the three dots next to the email, then "Show original". Look for a line that says "DKIM: PASS" or includes the text "dkim=pass". If it says "DKIM: FAIL" or "dkim=fail", your signature isn't verifying.

If DKIM is failing, check three things: First, make sure your DNS record is published and correct. Use an online DKIM checker tool and paste your domain name — it will tell you whether the record is readable. Second, confirm that your mail server or SMTP service is actually signing messages. Check the mail service's documentation or settings to make sure DKIM signing is enabled. Third, verify that you're using the correct selector — the mail service should tell you which one to use.

Once DKIM is passing, check your SPF and DMARC records too. All three should show PASS for the best results. Some mail services provide a dashboard that shows the status of all three at once.

Frequently Asked Questions

Does DKIM encrypt my email?

No. DKIM only signs the message to prove it came from your server and wasn't altered. The email content itself is not encrypted. If you need to hide the contents of an email, you need a separate encryption method like TLS or PGP.

What happens if I don't set up DKIM?

Your mail will still be sent, but it's more likely to be filtered into spam or rejected entirely by major providers. Gmail and Microsoft have both announced stricter policies for unsigned mail. Setting up DKIM is now considered standard practice.

Can I use DKIM with multiple mail servers?

Yes. You can publish multiple DKIM records with different selectors, one for each mail server. Each server signs with its own private key, but they all use the same domain name. This lets you rotate keys or use different servers without breaking authentication.

How often should I rotate my DKIM keys?

There's no strict requirement, but rotating keys every year or two is a reasonable security practice. When you rotate, publish the new public key in DNS first, then update your mail server to use the new private key. Keep the old record live for a few days so mail in transit can still be verified.

What's the difference between DKIM and DMARC?

DKIM signs the message to prove it's authentic. DMARC is a policy that says what to do if DKIM or SPF fails. You need both: DKIM and SPF do the authentication, and DMARC enforces what happens when authentication fails.