DocsTroubleshooting
Mail loops
A message arrives many times, or bounces with "too many hops". The loop guard is missing.
Updated August 29, 2026
How a loop happens
Your platform sends outbound mail to RubySig; RubySig hands it back; your platform delivers it. If the rule that sends mail to RubySig also matches the returned message, the message goes round again — and again — until your platform gives up with a hop-count error, typically after 30 to 50 passes.
RubySig prevents this by adding a header to every message it hands back:
X-RubySig-Stamped: yes
Your routing rule must exempt messages that carry it. That exemption is part of every setup guide, and it is the only thing standing between normal operation and a loop.
Symptoms
- A recipient receives the same message dozens of times.
- The sender gets a bounce mentioning hop count exceeded, too many hops, or loop detected.
- Google's Email Log Search shows the same message matching the compliance rule repeatedly.
Microsoft 365
Open Mail flow → Rules, edit the RubySig rule, and check the Except if section. It must read:
'X-RubySig-Stamped' message header includes 'yes'
If the exception is missing, add it: Except if → The message headers… → includes any of these words, header name X-RubySig-Stamped, word yes. If the exception exists but the header name is misspelled, fix the spelling — it must match exactly.
Also confirm the outbound connector's Use of connector is Only when I have a transport rule…. A connector set to all accepted domains routes mail regardless of any rule, and no exception can save it.
Google Workspace
Open Apps → Google Workspace → Gmail → Compliance → Content compliance and edit the RubySig rule. The expression must be:
Location Full headers · Not contains text ·
X-RubySig-Stamped
Two things to check by reopening the saved rule rather than trusting the list summary:
- The text is
X-RubySig-Stampedonce. A doubled value (X-RubySig-StampedX-RubySig-Stamped) never matches anything, so Not contains is always true and every message — stamped or not — is routed to RubySig. - The match type is Not contains text, not Contains text.
Finally, confirm Gmail → Routing → Outbound gateway is not set to the RubySig relay address. The outbound gateway applies to all outbound mail with no way to exempt stamped messages; it must stay empty (or pointed at whatever it was before RubySig).
Stopping a loop that is running
Disable the rule (Microsoft: the transport rule; Google: the content compliance rule). Mail stops going to RubySig immediately; messages already circulating drain within a minute. Fix the exception, then re-enable.