Skip to main content

What is DKIM? How it works and how to set it up

Published on July 3, 2026 11 min read

DKIM adds a digital signature to your outgoing email. Learn what DKIM is, how it works, how to set it up and how it fits with SPF and DMARC.

Flat vector illustration: a sent email carrying an amber seal as a digital signature, checked by a receiving server with a key and shield.

DKIM adds a digital signature to your outgoing email. Receiving mail servers use that signature to check whether a message genuinely comes from your domain and has not been altered along the way. This article explains what DKIM is, how signing and verification work, how to set it up and how it works together with SPF and DMARC. If you have hosting with LJPc, DKIM is switched on for you by default. You will also read how to check that it works for your domain.

What is DKIM?

DKIM stands for DomainKeys Identified Mail. It is an open standard for email authentication, defined in RFC 6376. With DKIM, the sending mail server signs every outgoing message with a secret key. The recipient checks that signature using a public key that is published as a DKIM record in your DNS.

Think of DKIM as a sealed envelope. The sender stamps the letter with a seal that only they can produce. The recipient can tell from the seal that the letter comes from the right sender and that nobody opened it in transit. If the seal does not match, something is wrong.

DKIM relies on a key pair: a private key that stays secret on the mail server and a public key that anyone may look up. Whatever is signed with the private key can only be verified with the matching public key. That is how the recipient knows for certain that the signature belongs to your domain.

Why does DKIM matter?

Without authentication, someone with bad intentions can send email that appears to come from your domain. This is called spoofing, and it is widely used for phishing and spam. DKIM makes that harder, because a forger does not have your private key and therefore cannot produce a valid signature.

A valid DKIM record also improves your deliverability. Mailbox providers such as Gmail, Yahoo and Microsoft factor in authentication when deciding whether a message lands in the inbox or the spam folder. Messages with a matching DKIM signature are trusted more often.

The major providers now treat it as a requirement. Since February 2024, Gmail and Yahoo require every sender to have at least SPF or DKIM in place. Anyone sending more than 5,000 messages per day to Gmail must have SPF, DKIM and DMARC all in order. Since May 2025, Microsoft sets the same three requirements for senders that send more than 5,000 messages per day to Outlook.com and Hotmail. If you send a lot of newsletters or transactional email, you need a correct combination of SPF, DKIM and DMARC.

How does DKIM work?

DKIM has two sides: signing on the sending end and verification on the receiving end. In between sits your DNS, which holds the public key.

Signing

When your mail server sends a message, it calculates fingerprints (hashes) of the message body and of a set of header fields, such as the sender, the subject and the date. Those fingerprints are then signed with the private key.

The server adds an extra header to the message: the DKIM-Signature. It contains, among other things, the signing domain (the d= tag), the selector used (the s= tag), the list of signed fields (h=) and the signature itself (b=). This header travels with the message to the recipient.

Verifying

The receiving mail server reads the DKIM-Signature and sees which domain and selector were used. It then queries DNS for the public key at the name selector._domainkey.yourdomain.com.

Using that public key, the recipient recalculates the same fingerprints and compares them with the signature. If they match, the DKIM check passes: the message is authentic and unchanged. If the content was altered in transit or the key is missing, the check fails.

What does a DKIM record look like?

The public key is published as a TXT record in your DNS. The name of that record consists of a selector, followed by _domainkey and your domain. A record for the selector default looks like this:

default._domainkey.yourdomain.com.  IN  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQ...AB"

The main parts are:

  • v=DKIM1 signals that this is a DKIM record. It is optional, but recommended.
  • k=rsa is the key type. RSA is by far the most common. If the tag is missing, the recipient assumes RSA. That is why the records LJPc creates do not need it.
  • p= holds the public key itself, as a long string of base64 characters. The key above is shortened. A real key is much longer.

A selector is a label that points to a specific key. You may use several selectors, for example a separate selector per email service or to rotate keys without downtime. You choose the selector name yourself, or your mail server sets it for you.

Mind the length. A 2048-bit public key is around 400 characters long, while a text value in a TXT record may hold at most 255 characters per piece. Long keys are therefore stored in several pieces that are joined back together. At LJPc you paste the whole key into the field in one go, without quotation marks: we split it into pieces of 255 characters automatically.

