# Prevent creation of staged user for emails with auto-xyz header

**URL:** <https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960>\
**Category:** Bug\
**Created:** [2017年六月5日 14:10 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960 "2017-06-05T14:10:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2017年六月5日 14:10 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/1 "2017-06-05T14:10:58Z")

</div>

Continuing the discussion from [Google "no-reply" user pending approval](https://meta.discourse.org/t/google-no-reply-user-pending-approval/40961/10):

I am using Gmail for my incoming emails (following [this guide](https://meta.discourse.org/t/set-up-reply-via-email-support-e-mail/14003)). When I recently signed into that Gmail account from a new device, Google sent me one of those security warning emails: “got a new device? Review sign-in from Samsung Galaxy S7”. Discourse correctly rejected this email with an `Email::Receiver::AutoGeneratedEmailError` but it nevertheless created a staged user for [no-reply@accounts.google.com](mailto:no-reply@accounts.google.com). Can/should this not be avoided, given that discourse correctly noticed that

> the ‘precedence’ header is set to: list, junk, bulk or auto\_reply, or when any other header contains: auto-submitted, auto-replied or auto-generated.

---

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2017年六月5日 14:13 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/2 "2017-06-05T14:13:17Z")

</div>

See my question here:

> [@Staged accounts created for bounced emails](https://meta.discourse.org/t/staged-accounts-created-for-bounced-emails/53130):
>
> I get a few spam emails sent to my forum domain, and discourse correctly bounces these with the error email\_reject\_bad\_destination\_address. However, each time this happens a staged user account is created, which I then have to manually reject. Is this intended behaviour?

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2017年六月5日 14:21 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/3 "2017-06-05T14:21:33Z")

</div>

Thanks. I’m not sure this is exactly the same though. The rejection error you mention is `email_reject_bad_destination_address`, right? But mine is `Email::Receiver::AutoGeneratedEmailError`. So this is not about bouncing or spam, as far as I understand.

Here is a more visual representation of what I’m looking at:

 ![](https://global.discourse-cdn.com/meta/original/3X/a/9/a9eb3b2da20a32afa9f4782f8cbd0d1f70ed3a43.png)

---

<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:** [2017年六月5日 14:21 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/4 "2017-06-05T14:21:57Z")

</div>

Not sure; what do you think @zogstrip?

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2017年六月6日 15:08 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/5 "2017-06-06T15:08:37Z")

</div>

Unfortunately, that header isn’t 100% junk. I’d say we’ve had a handful customers send emails in with that header set… Hence the “`block auto generated emails`” site setting.

Creating staged users for these emails was the reason we detected we were “losing” some emails.

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2017年六月6日 15:34 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/6 "2017-06-06T15:34:04Z")

</div>

I’m not sure I’m following. My point was merely that if an email is blocked (because it is autogenerated or for any other reason, for that matter) then it doesn’t really make sense to create a staged user for it, no?

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2017年九月7日 19:35 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/7 "2017-09-07T19:35:37Z")

</div>

Did anything ever happen with this?

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2017年十月10日 15:44 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/9 "2017-10-10T15:44:18Z")

</div>

I fixed this last week: [FIX: don't create staged users when incoming email is rejected · discourse/discourse@76706f9 · GitHub](https://github.com/discourse/discourse/commit/76706f91447de810f6aa3b618a2f5fe8c0924b4b)

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2017年十月11日 15:44 UTC](https://meta.discourse.org/t/prevent-creation-of-staged-user-for-emails-with-auto-xyz-header/63960/10 "2017-10-11T15:44:24Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
