Share via

Mail loop was detected after standing up Exchange Server Hybrid

Anonymous
2025-05-14T04:11:45+00:00

We have an on-premises Exchange organization set up in a hybrid configuration with EXO.

As soon as we established the hybrid we sent a test email to an external recipient (gmail.com) successfully. We then tested a message to an EXO mailbox (different company but recipient located in EXO) and received an NDR stating that the message was in a mail loop. The recipient does not receive the email.

We are using the classic topology for the hybrid.

If we establish an email from an EXO mailbox to any external recipient all is well.

If we establish an email from an EXO mailbox to another EXO mailbox, the message loops.

Bear in mind I am not talking about EXO mailboxes in the same tenant. I mean a message sent to an entire different organization that just happens to also be housed in EXO.

It is acting as if all messages sent to EXO recipients (even those in completely different tenants) 'flow though' our tenant before being delivered.

How do we know this? We created a rule that adds an SMTP header to messages. The rule in EXO marks a header with "M365". The rule on-premises marks the header with "ONPREM".

When sending a message from an ON-PREMISES mailbox to an EXO mailbox (completely different company), the header with "M365" is present.

When sending a message from an ON-PREMISES mailbox to any (non-EXO) recipient, the header with "ONPREM" is present.

We have tested this identical configuration with a different set of directories and do not see this looping behavior.

Please advise.

Microsoft 365 and Office | Install, redeem, activate | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2025-05-14T10:49:24+00:00

    Hello Trish. Thank you for your response.

    For clarity, my message stated that all EXO bound messages are looping, regardless of whether the email originated online or on-prem.

    We do not have centralized mail transport configured. This is a very standard setup.

    I will gather the necessary screen shots and update this thread.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2025-05-14T14:49:27+00:00

    EXO Connectors

    On-premises

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2025-05-14T14:42:10+00:00

    Hi Trish,

    I'm working alongside Jeff on this issue. I'll try to explain the routing the mail is taking. What we've determined first and foremost, this ONLY occurs when we send emails to other Microsoft 365 tenants. If we send emails to Google, Yahoo, Amazon, etc, that are not M365 tenants mailflow works perfectly with no looping.

    The looping occurs when the email message leaving the organization, whether its from on-prem Exchange or M365 tenant, the message is re-introduced into the M365 cloud and when that re-introduction is occurred, the message appears in the tenant as if the email HAS to be sent/re-sent from the M365 tenant.

    2 examples -->

    Contoso.com is a hybrid environment and abc.com is another M365 tenant customer

    Scenario 1

    --> Send an email from '@contoso.com' (on-premise) to '@abc.com'

    --> Joe's email is sent through the default send connector. (It never touches the Hybrid connectors.)

    --> Message received from Filter service

    --> Filter service checks and finds that 'abc.com' has to go to M365

    --> Filter service sends the message off to M365

    --> M365 picks up the message and somewhere thinks it HAS to say " I, the contoso.com EXO tenant, sees the message (somehow) sent from on-prem, and now thinks it needs to send the email"

    --> The M365 'contoso.com' EXO processes and sends the message out it's connector.

    --> The connector chosen goes back to the Filter service.

    So now we have a 'rinse and repeat'.

    Scenario 2

    --> Send an email from '@contoso.com' (cloud mailbox) to '@abc.com'

    --> M365 sends the message to the filter service as per the rules and connector in place.

    --> Message received from Filter service

    --> Filter service checks and finds that 'abc.com' has to go to M365

    --> Filter service sends the message off to M365

    --> M365 picks up the message and somewhere thinks it HAS to say " I, the contoso.com EXO tenant, sees the message (somehow) and now thinks it needs to send/re-send the email"

    --> The M365 'contoso.com' EXO processes and sends the message out it's connector.

    --> The connector chosen goes back to the Filter service.

    It now 'rinses and repeats'.

    Initially we thought this had to do with the filtering service, but after careful inspection, it was determined that the filtering service was not at fault for these 2 simple reasons.

    1. We can send email to non-M365 tenants just fine.
    2. Emails sent from on-premise Exchange mailboxes BYPASSING the filtering service and sending to another M365 tenant show to have originated from the M365 Cloud Exo tenant REGARDLESS.

    So right now we are stuck in determining why when a message is introduced or reintroduced into the M365 cloud environment destined for other M365 recipient domains that we see the message being sent from the 'contoso.com' M365 tenant regardless of origin. Our M365 should never be aware of an email re-introduced into the cloud destined for a recipient, but yet it is.

    Hopefully I explained this clearly enough.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2025-05-14T05:57:11+00:00

    Hi Jeff,Good day and welcome to the community.It's possible that the message was not properly directed through connectors. By your description, I'm assuming the message originated from on-prem Exch server. It'd be more visible if you could run a trace from both Exch online and on-prem, but I think it's due to a potential bad configuration with the connectors that direct message between your hybrid environments.By default, if you don't have centralized mail transport enabled for your on-prem Exch server, the message should be delivered to outbound from the originating server directly. So, if the message is originating from on-prem Exch server, that server will perform the delivery to public internet and go through the whole outbound message process. In this case, the on-prem message is somehow relayed to Exch online, which it's not supposed to be doing. If you could log into your Exch admin center from both Exch online and on-prem and capture a screenshot on the configuration settings of related connectors it'd help me identify potential problems.Additionally, if you could post the message trace reports from both Exch on-prem and Exch online for a test message, it'd help me verify my theory.

    Best regards,

    Trish - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments