550 5.7.23 SPF validation failed: why your email bounced and how to fix it

What the 5.7.23 code means, how to read the bounce, and the SPF fixes, including the Microsoft 365 causes.

Your email bounced, and the bounce message contains 550 5.7.23. The wording around it varies from server to server, but the code itself has one meaning: the receiving server checked SPF for your message, the result was "fail", and its policy is to reject mail that fails.

In other words, the server that delivered your message isn't on your domain's list of allowed senders, and the receiver took your SPF record at its word. The fix is almost always in that list. This guide shows how to find which server is missing and how to add it.

Start with your SPF record. Rigcheck shows your record, checks it for errors and counts its DNS lookups.

What 5.7.23 means

The code is one of a set of email authentication status codes registered in RFC 7372. 5.7.23 is registered as "SPF validation failed": the SPF check ran and came back fail. It's different from its neighbor 5.7.24, "SPF validation error", which means the check couldn't finish, for example because the record is broken.

A fail result usually comes from a record that ends in -all (hard fail): any server not listed is declared unauthorized, and some receivers reject that mail on the spot, before looking at DKIM or DMARC. A record ending in ~all gives a soft fail instead, which receivers normally don't reject for on its own.

You'll see this code most often from Microsoft 365 (Exchange Online), which has its own help page for it, but any mail server can use it.

Step 1: Find out who rejected the message and why

Open the bounce and look for the technical section. In Microsoft 365 bounces it's headed Diagnostic information for administrators. Note three things:

  1. The server that rejected it. Is it your recipient's mail server, or your own provider refusing to pass it on?
  2. The sending IP address, if the bounce shows one. That's the server SPF judged.
  3. The domain SPF checked. SPF checks the hidden Return-Path (bounce address) domain, not necessarily the From address people see. If you can, look at a copy of a message that got through from the same service and find smtp.mailfrom= in its Authentication-Results header.

Then ask: which service sent this message? Your mailbox provider, a newsletter tool, your website's contact form, an app, a scanner in the office? The answer points to the cause below.

Step 2: Match the cause

The sending service isn't in your SPF record

This is the most common cause. Someone added a new tool that sends as your domain (a CRM, a help desk, a billing system, a website plugin), and its servers were never added to your SPF record. Mail from your main provider still works, so nobody notices until a receiver that rejects on SPF fail bounces the new tool's mail.

The fix is to add that service's include: (listed on its setup page) or its ip4: address to your existing record, before the all at the end:

Host@
TypeTXT
Valuev=spf1 include:spf.protection.outlook.com ip4:your web server's IP address -all

That example adds a website server that sends its own mail (contact forms, order emails) to a Microsoft 365 domain. Use your own includes and addresses. Add them to the record you have; don't create a second record that starts with v=spf1, which breaks SPF for all your mail (multiple SPF records explains how to merge).

Your provider's include is wrong or missing

Check that your mailbox provider's include is in the record and spelled exactly right. For Microsoft 365 it's include:spf.protection.outlook.com; for Google Workspace, include:_spf.google.com. A record copied from an old provider, or with a typo in the include, authorizes the wrong servers.

Your own servers aren't listed

If mail leaves through a server in your office or data center (an on-premises Exchange server in a hybrid setup, a scanner, a line-of-business app), its public IP address must be in your SPF record as ip4:. Microsoft's help page for this error lists it as a step: add your on-premises IP addresses to the SPF record of every domain you send for.

Microsoft 365 sent it from its high-risk pool

When Microsoft 365 decides an outgoing message is spam, it sends it through a separate set of servers called the high-risk delivery pool. Microsoft says messages sent that way won't pass SPF checks, so receivers that reject on SPF fail bounce them with 5.7.23 even though your SPF record is correct.

Signs of this: SPF is fine for your other mail, and the bounced messages look like bulk or unusual mail. An admin can confirm it with Message trace in the Exchange admin center, where the OutboundIpPoolName property shows which pool sent a message. Microsoft suggests setting up outbound spam policy notifications to get copies of messages it flags, and contacting Microsoft support if a message was flagged by mistake.

Microsoft 365 is sending for a domain you haven't added

Microsoft 365 limits how much mail a tenant can send from domains that aren't added and verified in it (Microsoft calls them unprovisioned). If you send or relay mail as a domain that isn't listed under Settings → Domains in the Microsoft 365 admin center, add and verify it.

The message was forwarded

When a message is forwarded, the forwarding server delivers it from its own address, which isn't in your SPF record. Microsoft 365 rewrites the bounce address on most forwarded mail (Sender Rewriting Scheme) to avoid this, but mail that already failed SPF when it arrived is sent from a separate relay pool without that rewriting. If only forwarded copies bounce, the forwarder's setup is the place to look, and DKIM for your domain is what lets your mail survive forwarding.

Step 3: Check the record and send a test

  1. Run your domain through the Rigcheck checker. Confirm there's one SPF record, that it includes every service that sends for you, and that it uses 10 DNS lookups or fewer. A record over 10 fails for every message; SPF too many DNS lookups shows how to get back under.
  2. Send a new message the same way as the one that bounced, to an address where you can view the headers, and look for spf=pass.
  3. Resend the bounced message. The receiver won't retry it on its own.

Should you switch -all to ~all?

It's a reasonable short-term fix while you find every service that sends for you: with ~all, unlisted servers get a soft fail, which receivers rarely reject for on its own. But it hides the real problem rather than fixing it. The lasting fix is a record that lists every sender, plus DKIM for your domain on every service, so DMARC can pass even when SPF doesn't.

Similar codes that mean something else

CodeWhat it means
5.7.24SPF validation error: the check couldn't finish, for example because of two SPF records or too many lookups.
5.7.515Outlook.com rejected the message because the domain doesn't meet Microsoft's authentication requirements for high-volume senders. See Fixing Outlook 550 5.7.515.
5.7.1A general "not allowed" rejection with many possible causes. Read the text after the code.

Check your SPF record now. Rigcheck lists every SPF record on your domain, counts the lookups and gives you the exact record to fix.

Check my setup

Browse all guides