# Better support for Auto-Submitted: auto-replied

**URL:** https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096
**Category:** Bug
**Created:** [16 juni 2015 om 19:56 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096 "2015-06-16T19:56:49Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [16 juni 2015 om 19:56 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/1 "2015-06-16T19:56:49Z")

</div>

Related to discussions like this:

[Auto-response email replies to Digests are processed as new topic](https://meta.discourse.org/t/auto-response-email-replies-to-digests-are-processed-as-new-topic/22564/7):

> [@techAPJ](#):
>
> FIX: auto response email replies should not be accepted

I just found 244,276 emails in the POP inbox which one of my non-hosted forum watches.

but the one I smelled as the best clue for discourse not to reply on is:

> Auto-Submitted: auto-replied

The emails sent log is full of

```plaintext
postmaster@exchange.microsoft.com	email_reject_auto_generated  
discuss@domain.com email_reject_auto_generated

```

How can we prevent the loop?

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [16 juni 2015 om 20:02 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/2 "2015-06-16T20:02:28Z")

</div>

Upgrading to latest (we were less than a week behind when it started) didn’t help

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [16 juni 2015 om 20:56 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/3 "2015-06-16T20:56:44Z")

</div>

Apparently this has been going on for quite some time… the other email we see hundreds of is from discourse, to discourse,

> We’re sorry, but your email message to [“[discuss@forum.com](mailto:discuss@forum.com)”] (titled [Discussions] Email issue – Auto Generated Reply) didn’t work.  
> Your email was marked as “auto generated”, which we can’t accept. If you believe this is in error, contact a staff member.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [16 juni 2015 om 21:53 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/4 "2015-06-16T21:53:28Z")

</div>

Not sure what type of mail server you’re running, but can you set up some type of automation to delete auto-submitted bounces, etc., from the incoming POP3 inbox?

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [16 juni 2015 om 22:11 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/5 "2015-06-16T22:11:22Z")

</div>

Ok, so postmortem almost complete:

the email address in `Contact Email` was set to be the same as the ` notification email` and was also the forum’s primary email address.

If discourse wanted to check & warn admins this is a bad choice, this issue might have been avoided 😉

PS We do not yet know why the microsoft server was involved in this loop.

---

<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: [16 juni 2015 om 22:42 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/6 "2015-06-16T22:42:14Z")

</div>

> [@watchmanmonitor](#):
>
> the email address in Contact Email was set to be the same as the notification email and was also the forum’s primary email address.
> 
> If discourse wanted to check & warn admins this is a bad choice, this issue might have been avoided

That check is already in place.

> [@watchmanmonitor](#):
>
> We’re sorry, but your email message to [“[discuss@forum.com](mailto:discuss@forum.com)”] (titled [Discussions] Email issue – Auto Generated Reply) didn’t work.Your email was marked as “auto generated”, which we can’t accept. If you believe this is in error, contact a staff member.

uh, no, those emails should be silently dropped @techAPJ

---

<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: [17 juni 2015 om 18:33 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/7 "2015-06-17T18:33:50Z")

</div>

The check is in place now, but was not 4+ months ago, so it will not catch old sites that had a loop set up in their emails.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [7 april 2016 om 05:38 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/8 "2016-04-07T05:38:11Z")

</div>

We ran into this as well. The cause of the infinite loop is because we are sending an “Auto Generated Reply” back to email addresses that we detect as “no-reply” or “auto-generated”. If `pop3_polling_username` is similar to `notification_email`, the email that bounced will be polled for and we end up starting another cycle.

It does seem really weird to me that we reply to email addresses that we detect as “no-reply” so I opened a PR to stop doing that.

[https://github.com/discourse/discourse/pull/4148](https://github.com/discourse/discourse/pull/4148)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [7 april 2016 om 05:58 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/9 "2016-04-07T05:58:18Z")

</div>

I worry though that we lose out on some of the feedback we have now, I wonder if we should allow the first one of these through and then stop the loop thereafter?

Poison the “reply” with a magic header, if you ever see this header you silently reject?

---

<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: [7 april 2016 om 07:22 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/10 "2016-04-07T07:22:32Z")

</div>

Yeah Sam has the right idea here we cannot lose this feedback. Put in a guid (a constant will work) and if you see it in the reply coming back to you, cancel your reply.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [7 april 2016 om 14:27 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/12 "2016-04-07T14:27:42Z")

</div>

I added two additional checks:

1. If there is a delivery status report in the email, we can detect if the rejection email bounced and not send a rejection email
2. Add a custom header in the rejection email and we’ll look for that header when processing emails.

[https://github.com/discourse/discourse/pull/4148](https://github.com/discourse/discourse/pull/4148)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [21 juli 2022 om 05:42 UTC](https://meta.discourse.org/t/better-support-for-auto-submitted-auto-replied/30096/13 "2022-07-21T05:42:55Z")

</div>


