WooCommerce DKIM: how to set it up

Short answer: DKIM is a signature that your mail service adds to each email. To set it up, copy the DKIM record your mail service shows you, publish it in your domain’s DNS under the exact name it gives, wait for DNS to update, then turn signing on and check it.

Reviewed

Symptom

A checker, a bounce message or a mail provider says your emails are not DKIM signed, or you were told to “set up DKIM” for your store. Or the free checker shows “Not checked” for DKIM and you wonder if something is wrong.

Why it happens

DKIM (DomainKeys Identified Mail) works with two keys. Your mail service keeps a private key and uses it to add a signature to every message it sends. You publish the matching public key in DNS (the public address book of your domain). The receiving server reads the signature, looks up the public key, and checks that the message was not changed on the way (RFC 6376).

Some points that confuse people:

  • The key comes from your mail service, not from your store. WooCommerce and WordPress do not sign mail for you. Your mail service (your email host, an SMTP plugin’s service, or a sending service) usually creates the key pair and shows you the public key to publish. If you made up a record yourself, it will not match.
  • The selector. One domain can have several keys. The selector is a label that tells receivers which one to use. It is part of the DNS name: <selector>._domainkey.<domain>, for example google._domainkey.example.com. Each signature carries the selector in its s= tag and the signing domain in its d= tag (RFC 6376, sections 3.1, 3.5 and 3.6.2.1). Your mail service picks the selector or lets you pick it.
  • The record is usually a TXT record. A TXT record is a DNS entry that holds text. Some services give you CNAME records instead (a CNAME points one name to another name the service controls). The service tells you which one, and what to put in it.

Fix

  1. Find out which service sends your store’s email. Order emails may leave through your web host, an SMTP plugin, or a sending service. Set up DKIM at the service that actually sends them. If you are not sure, open a test order email and look at the headers, or see WooCommerce emails not sending or going to spam.
  2. Open that service’s domain setup. Look for a page called “domain authentication”, “sender authentication”, “verify domain” or “DKIM”. Add your domain there if it is not listed.
  3. Copy the record it gives you. You need three things: the record type (TXT or CNAME), the host (name), and the value. Copy them exactly. Do not retype them: the values are made for your account, and one wrong dash or dot breaks the check.
  4. Check the host name. It must end up as <selector>._domainkey.<yourdomain>. Some DNS hosts want only <selector>._domainkey in the host field and add your domain for you. Others want the full name. Look at how your DNS host shows other records, and do the same. If your host adds the domain and you also typed it, you get google._domainkey.example.com.example.com, which is the wrong name.
  5. Add the record at your DNS host. That is where your domain’s nameservers point: often your domain registrar or a service like Cloudflare. Paste the value as one piece. Keep the v=DKIM1; k=rsa; p=... text whole. Do not add line breaks, and do not delete the end of a long key.
  6. If the value is long, watch for splitting. A long key can be stored in a TXT record as several quoted strings, and receivers join them with nothing in between (RFC 6376, section 3.6.2.2). If your DNS editor rejects a long value or cuts it off, ask your DNS host about long TXT records, or ask your mail service for a shorter key if it offers one. Google’s page says some DNS hosts limit the length of a TXT record and that you can choose a 1024-bit key if your host does not support 2048.
  7. Wait, then turn signing on if the service asks. Some services only start signing after you press a button. Do not press it before the record is published.

Two examples, as the providers describe them

These show the shape. Always use the values your own account shows.

  • Google Workspace. In the Admin console, go to Apps, Google Workspace, Gmail, Authenticate email, and generate a new record. The default selector is google. The host is the selector followed by ._domainkey, and the value looks like v=DKIM1; k=rsa; p=.... After the record is in DNS, return to the same page and click Start authentication. Google says Gmail must have been on for 24 to 72 hours before you can generate the key. See Google Workspace help: set up DKIM.
  • Microsoft 365. Microsoft uses two CNAME records, with the host names selector1._domainkey and selector2._domainkey. The values that they point to are specific to your domain and are shown in the Defender portal (or by a PowerShell command in Microsoft’s article). Microsoft says the examples in its article are for illustration only. After you publish both records, you enable DKIM signing for the domain. See Microsoft Learn: use DKIM for email in your custom domain.

