Errors

5.7.23: SPF validation failed, what it means and how to fix it

Short answer

5.7.23 is the enhanced status code for "SPF validation failed". The receiving server checked the envelope sender's SPF record, the sending IP was not authorized, and local policy said to reject. Microsoft 365 reports it as "The message was rejected because of Sender Policy Framework violation". Fix it by adding every service that sends for your domain to one SPF record, keeping it under 10 DNS lookups, and using a return path you control.

Last checked 16 November 2026

A 5.7.23 bounce means the receiving mail server checked your message against SPF, the check failed, and the server’s policy is to reject it. The sending IP was not in the SPF record of the domain in the envelope sender (the return path). The fix is in your DNS, not in the message.

The error message

Microsoft 365 lists this code in its NDR reference with this description:

550 5.7.23 The message was rejected because of Sender Policy Framework violation

Other servers use their own wording after the code, for example SPF validation failed or SPF check failed. The code is the part to go by.

What it means

RFC 7372 registers X.7.23 as “SPF validation failed”: the message completed an SPF check that produced a fail result, contrary to local policy. It replaces the older generic 5.7.1 that RFC 7208 suggests for SPF rejections. A fail result is the domain owner’s explicit statement that this IP is not allowed to send for the domain, so the receiver has a clear reason to refuse.

Why it happens

  • A sending service is missing from SPF. You added a new email provider, CRM or helpdesk and never added its include: to your record.
  • The record has an error. Two v=spf1 records on one name, a typo in a mechanism, or more than 10 DNS lookups produce a permerror. Some servers report that under 5.7.23 too, which is why people search for “5.7.23 spf failure permerror”. Strictly, the registry code for an SPF error is X.7.24.
  • The return path is not yours. SPF checks the envelope sender domain, not the visible From address. If a provider uses its own bounce domain, your SPF record is never consulted.
  • Microsoft 365 routed the message through its high risk pool. Microsoft’s own fix page notes that outbound mail it classifies as spam goes through the High Risk Delivery Pool, and those messages won’t pass SPF at the destination.
  • On-premises servers relaying through Microsoft 365 whose IPs are not in the SPF record.

How to fix it

  1. Read the diagnostic part of the bounce. Microsoft says the “Diagnostic information for administrators” section contains the original error from the destination server. Note the domain and IP it names.
  2. Look up your SPF record. Run dig TXT yourdomain.com +short and confirm there is exactly one record starting with v=spf1.
  3. Add every sender. One record, all services, one all at the end:
    yourdomain.com.  TXT  "v=spf1 include:spf.protection.outlook.com include:_spf.google.com -all"
    Use only the includes for services you actually use. Each provider publishes its own.
  4. Stay under 10 lookups. Every include, a, mx, ptr, exists and redirect costs one. See SPF too many lookups if you are over.
  5. Use a custom return path with your sending provider so SPF is checked against a subdomain you control, then add DKIM and DMARC so one failed check does not sink the message. The SPF, DKIM and DMARC setup guide has the full order.
  6. For Microsoft 365 tenants, check whether the message was flagged as outbound spam, and make sure all your sending domains are added to the tenant.

Which server sent it

Provider What you see
Microsoft 365 / Exchange Online 550 5.7.23 with the Sender Policy Framework text above. Microsoft generates it when the destination refused your outbound mail.
Gmail Gmail does not use 5.7.23 for SPF. It uses 550 5.7.26 (SPF hard fail or no authentication) and 550 5.7.27 (bulk senders failing SPF). See 550 5.7.26.
Yahoo Yahoo groups this under authentication failures on its SMTP error codes page without listing 5.7.23 by number.
Generic servers Any server following RFC 7372 can return 5.7.23 for an SPF fail.

Is it temporary?

No. It starts with 5, so it is a permanent failure. Retrying the same message from the same IP gives the same result. Change your SPF record or your return path, wait for DNS to update (the record’s TTL), then send again. An SPF temperror (a DNS timeout) is different and usually comes back as a 4xx deferral that your server retries on its own.

How Mailcandor handles it

Mailcandor’s deliverability coach explains each bounce in plain English, so a 5.7.23 shows up as an SPF problem with the domain it applies to, and its DNS check tells you whether SPF, DKIM and DMARC are in place. Every domain gets a return path on send.<domain>, so SPF is checked against a name you control. Hard bounces are added to your suppression list automatically. To decode any other code, use the free bounce code lookup, or browse the full error code library. More free checks are on the tools page.

Questions

What does 550 5.7.23 mean?

The receiving server checked SPF for your message, the result was fail, and its policy is to reject such mail. The IP that sent the message is not listed in the SPF record of the envelope sender's domain.

Is 5.7.23 a Microsoft error or a standard code?

Both. RFC 7372 registers X.7.23 as "SPF validation failed", and Microsoft 365 uses 550 5.7.23 in its bounce messages when the destination rejected your mail for an SPF problem.

What about "5.7.23 SPF failure permerror"?

Permerror means your SPF record could not be read correctly, usually because of a syntax error, two SPF records or more than 10 DNS lookups. The registry code for an SPF error is X.7.24, but some servers report it under 5.7.23. Fix the record either way.

Should I retry after a 5.7.23 bounce?

Not until you change your DNS. It is a permanent failure, so the same message from the same IP will fail again.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.