# Infinite loop of: 'Email issue -- Unknown To: Address' emails

**URL:** <https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623>\
**Category:** Bug\
**Created:** [2015年一月30日 18:50 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623 "2015-01-30T18:50:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![therubymug](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/therubymug/32/122534_2.png) [@therubymug](https://meta.discourse.org/u/therubymug)\
**Post date:** [2015年一月30日 18:50 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/1 "2015-01-30T18:50:20Z")

</div>

Maybe not quite an infinite loop but I’m having trouble tracking down the core issue here. We’re up to almost 200K emails of just this type in the last few days. That could get expensive. :-/

Right now I’ve had to disable **all** outbound emails from Discourse.

I’ve traced it back to the PollMailbox job: [discourse/app/jobs/scheduled/poll\_mailbox.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/app/jobs/scheduled/poll_mailbox.rb#L46-47)

But I need a clue as to how to trace back further down the stack. I realize there’s a timer that runs this poll every `SiteSetting.pop3_polling_period_mins.minutes` but how can I _clear the queue_ per se?

Any help would be appreciated.

Related topics: [Creating topics by email to users.rust-lang.org or internals.rust-lang.org fails with 'Email Issue: Unknown To: Address' - #5 by brson](https://meta.discourse.org/t/creating-topics-by-email-to-users-rust-lang-org-or-internals-rust-lang-org-fails-with-email-issue-unknown-to-address/24595/5) and [Creating topics by email to users.rust-lang.org or internals.rust-lang.org fails with 'Email Issue: Unknown To: Address' - #5 by brson](https://meta.discourse.org/t/creating-topics-by-email-to-users-rust-lang-org-or-internals-rust-lang-org-fails-with-email-issue-unknown-to-address/24595/5)

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2015年一月31日 09:13 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/2 "2015-01-31T09:13:10Z")

</div>

Can you post logs of the incoming mailbox that Discourse looks at to poll for email-in?

---

<div class="post-metadata">

**Author:** ![Vocino](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vocino/32/85136_2.png) [@Vocino](https://meta.discourse.org/u/Vocino)\
**Post date:** [2015年二月1日 01:53 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/3 "2015-02-01T01:53:29Z")

</div>

It’s gmail, what logs can I post to help? ( @therubymug and I admin the same forum)

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2015年二月1日 02:16 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/4 "2015-02-01T02:16:06Z")

</div>

To, stripped From and CC addresses of the first few email before the loop started.

---

<div class="post-metadata">

**Author:** ![therubymug](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/therubymug/32/122534_2.png) [@therubymug](https://meta.discourse.org/u/therubymug)\
**Post date:** [2015年二月1日 21:44 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/5 "2015-02-01T21:44:49Z")

</div>

I’m pasting a sample email. It’s thousands before and after. It looks like it’s attempting to email itself.

Does that give you a better clue as to what may be going on?

Our `reply by email address`: is `reply+%{reply_key}@strats.co`

Right now we’ve turned set: `reply by email enabled` to `unchecked`

```plaintext
Delivered-To: support@strats.co
From: <support@strats.co>
Subject: Email issue -- Unknown To: Address
Return-Path: <bounce-md_30190395.54c9c929.v1-18add8dfdf61458995484ef03caaf5e8@track.strats.co>
X-Discourse-Topic-Id: 
X-Discourse-Post-Id: 
X-Discourse-Reply-Key: 
Reply-To: <support@strats.co>
To: <support@strats.co>
Message-Id: <54c9c9297f55f_16e93fc7bfa5c21c33960275@daggerfall.strats.co-app.mail>
Auto-Submitted: auto-generated
Received: from [<redacted ip>] by mandrillapp.com id 18add8dfdf61458995484ef03caaf5e8; Thu, 29 Jan 2015 05:46:17 +0000
X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com
X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30190395.18add8dfdf61458995484ef03caaf5e8
X-Mandrill-User: md_30190395
Date: Thu, 29 Jan 2015 05:46:17 +0000

--_av-HFxtra1FlAEZjjWqa2XfEw
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

We're sorry, but your email message to ["support@strats.co"] (titled Email issue -- Unknown To: Address) didn't work.

None of the destination addresses are recognized. Please make sure that the site address is in the To: line (not Cc: or Bcc:), and that you are sending to the correct email address provided by staff.

--_av-HFxtra1FlAEZjjWqa2XfEw
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<p>We're sorry, but your email message to ["support@strats.co"] (titled Email issue -- Unknown To: Address) didn't work.</p>

<p>None of the destination addresses are recognized. Please make sure that the site address is in the To: line (not Cc: or Bcc:), and that you are sending to the correct email address provided by staff.</p>
<img src="http://track.strats.co/track/open.php?u=30190395&id=18add8dfdf61458995484ef03caaf5e8" height="1" width="1">
--_av-HFxtra1FlAEZjjWqa2XfEw--

```

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2015年二月2日 02:46 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/6 "2015-02-02T02:46:49Z")

</div>

No, I mean the first one that ISN’T identical to that. The one that started the chain.

---

<div class="post-metadata">

**Author:** ![therubymug](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/therubymug/32/122534_2.png) [@therubymug](https://meta.discourse.org/u/therubymug)\
**Post date:** [2015年二月2日 03:06 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/7 "2015-02-02T03:06:10Z")

</div>

@riking Ha! Yeah, it’s like the needle in the haystack. There are over 200K emails identical to that one _spanning multiple days_. :-/ This one’s a doozy. Is there any log file in the server I could look at?

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2015年二月2日 03:42 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/8 "2015-02-02T03:42:51Z")

</div>

Hm, how about this: Set up a gmail filter rule to trash any email sent from that same address. That’ll make sure it never happens.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2015年二月13日 12:06 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/9 "2015-02-13T12:06:52Z")

</div>

Thanks to @zogstrip we now test for and block setting these email addresses in a way that causes feedback loops.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2015年二月13日 12:06 UTC](https://meta.discourse.org/t/infinite-loop-of-email-issue-unknown-to-address-emails/24623/10 "2015-02-13T12:06:56Z")

</div>


