Deliverability

DMARC Fails When SPF and DKIM Pass: Fix Alignment (550 5.7.23)

DMARC needs SPF or DKIM to pass and the passing domain to match your visible From domain. When both pass for a different domain (a vendor's bounce domain, a Mailgun subdomain), DMARC still fails. Sign DKIM with your From domain; one aligned DKIM signature is enough.

Sohail HussainSohail Hussain9 min read

Short answer

  • DMARC does not ask whether SPF or DKIM passed. It asks whether the domain that passed matches the domain in the visible From address.
  • Make DKIM sign with your From domain or a subdomain of it. One aligned DKIM pass is enough for DMARC.
  • Check the headers for header.d and smtp.mailfrom. If neither is on your domain, set up custom DKIM at the sending service.

You open the headers and see spf=pass and dkim=pass, yet the same block says dmarc=fail. Or the bounce reads 550 5.7.23 The message was rejected because of Sender Policy Framework violation, followed by 550 5.7.1 Email rejected per DMARC policy. Both checks passed for some domain, just not yours.

Why it happens when SPF and DKIM pass

DMARC passes when at least one of two checks passes with alignment:

  • SPF passes and its domain (the envelope sender, also called Return-Path or MAIL FROM) matches the From domain.
  • DKIM passes and the d= domain in the signature matches the From domain.

The aspf and adkim tags set what "matches" means. Relaxed mode is the default and compares organizational domains, so mg.example.com aligns with example.com. Strict mode requires an exact match. RFC 7489 defines these rules.

This header passes every individual check and still fails DMARC:

From: news@example.com
Return-Path: <bounce+abc@bounce.secureserver.net>
Authentication-Results: mx.google.com;
  spf=pass smtp.mailfrom=bounce.secureserver.net;
  dkim=pass header.d=secureserver.net;
  dmarc=fail header.from=example.com

SPF and DKIM both passed for secureserver.net, and neither is example.com. Both results are valid; neither is aligned.

The two bounce lines mean different things. Per RFC 7372, 5.7.23 means SPF validation failed at the receiver. The 5.7.1 ... per DMARC policy text means the receiver applied your p=quarantine or p=reject policy. If you only see 5.7.23, read the SPF result before assuming alignment. Wording varies by receiving server.

Confirm that alignment is your problem

  1. Open a delivered copy or the bounce and view the full headers. In Gmail, use Show original.
  2. Find the Authentication-Results header.
  3. Write down three domains: header.from, smtp.mailfrom (SPF) and header.d (DKIM).
  4. If neither smtp.mailfrom nor header.d shares an organizational domain with header.from, you have an alignment failure.

You can paste the headers into our email header analyzer to have them parsed. Your DMARC aggregate reports show the same result per sending source. For background, see the DMARC glossary entry and our SPF, DKIM and DMARC setup guide.

Causes at a glance

CauseWhat the headers showFix
Third-party sender uses its own domainheader.d and smtp.mailfrom are the vendor'sSet up custom DKIM at the vendor
Mailgun domain differs from From domainheader.d is an unrelated domainAdd the From domain in Mailgun
Strict alignment with a subdomain senderSubdomain passes, DMARC failsUse adkim=r or sign with the exact From domain
Workspace secondary domainheader.d is not the From domainGenerate a DKIM key per domain
Microsoft 365 without custom DKIMheader.d ends in onmicrosoft.comEnable DKIM for the custom domain
Forwarding or mailing listSPF fails or driftsRely on aligned DKIM

Fix 1: make a third-party sender sign with your domain

This is the most common case. People on community forums report it with GoDaddy's bounce.secureserver.net: the service uses its own domain for both the envelope sender and the DKIM signature.

  1. In the sending service, find its domain authentication setting. Names vary: "domain authentication", "sender authentication" or "custom DKIM".
  2. Add your sending domain and copy the DNS records it gives you, usually a CNAME or TXT record for the DKIM selector.
  3. Publish the records at your DNS host.
  4. Use the vendor's verify button to confirm they are live.
  5. Send a test and confirm header.d is now your domain.
selector1._domainkey.example.com.  CNAME  {value-from-your-vendor}

That is a pattern; copy the exact host and value from the vendor. If a vendor cannot sign with your domain at all, move that mail to a subdomain with its own policy, or stop sending From your domain through it. I would not weaken your policy for one stubborn tool.

Fix 2: Mailgun on a different domain than the From address

Mailgun signs with the domain you added and verified in its dashboard. If you added mg.example.com and send From news@example.com, relaxed alignment still passes. It fails when you added an unrelated domain, or send From a domain you never added.

  1. Confirm the From domain is the domain you added to Mailgun, or its parent.
  2. Confirm Mailgun shows the DKIM record as verified, and that the selector in live DNS matches the one in the message headers.
  3. Check your DMARC record for adkim=s. Strict mode breaks mg.example.com against example.com.
  4. In a delivered message, check that header.d is on your domain. If not, the message went out through a different Mailgun domain than you think.
  5. Optionally, set a custom return-path subdomain in your Mailgun domain settings so SPF aligns too. DKIM alone satisfies DMARC, so do this second.

Fix 3: Google Workspace secondary domain or alias

If you send From an address on a secondary domain or domain alias and never created a DKIM key for it, the signature will not be on that domain. It still passes DKIM, but it does not align with your From domain.

  1. In the Google Admin console, search for Authenticate email.
  2. In the domain selector, choose the secondary domain.
  3. Click Generate New Record and copy the host name and TXT value.
  4. Publish the TXT record at that domain's DNS host.
  5. Back in the Admin console, click Start authentication.
  6. Send a message to a Gmail address outside your organization and check that header.d is the From domain.

Make sure the secondary domain also has its own SPF and DMARC records. Google's help page on setting up DKIM has the full current steps.

User alias vs domain alias

An alias on your primary domain, such as sales@example.com, signs with the primary domain and is not affected. Only mail sent From a different domain needs its own key.

Fix 4: Microsoft 365 and "ARC shows pass"

When Microsoft 365 is the sender, turn on DKIM for each custom domain in the Microsoft Defender portal (search for DKIM under email authentication settings). Publish the two CNAME records Microsoft gives you, then enable signing. Until you do, mail is typically signed with your onmicrosoft.com domain, which does not align with your From domain.

Some admins see arc=pass and expect acceptance. ARC records authentication results from earlier hops so forwarders can preserve them. It does not make a failing DMARC result aligned, and each receiver decides whether to trust a given ARC chain. If the final result is dmarc=fail and your policy is reject, ARC will not rescue the message.

Fix 5: SPF after forwarding, and the ~all question

SPF alignment compares the envelope sender, not the From header. Forwarders and mailing lists often replace the envelope sender or send from IPs you never listed, so SPF fails or drifts. DKIM survives forwarding as long as the signed content is not modified, so depend on aligned DKIM.

  • If DMARC does the enforcing, end SPF with ~all rather than -all. A hard SPF fail can make some receivers reject before DMARC is evaluated.
  • Stay under 10 DNS lookups. Going over returns permerror, which counts as a fail.
example.com.  TXT  "v=spf1 include:_spf.google.com include:mailgun.org ~all"

Our SPF generator and SPF lookup count calculator help here.

Keep a monitoring record while you work

A record that reports failures without blocking mail:

DNS TXT Record
Type:TXT
Host:_dmarc
Value:v=DMARC1; p=none; rua=mailto:dmarc@example.com

Our DMARC generator builds the string.

Do not jump to p=reject

Moving to quarantine or reject before every legitimate sender is aligned is how invoices and password resets end up bounced. Stay on p=none until your reports are clean.

Checklist before you send another test

  • header.d in the delivered message is your From domain or a subdomain of it.
  • The DKIM record is live in DNS and the sender shows it as verified.
  • Your DMARC record does not set adkim=s or aspf=s unless you want exact matches.
  • Every domain you send From has its own DKIM key.
  • SPF is under 10 lookups and includes every legitimate sender.
  • You tested to an outside mailbox, not to yourself.

If nothing works

If header.d shows your domain and DMARC still fails, contact the sending provider first, then the receiving mail admin if you can reach them. Include the full raw headers, the exact bounce text, the timestamp with timezone, the sending IP, your published DMARC record, and whether the receiver is a forwarder or mailing list.

Subject: DMARC fails although SPF and DKIM pass (alignment)

Our message from news@example.com to {recipient} at {timestamp, timezone}
was rejected with: 550 5.7.1 Email rejected per DMARC policy.
Headers show spf=pass smtp.mailfrom={domain} and dkim=pass header.d={domain},
but dmarc=fail header.from=example.com.
Sending IP: {ip}. Published DMARC: {record}.
We have published DKIM for example.com at selector {selector}.
Please confirm the message is signed with d=example.com and tell us
what else could break alignment on your side.
Full raw headers attached.

Where Mailneo fits

Mailneo sends through the mailboxes and providers you connect, so alignment is decided by your DNS and your provider's setup. Mailneo cannot change either. It can check your sending domain's SPF, DKIM and DMARC records for a connected account and show what needs fixing (see email accounts); you publish the changes at your DNS host.

Common questions

Do I need both SPF and DKIM aligned?

No. DMARC passes with one aligned pass from either. Aligned DKIM is the safer choice because it survives forwarding.

Does an ARC pass override a DMARC fail?

No. ARC preserves earlier results, but each receiver decides whether to trust the chain, and it does not make your identifiers aligned.

Why does DMARC pass at one receiver but fail at another?

Receivers differ in forwarding handling, ARC trust and when they evaluate SPF. Compare the Authentication-Results from both copies to find which domain differs.

Is 5.7.23 always an alignment problem?

No. It means SPF validation failed at the receiver, which can come from a missing sending IP, too many lookups or forwarding. Read the SPF result in the headers first.

deliverabilitymailgungoogle-workspacemicrosoft-365error-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

Deliverability

550 permanent failure for one or more recipients (blocked)

The error `550 permanent failure for one or more recipients (person@domain.ca:blocked)` means the recipient's mail system refused your message. It is usually a block on their side (a gateway rule, a missing user, or a stale Outlook autocomplete entry), not broken SPF or DKIM on your domain. Check your authentication once, then work the recipient side.

Sohail Hussain|9 min read
Deliverability

421-4.7.0 Try again later, closing connection (EHLO): fix

The error "421-4.7.0 Try again later, closing connection. (EHLO)" means Google's SMTP server is temporarily refusing your session, usually because of connection volume, a low-reputation IP, or a weak relay setup. Slow down, reuse one connection, queue with retries, authenticate, and send a real EHLO hostname.

Sohail Hussain|11 min read
Deliverability

421 4.7.28 Gmail Unusual Rate of Unsolicited Mail: Fixes

The 421 4.7.28 error is a temporary Gmail deferral, not a block. Gmail is rate limiting a domain, DKIM domain or IP range it sees sending too much unwanted mail. Retries usually deliver, but you should fix authentication, unsubscribe headers, sending pace and shared infrastructure to stop it recurring.

Sohail Hussain|9 min read
Deliverability

451 4.7.500 Server busy: SMTP2GO stuck at Processed (Microsoft)

`451 4.7.500 Server busy. Please try again later.` is a temporary Microsoft deferral of the connecting IP, not a problem with your message. SMTP2GO keeps retrying, so mail sits at "Processed" for hours. Ask SMTP2GO to rotate your IP, move to a dedicated IP, or allow-list carefully in Defender.

Sohail Hussain|9 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free