Setting up DKIM

How you set up DKIM depends on where your email is handled. The broad outline is the same for every provider:

  1. Enable DKIM with whoever sends your outgoing email. They generate a key pair and choose a selector.
  2. Publish the public key as a TXT record in your domain's DNS, at the name selector._domainkey.yourdomain.com. Some services give you a CNAME record instead, pointing to their own key.
  3. Wait until the record is active. At LJPc, a new or changed record usually reaches our name servers within a minute. Servers that looked up the name shortly before remember the old answer until the TTL expires, which at LJPc is usually after an hour. With another DNS provider, the waiting time depends on that provider. Read more in DNS propagation.
  4. Send a test message and check whether DKIM passes in the received email.

DKIM only covers your outgoing email. It is separate from your MX record, which instead decides which server receives email for your domain. Both are part of a complete email configuration, but they serve different purposes.

DKIM at LJPc: set up by default

If you have a hosting package with LJPc and send your email through our mail servers, DKIM is switched on for you by default. Plesk signs your outgoing email with the selector default, and the public key is already in your DNS zone as a TXT record at default._domainkey.yourdomain.com. This also applies to email your website sends through the server, such as order confirmations and messages from a contact form. You do not need to create or publish the key yourself.

Checking that DKIM is on for your domain

There are two ways to check:

  • In Plesk: open the Mail Settings tab in the Mail menu and click your domain. The checkbox Use DKIM spam protection system to sign outgoing email messages should be ticked. From the customer portal you open Plesk without logging in separately, see open Plesk from the customer portal.
  • With a test email: send a message from your own address to an account with another provider, for example Gmail. View the original source of the message there. If the Authentication-Results header shows dkim=pass together with your domain, DKIM works.

If the checkbox is not ticked, tick it and save the setting. Plesk then creates the key pair itself and adds the public key to your DNS zone as a TXT record. If you cannot change the setting, create a support ticket and we will look into it with you.

Your DNS is with another provider

If you send your mail through LJPc but manage your domain's DNS elsewhere, the DKIM record has to be there. In Plesk, open the mail settings of your domain and click How to configure external DNS. It shows the DKIM record to add at your DNS provider. If you move your domain to other name servers, take this record with you. Otherwise the DKIM check fails as soon as the new name servers are active.

You also send through another service

Do you also send email on behalf of your domain through another service, such as a newsletter service, your accounting software, a CRM, Microsoft 365 or Google Workspace? Then that service signs with its own key and its own selector. The service gives you the records to put in your DNS. Microsoft 365, for example, asks for two CNAME records (selector1._domainkey and selector2._domainkey), and Google Workspace for a TXT record at google._domainkey. Those records sit next to the LJPc record default._domainkey and do not get in each other's way. So keep the LJPc record in place as long as you also send through us. All the records such a service asks for, from SPF to verification code, are listed in how to add DNS records from an email or marketing service.

Where you add such a record depends on your package:

  • Hosting package: in Plesk, go to Websites & Domains, click the Hosting & DNS tab of your domain and then DNS. Then click Add Record. Choose the type the service specifies (TXT or CNAME), enter the part before your domain as the name (for example selector1._domainkey) and paste the value. Confirm with OK. Plesk then queues the record, but does not apply it to your DNS zone yet. Then click Update above the list: only then does the record go into your DNS zone. If you decide not to apply the queued change after all, click Revert in the same notice.
  • DNS management only at LJPc: you manage the records in the customer portal. Open the Domains page in the Services menu, click your domain, and click Add record under DNS records. Choose the Type, fill in the Name and the Content, and click Save. If the portal shows the message Invalid hostname for a CNAME record, as it does for the Microsoft 365 DKIM records, create a support ticket.

How to view, add and change records is explained step by step in manage DNS records.

SPF, DKIM and DMARC together

DKIM is one of the three pillars of modern email security. The other two are SPF and DMARC. They complement each other and work best in combination.

  • SPF defines which servers may send email on behalf of your domain. It checks the envelope address, not the visible sender. Read more in our article on the SPF record.
  • DKIM places a digital signature on the message itself. That signature stays valid even when the message is forwarded.
  • DMARC ties SPF and DKIM to the visible From address and tells recipients what to do with suspicious email. Read more in our article on DMARC.