For any other service, use its own help pages. We did not read other providers’ pages for this guide, so we give no values for them.

How long DNS takes

A new record is visible as soon as your DNS host has saved it and the old answer has expired from caches (the cache time is the TTL shown at your DNS host). Providers give their own estimates. Google says DKIM can take up to 48 hours to start working after you add the key. Microsoft says it takes a few minutes, possibly longer, to detect new CNAME records. If a check fails right after you save, wait and try again before you change anything.

Check it worked

  1. Use the free checker. Type your domain. If your selector is one of the common ones the checker tries, the DKIM line shows the selector and the key it found. The checker tries these 14 selectors: default, google, selector1, selector2, k1, k2, mail, s1, s2, dkim, mandrill, mxvault, smtp and em.
  2. If the DKIM line says “Not checked”, that is not a failure. DNS cannot list the selectors under a domain, so the checker can only try common names. If your service uses a different selector, the key may be there and the checker will not look under that name. The checker says so in its message. In that case, look the record up yourself: dig +short TXT <selector>._domainkey.example.com (use your selector and domain). You should see a value that starts with v=DKIM1 and contains p= followed by a long key. If you published CNAME records instead, ask your service how to check them.
  3. Send a real test. A found key only means the record is published. It does not prove your service signs with it. Send an email from your store to a mailbox at a large provider that is not your own sending account, open the message source or “show original”, and look for dkim=pass. Google’s page suggests the same: check the Authentication-Results header on a message sent to a Gmail or Workspace address, and note that sending to yourself will not verify DKIM.

If it still fails

  • The key is at the wrong name. Look at the name again. It must be <selector>._domainkey.<yourdomain>: with _domainkey spelled exactly, one dot between the parts, and the selector your service uses. A key under the wrong selector is never found (RFC 6376, section 3.6.2.1).
  • The key is cut off or changed. If the DNS editor trimmed a long value, added quotes as part of the text, or you left out the end of p=, the key will not verify. Copy the value again from your service. Look it up with dig and compare it with what the service shows.
  • More than one record at the same name. The standard says TXT records must be unique for a selector name, and results are undefined if there are several (RFC 6376, section 3.6.2.2). Remove old duplicates.
  • Your service is not signing for your domain. The record can be perfect while the mail leaves through another service that does not sign with your key, or signs with its own domain instead. A signature with the service’s domain in d= can pass DKIM but will not line up with your From address for DMARC (see DMARC for beginners). Check that the signing is turned on and that the service signs with your domain.
  • The key is empty (p= with nothing after it). In DKIM, an empty p= value means the key has been revoked (RFC 6376, section 3.6.1). Mail signed with it will fail. The free checker shows a warning for this and names the selector. Publish the current key from your mail service again, or ignore the warning if you have moved to another selector.

DKIM is one of two paths to a DMARC pass, the other being SPF. Set up both. To publish the SPF side, see WooCommerce SPF record: add or fix it; if it already exists and fails, see SPF too many DNS lookups.

How the plugin helps

Email Health Check & Log for WooCommerce looks for a DKIM public key under 13 common selector names on the domain your site sends from, and reports “Not checked” instead of a failure when it finds none, because it cannot know your selector. When it finds one it says so, but it does not verify the signature or test that your mail service signs with it, and it does not change your DNS. The plugin’s check counts a record with an empty p= as found, so use the free checker on this site or the lookup above to spot a withdrawn key. Get the plugin on WordPress.org.

Sources

Check your own domain

Type your domain into the free checker to see whether your SPF, DKIM and DMARC records are in place. Or install the free plugin, which checks the basics from inside your dashboard.