Better support for Auto-Submitted: auto-replied

(Allen - Watchman Monitoring) #1

Related to discussions like this:

Auto-response email replies to Digests are processed as new topic:

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	email_reject_auto_generated			email_reject_auto_generated

How can we prevent the loop?

(Allen - Watchman Monitoring) #2

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

(Allen - Watchman Monitoring) #3

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 [“”] (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.

(Michael Downey) #4

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?

(Allen - Watchman Monitoring) #5

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 :wink:

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

(Kane York) #6

That check is already in place.

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

(Jeff Atwood) #7

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.

(Alan Tan) #8

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.

(Sam Saffron) #9

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?

(Jeff Atwood) #10

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.

(Alan Tan) #12

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.