DMARC passes when SPF or DKIM passes and the checked domain matches the domain in the visible From address. This is called alignment. Because a DKIM signature survives forwarding while SPF often does not, DKIM is frequently the more reliable pillar for DMARC.

For solid protection you need all three: SPF, DKIM and DMARC. Each record catches something the other two miss. At LJPc hosting they are set up by default: SPF with include:_spf.ljpc.network, DKIM at default._domainkey and DMARC with p=quarantine. What else is involved in securing your mail is covered in email security.

Common mistakes

A few things often go wrong when setting up DKIM. This table helps you recognise and fix them.

Common DKIM problems and how to solve them
ProblemCauseSolution
DKIM fails after forwardingAn intermediate server changed the messageOften unavoidable with forwarding. DMARC looks at SPF and DKIM together
Wrong selectorThe selector from the signature does not exist in your DNSCheck that the TXT record sits at the correct selector._domainkey name
Key cut offThe long public key was not published in fullPublish the entire p= value. At LJPc you paste it into the field in one go; with another provider, in several pieces if needed
No alignmentThe domain in d= does not match the From addressSign with the same domain as in the visible sender
DKIM fails after moving your DNSYour domain uses other name servers and the default._domainkey record was not moved alongAdd the DKIM record from Plesk at your new DNS provider

Once you know the setup, DKIM is clear: your mail server signs, your DNS holds the public key and the recipient checks. Together with SPF and DMARC, this keeps your email trustworthy and your domain protected. If your mail still ends up in spam, see fix email problems. If you would like us to take a look, create a support ticket.

Frequently asked questions

Is DKIM mandatory?

Not by law, but often in practice. Since February 2024, Gmail and Yahoo require every sender to have at least SPF or DKIM in place. Anyone sending more than 5,000 messages per day needs SPF, DKIM and DMARC at Gmail, and since May 2025 at Microsoft as well. For smaller senders too, DKIM improves deliverability and limits abuse of your domain. At LJPc hosting, DKIM is switched on by default.

Do I need to set up DKIM myself at LJPc?

Usually not. With a hosting package, Plesk signs your outgoing email with the selector default by default, and the DKIM record is already in your DNS zone. In Plesk, check under Mail, Mail Settings tab, that the DKIM checkbox is ticked for your domain. If you manage your DNS with another provider, add the DKIM record there yourself.

What is a DKIM selector?

A selector is a label tied to a specific public key. The recipient uses the selector from the signature to find the right key in your DNS, at the name selector._domainkey.yourdomain.com. Because you can use several selectors, you can rotate keys or let multiple services sign without getting in each other's way. At LJPc the selector is default.

Can I have more than one DKIM key?

Yes. You may publish several DKIM records, each with its own selector. That is handy when different services send email on behalf of your domain, or when you want to replace an old key with a new one. Each key sits at its own selector._domainkey name. If you also send through LJPc, keep the default._domainkey record in place.

Does DKIM also work with forwarded email?

Usually it does. Because the signature travels with the message, DKIM stays valid as long as the content does not change. That is an important difference from SPF, which often fails on forwarding because the forwarding server uses a different IP address. If an intermediate step does alter the message, the signature can still break.

What is the difference between SPF, DKIM and DMARC?

SPF defines which servers may send on behalf of your domain. DKIM signs the message so the recipient can verify it is genuine and unchanged. DMARC ties both to the visible sender address and decides what happens to suspicious email. Together they form the basis of modern email security.

How do I check whether DKIM works?

Send a test message to an account you can open, for example at Gmail. View the original source of the message there and look in the Authentication-Results header for dkim=pass. You can also query the public key directly, at LJPc with dig TXT default._domainkey.yourdomain.com, or use an online DKIM checker.

Prefer to talk to someone?

We are also happy to answer your questions personally. Schedule a free consultation or call us directly. We are glad to think along with you.

Stay up to date with recent developments! Subscribe and receive our newsletter Signing up...