Stuck in a Mail Loop? Diagnosing and Breaking Email Forwarding Loops
Your inbox flooded with 847 copies of the same message. Here's how to read Received headers, find the loop, and fix it.
By JustEmails Platform Team
The CEO pinged me at 11pm. "Something's wrong with email. I have 847 copies of the same message."
Not 8. Not 84. Eight hundred forty-seven. And counting, because the loop was still running.
What happened: the CEO had an auto-forward from their personal domain to their work address. Someone set up a rule on the work address that auto-replied to anything from the personal domain. The auto-reply went to the personal domain, got forwarded to work, triggered the auto-reply, which went to personal, which forwarded to work...
You get the idea. By the time we killed the forward, mailbox storage was full and both servers were furiously queueing messages to each other. Took 30 minutes to clean up the mess.
Mail loops are one of those problems that seem impossible until they happen to you. Then they seem catastrophically, obviously preventable. (Spoiler: they are. You just have to know where to look.)
I'll be honest — I've caused two of these myself over the years. One was a test forward I forgot to delete. The other was, embarrassingly, me misreading which direction a forward was pointing. Happens to everyone. Well, maybe not everyone. But definitely me.
We're the JustEmails team, part of Velocity Digital Labs. We've seen forwarding loops, auto-reply loops, mailing list loops, and once — memorably — a three-way loop involving two different email providers and a helpdesk system. Here's how to diagnose what's happening and break the cycle.
What We're Learning
By the end of this, you'll be able to:
- Read Received headers to identify which servers are looping
- Recognize the difference between a forwarding loop and an auto-reply loop
- Fix the specific misconfiguration causing the problem
- Set up loop-detection headers so this doesn't happen again
If you're already drowning in duplicate messages, skip to the "Stop the Bleeding" section. Come back for the forensics after the flood stops.
Prerequisites
- Access to your email provider's forwarding/filter settings
- Ability to view full email headers (we'll cover how)
- Basic familiarity with how email routing works — our alias vs forwarding guide covers the fundamentals if you need a refresher
The Three Types of Email Loops
1. Forwarding Loops (Most Common)
Two addresses forward to each other. Or three addresses forward in a circle. The mail enters the loop and bounces indefinitely.
Example:
- contact@domain-a.com forwards to inbox@domain-b.com
- inbox@domain-b.com forwards to contact@domain-a.com
- Someone emails contact@domain-a.com
- Loop begins
Each server thinks it's doing the right thing. Neither knows the other is forwarding back.
Chaos.
2. Auto-Reply Loops
Two auto-responders trigger each other. Out-of-office messages are the classic culprit.
Example:
- Alice has an auto-reply: "I'm on vacation until Monday"
- Bob has an auto-reply: "I'm at a conference, back Friday"
- Someone CCs both Alice and Bob
- Alice's auto-reply goes to Bob, which triggers Bob's auto-reply to Alice, which triggers Alice's auto-reply to Bob...
This is why RFC 3834 exists. More on that shortly.
3. Mailing List Loops
A mailing list sends to a member, and that member's address forwards back to the list. Less common with modern list software, but still happens with DIY setups and legacy systems.
Stop the Bleeding: Break the Loop First
If you're in an active loop right now, do this immediately:
Step 1: Identify one address involved in the loop. You probably know which one because it's your inbox that's exploding.
Step 2: Disable ALL forwarding rules on that address. All of them. Temporarily. You can reconfigure later — right now you need the loop to stop.
In JustEmails: Dashboard → Domains → select the domain → Mailboxes → select the mailbox → Forwarding → disable or delete the forward.
In Gmail: Settings → Forwarding and POP/IMAP → disable forwarding.
In Microsoft 365: Admin center → Mail flow → Rules → disable forwarding rules.
Step 3: If auto-replies are involved, disable those too.
Step 4: Wait 5-10 minutes for queued messages to flush. Servers may have hundreds of messages in retry queues.
Step 5: Delete the flood of duplicates. Sort by sender or subject, select all, delete. If the flood is coming from external spam exploiting a loop, you may also need to tighten inbound spam filtering.
OK. You can breathe now. Let's figure out what happened.
Reading Received Headers: Find the Loop
Every email carries a chain of Received headers — one per server that handled it. This is your forensic trail.
To view headers:
- Gmail: Open message → three dots → "Show original"
- Outlook desktop: File → Properties → Internet Headers
- Apple Mail: View → Message → All Headers
- Thunderbird: View → Headers → All
What you'll see (simplified):
Received: from mx.domain-b.com (192.0.2.50)
by mx.domain-a.com; Mon, 23 Jun 2026 10:15:34 -0700
Received: from mx.domain-a.com (198.51.100.10)
by mx.domain-b.com; Mon, 23 Jun 2026 10:15:32 -0700
Received: from mx.domain-b.com (192.0.2.50)
by mx.domain-a.com; Mon, 23 Jun 2026 10:15:30 -0700
Received: from mx.domain-a.com (198.51.100.10)
by mx.domain-b.com; Mon, 23 Jun 2026 10:15:28 -0700
[...repeating pattern...]
See it? domain-a → domain-b → domain-a → domain-b. Back and forth. That's your loop.
In a normal email, you'd see 3-8 Received headers, each from a different server in the delivery chain. In a looped email, you might see 20, 30, 50+ headers — and the same server names keep repeating.
Most mail servers cap at 25-100 hops before they give up and bounce the message. So if you're seeing 50+ Received headers with the same two servers alternating, that message hit the hop limit.
Fixing the Forwarding Chain
Once you know which addresses are involved, the fix depends on what you actually need.
Scenario A: You don't need bidirectional forwarding
This is most cases. One of the forwards was a mistake or leftover from a migration — often a migration from Google Workspace or Microsoft 365 where temporary forwards were never cleaned up.
Fix: Keep the forward that makes sense. Delete the one that doesn't. If contact@ should deliver to your main inbox, keep that forward. If your main inbox doesn't need to forward back to contact@, delete that rule.
Scenario B: You need both addresses to receive all mail
Don't forward. Use aliases instead.
An alias doesn't create a new hop — it just delivers the mail to another mailbox on the same server. No loop possible. In JustEmails, aliases are unlimited and free. If you want both alice@domain.com and admin@domain.com to receive the same mail, make one an alias of the other. Don't forward between them.
If the addresses are on different domains or different providers, you have a trickier problem. You'll need to choose one "real" mailbox and alias everything else to it. Bidirectional forwarding between different servers is always loop-prone.
Scenario C: You're forwarding to an external backup
Forward in one direction only. Configure the destination to NOT auto-process or auto-reply.
For example, if you forward all mail from work@yourdomain.com to personal@gmail.com as a backup, make sure your Gmail has no filters or auto-replies that send anything back to work@yourdomain.com. The path should be work → gmail, period. Nothing coming back.
Fixing Auto-Reply Loops
Auto-reply loops are annoying because they involve two people who both did something reasonable (set an out-of-office), but the combination creates a loop.
The right fix: Check headers before replying
RFC 3834 defines the Auto-Submitted header. Well-behaved auto-responders add this header:
Auto-Submitted: auto-replied
And they're supposed to NOT auto-reply to any message that already has Auto-Submitted: auto-replied (or auto-generated or auto-notified).
If your auto-responder is looping, it's probably not checking this header. Modern mail servers (including JustEmails, Gmail, and M365) handle this correctly. But custom vacation scripts, old helpdesk systems, and DIY autoresponders often don't.
Quick fix for custom scripts:
Add a condition at the top of your auto-reply logic:
# Pseudocode
if header "Auto-Submitted" exists:
skip reply
if header "X-Loop" exists:
skip reply
if header "Precedence" is "bulk" or "list":
skip reply
This prevents your script from replying to auto-generated messages, loop-tagged messages, or bulk mail.
The X-Loop header trick:
If you're writing a custom auto-responder or forwarding rule, add a custom header to every message you send:
X-Loop: your-identifier@yourdomain.com
Then check for that header before processing. If a message already has your X-Loop header, you've seen it before — don't process it again.
This is how mailing list software has prevented loops for decades. Crude. Effective. I wish more helpdesk vendors would just steal this pattern instead of inventing their own broken auto-reply systems.
Loop Detection in JustEmails
JustEmails runs Rspamd for spam filtering, which includes automatic loop detection. If the same message passes through our servers more than 5 times in a short window, Rspamd flags it and stops processing.
We also honor standard loop-prevention headers:
Auto-SubmittedX-LoopPrecedence: listorbulk
Auto-replies configured through JustEmails automatically add the appropriate headers and skip replying to anything that looks auto-generated.
But — and this is important — we can only detect loops that pass through our servers. If you've configured an external forward (JustEmails → Gmail → JustEmails), we see two hops, not the full picture. The loop happens at the Gmail level.
For complicated multi-provider setups, the safest approach is avoiding bidirectional forwarding entirely. Use aliases where possible. Forward in one direction only where necessary.
A Real Example: Debugging a Three-Way Loop
Here's one we saw last year (details changed for privacy). A user had:
- work@company.com (Microsoft 365) forwarding to personal@theirowndomain.com (JustEmails)
- personal@theirowndomain.com set up a filter: "if from company.com, forward to archive@gmail.com"
- archive@gmail.com had an auto-reply: "This mailbox is monitored weekly, contact work@company.com for urgent matters"
The auto-reply went to work@company.com, which forwarded to personal@theirowndomain.com, which forwarded to archive@gmail.com, which auto-replied to work@company.com...
Three providers. Each doing exactly what it was told. Nobody detecting the loop because each only saw their piece.
The fix: disable the Gmail auto-reply. That shouldn't have been on an archive mailbox anyway. Then we helped the user consolidate — why have three places for mail to land when a unified inbox handles it?
This is the frustrating thing about email loops. They always involve two or more "reasonable" configurations that nobody thought to check against each other. Nobody's at fault. Everybody's at fault. The prevention is thinking about the full path, not just your piece of it — but honestly, who does that? I didn't, until it bit me.
Common Errors and Fixes
"Mailbox over quota — cannot receive new messages"
Cause: Loop filled the mailbox before anyone noticed. Fix: Delete the flood of duplicates. If you can't access webmail because quota is exceeded, use IMAP and delete messages by date range, or contact your provider's support. Our mailbox storage management guide covers recovery techniques.
"Message rejected: too many hops"
Cause: Loop hit the server's hop limit (usually 25-100 Received headers). Fix: The loop was detected automatically. Find and fix the forwarding misconfiguration using the methods above.
"Forwarding rule keeps re-activating"
Cause: Your email client is syncing an old rule, or a different admin re-enabled it. Fix: Check all devices and admin accounts that might be managing forwarding rules. Someone else might have access.
"Auto-reply sending to mailing lists"
Cause: Your auto-responder isn't checking Precedence headers. Fix: Configure it to skip replies when Precedence: list or Precedence: bulk is present. Most legitimate auto-reply systems do this by default.
(Hot take: if your auto-reply system doesn't check these headers in 2026, switch systems. It's not that hard to implement. Developers who skip this are just being lazy.)
Preventing Future Loops
Before you set up any forward or auto-reply, ask:
- Where does this mail go next? Trace the path. If it comes back to a server you control, you're creating a loop.
- Does the destination have any auto-rules? Check forwarding settings, filters, and auto-replies on the destination address.
- Did I add loop-prevention headers? For custom scripts, always add
Auto-SubmittedorX-Loopheaders. - Could I use an alias instead? Aliases are almost always safer than forwards because they stay within one provider. Seriously — aliases over forwards, every time. I'm a broken record about this.
If you're setting up email for multiple domains, our multi-domain management guide covers routing strategies that avoid these pitfalls. And if you're migrating providers, setting up temporary forwarding correctly — with loop prevention in mind — makes the difference between smooth transition and mailbox apocalypse.
Frequently Asked Questions
What causes an email forwarding loop?
An email forwarding loop happens when two or more addresses forward mail to each other, creating a circular path. For example: alice@ forwards to bob@, and bob@ forwards to alice@. Each server receives the forwarded message and dutifully forwards it again, creating an infinite cycle. Auto-replies can cause similar loops when two out-of-office messages trigger each other. The loop continues until a server detects it (via hop count or loop headers) or mailboxes overflow.
How do I read Received headers to find a mail loop?
Open the email's full headers (Gmail: Show original; Outlook: File > Properties). Read from bottom to top — each Received line shows a server that handled the message. In a loop, you'll see the same server names repeating in a pattern. Count the hops: normal email has 3-8 Received headers, but looped mail often has 20-50+ as it bounces between servers before hitting a hop limit. The repeating pattern tells you which addresses are looping.
What headers prevent email loops?
Three headers help prevent loops: X-Loop (custom header set by filters to mark processed mail), Auto-Submitted (RFC 3834 standard indicating automated messages that shouldn't trigger auto-replies), and Precedence: bulk or list. When setting up auto-replies or forwarding rules, check for these headers and skip processing if they're present. Most modern mail servers add Auto-Submitted: auto-replied to out-of-office messages automatically.
How do I fix a forwarding loop between two addresses?
First, disable one of the forwarding rules to stop the immediate flood. Then redesign the forwarding chain so it's one-directional: alice@ → bob@ but NOT bob@ → alice@. If you need both addresses to receive mail, use aliases instead of forwarding — aliases deliver within the same server without creating a forwarding hop. For auto-reply loops, configure your responder to check Auto-Submitted headers and skip replies to automated messages.
If you're tired of debugging email infrastructure that shouldn't be this complicated, that's fair. We built JustEmails because we were tired of it too.
$49/year flat. Unlimited domains, unlimited mailboxes, 10 GB storage. 7-day free trial if you want to kick the tires.