Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Gmail 550 5.7.30 / 421 4.7.30: "This message was blocked because it didn't pass DKIM authentication"

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

Mail from a business domain to customers on Gmail comes back with 550 5.7.30, or is slowed with 421 4.7.30. Both carry a message about DKIM, the digital signature that a sending system adds to each message and that the receiving server checks against a public key published in the sender's DNS. Google's pages name the faults one by one: no DKIM record, a record not added or not started, a key cut short at the domain host, or a message changed after it was signed. Each can be proved before anything is changed.

Everything before the Fix section only reads.

What the error means

Google's page "Gmail SMTP errors and codes" lists the two rows.

The permanent refusal is 550 5.7.30. Its text is "This message was blocked because it didn't pass DKIM authentication. Gmail requires bulk email senders to authenticate their email with DKIM." It is followed by "Authentication results: DKIM = did not pass".

The temporary slowdown is 421 4.7.30. Its text is "Your email has been rate limited because DKIM authentication didn't pass for this message. Gmail requires all email bulk senders to authenticate their email with DKIM." The same page says "gsmtp (Google SMTP) is added to all errors."

Google's Set up DKIM page explains the mechanism: "Receiving servers use your public DKIM key to read the DKIM signature and authenticate messages they get from your domain." The public key is stored in a DNS text record for the domain. The private key is on the sending mail server, where it adds the signature.

Who counts as a bulk sender

The wording is "bulk email senders". Google's FAQ on the sender guidelines defines one: "A bulk sender is any email sender that sends close to 5,000 messages or more to personal Gmail accounts within a 24-hour period." The guidelines page itself says "more than 5,000 messages per day". Messages from one primary domain are added together, and "Senders who meet the above criteria at least once are permanently considered bulk senders." The SPF counterpart of this error is covered in Gmail 550 5.7.27 / 421 4.7.27.

The guidelines page requires every sender to "Set up SPF or DKIM email authentication for your sending domains", and a sender of more than 5,000 messages a day to "Set up SPF and DKIM email authentication for your domain." It also states: "Sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer."

Likely causes

Each row is a fault that Google's DKIM pages name.

Cause What Google's pages say Where it shows
No DKIM record was ever generated "If the DNS hostname and TXT record values are blank, you do not have a DKIM record." The Authenticate email page in the Admin console
The record was generated but not added to the domain "After you create a DKIM record, you must add the record (which contains the DKIM key) to your domain." The Authenticate email page
Authentication was never started After a record is created and added, a "Not authenticating" error means "you need to complete your setup." The status line on the Authenticate email page
The key was cut short at the domain host "You can not enter a 2048-bit key as a single text string with a 255-character TXT record limit." The record at the domain host differs from the Admin console value
The message was changed after it was signed "some outbound gateways add a footer to the bottom of every outgoing message. This can cause DKIM to fail" body hash did not verify next to the dkim entry in Authentication-Results
Forwarding "Even when DKIM is correctly set up for your domain, forwarded messages can fail DKIM." Forwarded copies of messages
More than 5 signatures "Gmail checks only the first 5 signatures listed in the Authentication-Results: message header." The signature that authenticates the domain is sixth or later

Prove the cause before changing anything

Every step here reads and changes nothing.

  1. Read the bounce. Write down the code (421 4.7.30 or 550 5.7.30) and the sending system.

  2. Check whether the domain has a DKIM record. This step applies if the domain sends with Google Workspace. In the Google Admin console go to Menu, then Apps, then Google Workspace, then Gmail, then Authenticate email, and in the Selected domain menu choose the domain. Google's troubleshooting page says that blank values for the DNS hostname and the TXT record mean the domain has no DKIM record. If the domain does not send with Google Workspace, Google says to use "a tool available from the internet" to check.

  3. Read the status line on the same page. Google's wording for a finished set-up is "Authenticating email with DKIM." A "Not authenticating" error after the record was created and added means set-up was not completed.

  4. Compare the record at the domain host with the Admin console value. Google's page describes this: take the DNS TXT record name from the Admin console, for example google._domainkey, open the Dig tool in Google Admin Toolbox, choose TXT, enter the name followed by a period and the domain name (google._domainkey.example.com), and compare the result with the Admin console value. If all key characters are included and in the correct order, the key can be in 2 parts.

  5. Read the header of a message that arrived. Send a message from the domain to a Gmail address, open it, and next to Reply click More, then Show original. Google says the DKIM result should say something like "DKIM=pass or DKIM=OK", and that if the header has no line about DKIM, the messages are not signed. If the dkim entry in Authentication-Results says body hash did not verify, Google's page says the message was modified in transit. Google Admin Toolbox also has a Messageheader tool, into which the copied header can be pasted to read the DKIM status.

  6. Count the signatures. Gmail checks the first 5 signatures in the order they appear in the Authentication-Results header. A message passes only if the authenticating signature is one of them.

Fix

Three changes can turn DKIM on, and each one applies only when the proof section shows its fault. Google's Set up DKIM page puts them in this order: generate a key, add it to the domain, then start authentication. On Google Workspace, "after you turn on Gmail for your organization, you must wait 24–72 hours before you can get your DKIM key in the Admin console." Trying earlier "might get an error that the DKIM record was not created."

