Email loops – what happens, when, and why.

The following headers are preserved, unmodified, by all default Exchange implementations:

  • X-MS-Exchange-Inbox-Rules-Loop
  • X-MS-Exchange-Transport-Rules-Loop
  • X-MS-Gcc-Journal-Report
  • X-MS-Exchange-Moderation-Loop
  • X-MS-Exchange-Generated-Message-Source
  • X-LD-Processed
  • X-MS-Exchange-ForwardingLoop
  • X-EOPAttributedMessage
  • X-EOPTenantAttributedMessage

X-MS-Exchange-Inbox-Rules-Loop

This header represents the number of times a message can be redirected, forwarded, or processed by an automatic-reply. In Nexus365 this is set to only allow this to happen once. On-premises installations of Exchange allow up to three instances of redirection, forwarding, or auto-response before stepping in to prevent mail from looping.

When viewing headers the giveaway looks like this – if the value is 1/1 then the message will be silently dropped:

Source: MAILBOXRULE
event_id: THROTTLE
reference: XLoopHeaderCount:1/1

X-MS-Exchange-Transport-Rules-Loop

This header is set if mail is redirected, or recipients are added, via an Exchange transport rule. This also has a limit of one.
In this instance the sender would receive a non-delivery report message sent back to them with this in the explanation:

550 5.7.128 TRANSPORT.RULES.RejectMessage; Transport rules loop count exceeded and message rejected.

X-MS-Exchange-Moderation-Loop

You’ll only see this header when a message has been forwarded for the purposes of approval – in such circumstances the header will include the arbitration mailbox’s email address. Since there is a limit of one for this header type the approval message will be silently dropped if this header is already found to be present.

X-LD-Processed

Used internally by Microsoft to detect looping on a per-tenant basis, permitting up to three loops per tenant for either an external email address or a forwarding address.

X-MS-Exchange-ForwardingLoop

Present when forwarding is set on a mailbox. If the mailbox is set to deliver-and-forward there will be two copies of the message: one in the local mailbox and one sent externally via the forwarding address. The forwarded message will include the GUID of the original recipient’s tenancy, and the original email address:

X-MS-Exchange-ForwardingLoop: user@ox.ac.uk;<guid goes here>

This header allows the system to detect loops where an email is forwarded and the destination recipient has another forward which sends it back to the source.

X-MS-Exchange-Generated-Message-Source

This checks for loops in system-generated messages, which is only used if an auto-reply via an inbox rule is in effect. The following headers are stamped:

X-Auto-Response-Suppress: All
 X-MS-Exchange-Inbox-Rules-Loop: user@ox.ac.uk
 auto-submitted: auto-generated
 X-MS-Exchange-Generated-Message-Source: Mailbox Rules Agent

X-EOPAttributedMessage

Shows how many times the message has been processed by the Exchange Online Protection process in that tenancy. This value is reset if a message is forwarded from one tenancy into another. The precise value at which the message will no longer be processed is variable, and subject to change, but Microsoft currently state that the total hops permitted is seven, or three within one tenant’s environment. If that value is exceeded the following SMTP response will be sent (with ATTR1 for the total hop limit, and ATTR34 for total hop limit within a tenancy):

554 5.4.14 Hop count exceeded - possible mail loop ATTR1

Should the ATTR value be 39 or 40 we can log a support ticket with Microsoft to look into if the issue is with quarantine or spam-processing.

Posted in Uncategorized | Leave a comment

Leave a Reply