Fix Exchange Online Hybrid Mail Loops and Hop Count Errors
Question details
Resolve external mail delivery failures after moving a mailbox from Exchange 2010 to Exchange Online.

- Product
- Exchange Online and Exchange Server 2010 hybrid
- Device & OS
- not provided
- Scenario
- A mailbox has been moved to Exchange Online in a hybrid environment, while other mailboxes remain on Exchange 2010.
- Observed behavior
- External messages to the moved mailbox fail with a hop count exceeded or possible mail loop error. The non-delivery report references an onmicrosoft.com address and an SPF failure.
Collect the complete non-delivery report, including its diagnostic headers, and identify an affected recipient and message timestamp. Confirm that you have the permissions needed to review Exchange Online and on-premises mail flow settings.
Trace and correct hybrid routing for the moved mailbox
Use this method to find where mail is looping and correct the hybrid configuration before moving more mailboxes.
In the Exchange admin center, open Mail flow > Message trace and search for the affected recipient and message time. Compare the trace with the non-delivery report to identify whether mail is repeatedly passing between Exchange Online and the on-premises server.
In the on-premises Exchange Management Shell, run Get-RemoteMailbox -Identity "user@example.com" | Format-List RemoteRoutingAddress. Confirm that the address uses the tenant's actual hybrid routing domain, commonly tenant.mail.onmicrosoft.com, and points to the intended Exchange Online mailbox.
If the remote routing address is wrong, use Set-RemoteMailbox -Identity "user@example.com" -RemoteRoutingAddress "user@tenant.mail.onmicrosoft.com" with the verified address for your tenant. Allow directory synchronization to complete, then check the recipient again.
Open the Hybrid Configuration Wizard from a supported Exchange management environment and verify that the selected Microsoft 365 cloud and configuration options match your tenant. Rerun the wizard if the hybrid configuration needs repair; check current Microsoft support requirements first because Exchange 2010 is out of support.
In the Exchange admin center, review Mail flow > Connectors and Mail flow > Accepted domains. In the on-premises Exchange Management Console or Exchange Management Shell, review the corresponding send connectors and accepted domains; verify that routing to the hybrid domain does not send mail back to the original hop.
Send test messages to the moved mailbox from an external account and from an on-premises mailbox, and test outgoing mail. Review Message trace and any new non-delivery reports before moving additional users or changing the MX record.

Investigate the SPF failure in the non-delivery report
Use this check when the report also mentions SPF, while treating the routing loop as a separate issue.
Document Your Exchange Troubleshooting in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for documenting mail-flow investigations and sharing results. It supports common Microsoft Office formats for an easier move between office suites. WPS Office does not repair Exchange connectors or mail routing.

Frequently Asked Questions
What does a hop count exceeded error mean?
The message passed through too many mail servers or routing hops and was rejected as a possible loop. Use Mail flow > Message trace in the Exchange admin center and the non-delivery report to find the repeated route.
Which remote routing address should a moved mailbox use?
It should use an address in the tenant's verified hybrid routing domain, commonly tenant.mail.onmicrosoft.com. Check it with Get-RemoteMailbox in the on-premises Exchange Management Shell rather than assuming the tenant's default onmicrosoft.com domain is correct.
Should I change the MX record to stop the loop?
Not as a first step. Trace the message and verify the remote routing address, connectors, and accepted domains. Test internal and external mail flow before making an MX change.
Does an SPF failure mean the SPF record caused the mail loop?
Not necessarily. Check the domain named in the SPF result and its authorized senders, but investigate repeated routing separately. If the domain belongs to an external sender, its administrator must review its SPF record.