Change 1: generate the key (only when the values are blank)

Write down that the DNS Host name and TXT record value for the domain were blank, the status line shown, and the time.

Risk: the next step generates a DKIM key for the domain and updates its Authenticate email settings. Do this step only when the proof section showed blank values. Do not click Start authentication in this step; Google's page says to do that later. Google's page carries no step that removes a generated key.

In the Admin console, go to Menu, then Apps, then Google Workspace, then Gmail, then Authenticate email, and choose the domain in the Selected domain menu. Click Generate New Record. Choose the key length: 2048 if the domain provider supports 2048-bit keys, or 1024 if not. Keep the default prefix selector, google, unless the domain already uses a DKIM key with that prefix. Click Generate. Copy the DNS Host name (the TXT record name) and the TXT record value that the page now shows.

To stop here: leave the generated key in the Admin console and do not publish its TXT record or start authentication. Generating a key changes the Admin console; it does not by itself add a DNS record.

Change 2: add the record at the domain host

Write down any text records that the domain host already shows at the DKIM host name, and the time. If there are none, write down that there are none.

Disruptive step: the next step changes the DNS of the domain. Google says it can take up to 48 hours for DKIM authentication to start working after a key is added. Removing a new record soon after adding it breaks the authentication: Google recommends waiting at least 4 days before removing a new DKIM text record.

At the domain host, go to the page where the DNS text records are updated and add a record. The type is TXT. For the host, enter the prefix selector followed by ._domainkey, for example google._domainkey. For the value, enter the TXT record value copied from the Admin console; it is formatted v=DKIM1; k=rsa; p= followed by the key. Save the change.

To undo it: set the records at that host name back to the values you wrote down.

Disruptive step: if you wrote down that there were none, the next step deletes the record you added. Google's page on turning off DKIM says that removing a record immediately after adding it makes messages signed with DKIM fail authentication, and recommends waiting at least 4 days.

Only in that case, and only after Google's minimum wait of 4 days: delete the record you added.

Change 3: start authentication

Write down the status line shown on the Authenticate email page, and the time.

Disruptive step: the next step switches DKIM signing on for outgoing mail from the domain, so it follows Change 2 and the wait that Google gives. Google's steps place it after the record is added to the domain.

In the Admin console, go to Authenticate email, choose the domain, and click Start authentication. Google says that when the set-up is complete and working, the status line changes to "Authenticating email with DKIM".

To undo it: on the same Authenticate email page, click the Stop authentication button, which is the step Google's page on turning off DKIM gives.

Disruptive step: the Stop authentication button switches off DKIM signing for outgoing mail from the domain. Google's page says "We don't recommend turning off DKIM for your domain." It also advises leaving the DKIM text record in place, which "won't impact your email delivery, and makes it easier for you to turn DKIM back on".

What Google's pages say about the other causes

These are descriptions of Google's pages, not steps.

  • A 2048-bit key at a provider with a 255-character limit. The page says to split the key characters into multiple text strings, put each string inside quotes and enter the strings one after another in the Value field, or to select a 1024-bit key when generating, or to ask the domain host whether longer text records are supported.
  • An outbound gateway that changes messages. The page says to make sure the gateway does not modify outgoing messages before they are sent, because adding a footer changes the contents after signing.
  • Forwarded mail. The page's advice for recipients is to use Email Log Search to find whether the message was forwarded, and to contact the service that forwarded it.
  • A domain that does not use Google Workspace. The page says not to use the DKIM length tag (l=) in outgoing messages: "Messages using this tag are vulnerable to abuse."

Confirm the fix

  • Wait for the delay Google states: up to 48 hours after the key is added.
  • On the Authenticate email page, the status line should read "Authenticating email with DKIM".
  • Send a message from the domain to someone using Gmail or Google Workspace. Google says "You can't verify DKIM is on by sending yourself a test message." In the recipient's header, the result next to dkim in Authentication-Results should say "DKIM=pass or DKIM=OK".
  • Send again from each system that sends for the domain to the recipients that bounced, and check that no new 5.7.30 or 4.7.30 answer arrives.

What to watch afterwards

  • Each domain needs its own key. Google's page says: "You must get a unique DKIM key from the Admin Console for each domain."
  • Outbound gateways. Google's page says to verify that gateway settings do not interfere with DKIM.
  • Key length. The guidelines page requires 1024 bits or longer and "we recommend using a 2048-bit key if your domain provider supports this."
  • The other authentications. For senders of more than 5,000 messages a day Google lists SPF, DKIM and DMARC; a DMARC fault has its own answer, described in Gmail 550 5.7.26.

Risks and limits

Google advises against removing the record from Change 2 within its first 4 days, so each change is made only when the proof section shows its fault.

For a domain that does not send with Google Workspace the Admin console steps do not apply; Google's page says to generate the key pair with a tool from the internet and store the private key in the mail server configuration. Google says it does not provide technical support for third-party domain providers.

Sources