Microsoft 365 DMARC rejecting inbound mail behind a gateway
When a gateway sits in front of Exchange Online, Microsoft 365 sees the gateway's IP, so SPF fails and senders with DMARC p=reject, such as Zoom, get blocked. Fix it with an inbound connector, Enhanced Filtering for Connectors, and a gateway that preserves DKIM or signs ARC. Do not allowlist the senders.
Sohail Hussain11 min readShort answer
- Your gateway is the last hop before Exchange Online, so SPF is checked against the gateway's IP and fails for senders that publish p=reject.
- Create a Partner inbound connector for the gateway, then turn on Enhanced Filtering for Connectors (skip listing) so Microsoft looks past the gateway to the real sending IP.
- Then make sure the gateway does not break DKIM, and ideally has it seal messages with ARC that you list as trusted.
You have a backup MX or filtering gateway (FRITZ in the original report, but Mimecast, Proofpoint, Barracuda and hosting-provider filters behave the same) in front of Microsoft 365. Mail from a sender with a strict DMARC policy, such as Zoom with p=reject, gets blocked, while mail from other senders arrives fine.
Why it happens
When your MX record points at a gateway, the connection that reaches Exchange Online comes from the gateway, not from Zoom. SPF checks the connecting IP against the sender's SPF record, and your gateway is not in Zoom's record. Microsoft's own guidance describes the same effect: in this kind of routing the connector's source is typically not the true indicator of where the message came from (Microsoft Learn, Enhanced Filtering for Connectors).
DMARC passes when either SPF or DKIM passes and aligns with the From domain. So the causes, most common first, are:
| Cause | Symptom in headers | Fix |
|---|---|---|
| Enhanced Filtering not enabled | spf=fail or softfail, connecting IP is your gateway | Enable Enhanced Filtering on the inbound connector |
| Gateway modifies the message | dkim=fail along with SPF failing | Stop the modification, or use ARC and trusted sealers |
| Connector exists but does not match the gateway | Mail not tied to the connector in message trace | Fix the IP list or certificate name on the connector |
| Extra internal hops not skipped | Skip list set, SPF still evaluates a gateway IP | Add every public intermediate hop |
| Gateway not ARC-sealing, or sealer not trusted | arc=none, or arc=pass with oda=0 | Enable ARC at the gateway, add the d= domain as trusted sealer |
For a p=reject sender, Microsoft's DMARC documentation says the message is rejected during SMTP with 550 5.7.1, and the header shows dmarc=fail action=oreject (Microsoft Learn, DMARC setup).
DKIM should survive a relay in principle, because it signs headers and body. It breaks when the gateway changes the message: a subject tag such as [EXTERNAL], an appended footer, rewritten links or re-encoded content.
Confirm that a gateway is your cause
Open a message that got through (or the bounce for one that did not) and read Authentication-Results. Paste the headers into our email header analyzer if the chain is hard to read; our guide to understanding email headers explains the fields.
spf=failorspf=softfail, with a connecting IP that belongs to your gateway.dkim=failordkim=none.dmarc=failwith a reject or quarantine action.- A
Receivedchain where the hop just beforeprotection.outlook.comis your gateway. - An MX record for your domain that does not point to
*.mail.protection.outlook.com.
If the connecting IP is the real sender's, a gateway is not the problem; look at the sender's DNS.
Microsoft says Enhanced Filtering is intended for setups where the MX record does not point to Microsoft 365 (Microsoft Learn). If your MX already points at Microsoft, skip to "Alternative: remove the hop" below.
Step-by-step fixes
Fix 1: create a Partner inbound connector for the gateway
Without a connector, Exchange Online treats the gateway as an anonymous internet sender. Microsoft's guidance for third-party filtering is to create a Partner inbound connector, preferably identified by a TLS sender certificate name, or otherwise by sender IP addresses, and to restrict the connector to that certificate or those IPs (Microsoft Learn, third-party cloud service).
- Open the Exchange admin center and go to Mail flow > Connectors.
- Choose Add a connector, set Connection from to Partner organization and Connection to to Office 365.
- Name it clearly, for example
Inbound from gateway. - Identify the gateway by certificate subject name (preferred) or by sender IP addresses. Get both from your gateway vendor's documentation.
- Require TLS if the gateway supports it.
- Save and confirm the connector is on.
The PowerShell equivalent from Microsoft's documentation looks like this (replace the placeholder with your vendor's certificate name):
New-InboundConnector -Name "Inbound from gateway" -ConnectorType Partner -SenderDomains * -RestrictDomainsToCertificate $true -TlsSenderCertificateName *.gateway.example -RequireTls $true
Fix 2: turn on Enhanced Filtering for Connectors
This is the setting that fixes the SPF evaluation. It preserves the source IP from the previous hop (Microsoft Learn).
- In the Microsoft Defender portal, go to Email & Collaboration > Policies & Rules > Threat policies > Rules > Enhanced filtering. Microsoft also gives a direct page at
https://security.microsoft.com/skiplisting(Microsoft Learn). - Select the inbound connector you created.
- Under IP addresses to skip, choose Automatically detect and skip the last IP address if the gateway is the only hop; Microsoft recommends that value when only the last source must be skipped (Microsoft Learn). Otherwise choose Skip these IP addresses that are associated with the connector and list them.
- Under Apply to these users, pick Apply to a small set of users for a first test, then Apply to entire organization. Microsoft recommends testing on a few recipients first (Microsoft Learn).
- Save, then send a test from a strict-DMARC sender and check that the header shows the real sender IP and
spf=pass.
PowerShell does the same job. These parameters are documented for Set-InboundConnector: -EFSkipIPs lists the IPs when -EFSkipLastIP is $false, and -EFSkipLastIP $true skips only the last source (Microsoft Learn, Set-InboundConnector).
Set-InboundConnector -Identity "Inbound from gateway" -EFSkipLastIP $false -EFSkipIPs 203.0.113.10,203.0.113.11
Skip only your own hops
List only systems that handle your organization's mail before Microsoft 365. Microsoft 365 IP addresses are not supported, and private or loopback ranges are skipped automatically. Include every intermediate hop that has a public IP.
Two details people miss. First, if you scoped Enhanced Filtering to specific users, it applies only to messages where all recipients are in that list; one outside recipient means normal filtering for the whole message (Microsoft Q&A answer). Second, after enabling it, disable any mail flow rules that bypass spam filtering (SCL -1) for mail through that connector, with a few exceptions Microsoft lists (Microsoft Learn).
Fix 3: stop the gateway from breaking DKIM
SPF is now handled, but DKIM is your second line. Check the gateway for anything that edits inbound messages:
- Turn off subject tagging for external mail.
- Turn off footers and disclaimers on inbound mail.
- Turn off URL rewriting for trusted senders, or exempt them if the vendor allows it.
Microsoft notes that Enhanced Filtering also tries to recover from DKIM signature failures when a service modifies the message and does not support ARC (Microsoft Learn). That is a safety net, not a reason to leave the gateway rewriting content.
Fix 4: have the gateway seal with ARC, and trust it
ARC records the authentication results the gateway saw before it changed the message. Microsoft's troubleshooting page ranks configuring ARC on the gateway as the recommended option for a gateway that breaks authentication, with Enhanced Filtering and DKIM re-signing as the others (Microsoft Learn, troubleshoot email authentication). ARC is specified in RFC 8617, but Microsoft only honors sealers you list.
- Send a test message through the gateway to a Microsoft 365 mailbox.
- Open the headers and find
ARC-Seal. Note thed=value. It is the vendor's signing domain, not your own (Microsoft Learn, trusted ARC sealers). - In the Defender portal, open Email authentication settings (
https://security.microsoft.com/authentication), select the ARC tab and add the domain. - Or use PowerShell:
Set-ArcConfig -Identity Default -ArcTrustedSealers "gateway-domain.example"
The list is replaced, not appended
The ArcTrustedSealers parameter replaces all existing entries. Run Get-ArcConfig first and include every sealer you already trust. Add only vendors you actively use.
If a header shows arc=pass but oda=0, the sealer domain is not in the trusted list. If it shows arc=none, the gateway is not sealing; Microsoft's page lists where Proofpoint, Mimecast, Barracuda and Sophos enable ARC, and as of this writing they differ by vendor, so check the current page (Microsoft Learn).
What not to do
- Do not allowlist the sender or gateway to bypass filtering. It stops the rejection but also removes phishing and spoofing checks. Microsoft's guidance says to prefer Enhanced Filtering over bypassing with a mail flow rule (Microsoft Learn).
- Do not change your own DMARC policy. It governs how others treat mail from your domain, not how you evaluate mail from Zoom.
- Do not ask for the gateway IP in Zoom's SPF record. You do not control their DNS, and it would not scale.
Alternative: remove the hop
If the gateway adds little, for example it is only a backup MX, point your MX record straight at Exchange Online. SPF then sees the real sender and no skip listing is needed. Find the exact MX value for your domain in the Microsoft 365 admin center's DNS settings for that domain.
If you keep the gateway, restrict Exchange Online to accept mail only from it, using the connector restrictions above, so nobody can bypass the gateway by sending straight to Microsoft. For background on your own records, see our DMARC generator and the guide to setting up SPF, DKIM and DMARC.
Checklist before you try again
- The MX record points to the gateway, and you know its outbound IPs or certificate name.
- The Partner inbound connector is on and message trace shows test mail matching it.
- Enhanced Filtering is enabled on that connector, with all public intermediate hops covered.
- SCL -1 bypass rules for this mail are removed.
- Gateway subject tags, footers and link rewriting are off for inbound mail.
- ARC sealing is on at the gateway, and the
d=domain is in the trusted sealers list. - A fresh test from a
p=rejectsender shows the real sender IP andspf=passor an aligneddkim=pass.
If nothing works
Contact Microsoft support (Exchange Online) or your gateway vendor. Send the full headers of one failing message, its message trace ID, a timestamp with time zone, the connector name, and what you already changed. Ask the vendor whether internal hops add extra Received headers.
Subject: Inbound DMARC failure behind third-party gateway, Enhanced Filtering enabled
Our MX points to {gateway-name}, which relays to Exchange Online.
Mail from {sender-domain} (DMARC p=reject) is rejected with 550 5.7.1.
Inbound connector: {connector-name}, Enhanced Filtering enabled on {date}.
Message trace ID: {id} Timestamp: {UTC time}
Authentication-Results shows: spf={result} dkim={result} dmarc={result} arc={result}
Connecting IP seen by Exchange Online: {ip}
Steps tried: skip listing (last IP / IP list), trusted ARC sealer {domain}, subject tags and footers disabled.
Please confirm which hop Exchange Online treats as the source and why skip listing is not applied.
Common questions
Does Enhanced Filtering work if my MX already points to Microsoft 365?
It is not meant for that case. Microsoft describes it for setups where the MX record does not point to Microsoft 365, and says it is not intended for services that scan mail after Microsoft 365 (Microsoft Learn).
Do I need both Enhanced Filtering and ARC?
Not always. Enhanced Filtering restores the source IP for SPF and tries to recover DKIM failures. ARC is the cleaner option when the gateway modifies messages, and Microsoft lists both among its recommendations.
Why did Zoom mail fail but other mail arrive?
Senders with p=none or no DMARC record are not rejected on a DMARC failure, so the same SPF failure goes unnoticed. Strict p=reject senders expose it first.
How long until the change applies?
Microsoft does not give a fixed time in the pages I checked. Test with a fresh message after saving, and check the header on that new message rather than an old one.
Explore: Email Deliverability
Related Articles
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.
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.
535 5.7.139 Authentication unsuccessful: Microsoft 365 SMTP fixes
535 5.7.139 means Microsoft 365 refused the SMTP login even though the password may be right. The usual cause is that Authenticated SMTP is disabled for the mailbox or tenant, or Security Defaults blocks basic auth. Enable SMTP AUTH per mailbox, adjust Security Defaults or Conditional Access, use OAuth, or switch to a connector.
550 5.7.1 Message lacks SPF/DKIM/DMARC: Find the Real Cause
Outlook.com and Hotmail return "550 5.7.1 Message rejected: Message lacks SPF/DKIM/DMARC Auth Records" when a message fails their authentication checks. Valid SPF alone is not enough. Publish SPF, DKIM and an enforced DMARC policy for your From domain, then confirm the real cause in Message Trace.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free