# Incoming mail is rejected if in-reply-to a post in a non-accessible topic even if sent to a group inbox

**URL:** https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711
**Category:** Bug
**Created:** [04.Сентябрь.2016 16:23:43 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711 "2016-09-04T16:23:43Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [04.Сентябрь.2016 16:23:43 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/1 "2016-09-04T16:23:43Z")

</div>

[As recommended](https://meta.discourse.org/t/mysteriously-rejected-mails/49544/4) by @mpalmer, here’s a bug report for a phenomenon that [caused some confusion for me](https://meta.discourse.org/t/mysteriously-rejected-mails/49544):

**How to reproduce:**

- Produce a messaging topic T that is inaccessible to user A, but deliver a mail from that topic to this user without Discourse knowing, e.g. by replying to the topic via mail and CCing a mailing list containing user A. (See [here](https://meta.discourse.org/t/mysteriously-rejected-mails/49544/5) for a description of a real-world occurrence of this.)
- As user A, reply to this message, addressing it **to** the group inbox address of group G. Use a mail client that adds an `In-Reply-To` header to do this.

**Expected behavior:**

Discourse creates a new message between group G and user A. (It may try to post a reply in topic T instead because it sees the `In-Reply-To` header, but falls back to the new message because user A lacks permissions for a reply.)

**Actual behavior:**

Discourse sees the `In-Reply-To` header and tries to post a reply from user A in topic T. Because A lacks permissions to do so, Discourse sends him an email explaining that the topic was probably closed or deleted, and does not deliver that message.

---

<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: [04.Сентябрь.2016 20:50:43 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/2 "2016-09-04T20:50:43Z")

</div>

> [@fefrei](#):
>
> Because A lacks permissions to do so, Discourse sends him an email explaining that the topic was probably closed or deleted, and does not deliver that message.

It seems an easier option to first improve the error message to indicate that the user does not have a) an account on the site or b) access to the topic.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [04.Сентябрь.2016 21:05:56 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/3 "2016-09-04T21:05:56Z")

</div>

That’s way easier for sure, but it wouldn’t help me. Remember that users sending emails to group inboxes may not be tech savvy, and may have no idea what this “Discourse” thing that’s sending them emails actually is.

I love Discourse’s incoming mail support because we as a team can use it to organize our communication with the outside, but I need to rely on incoming mails being actually received, versus generating error messages that will puzzle outsiders.

---

<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: [04.Сентябрь.2016 21:21:53 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/4 "2016-09-04T21:21:53Z")

</div>

Proper error messages is the first step though.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [04.Сентябрь.2016 21:33:36 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/5 "2016-09-04T21:33:36Z")

</div>

As long as it is the first of two steps, I agree 🙂

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [19.Сентябрь.2016 13:41:40 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/6 "2016-09-19T13:41:40Z")

</div>

I just had another occurrence of this, but this time, the mail was addressed to a reply address.  
In that case, I think the correct solution is to let the user post there (and add him to the message). Wo know that the reply tokens are a secure, random secret, so possession of the token proves that an email from the thread was forwarded to the sending user.

---

<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: [13.Октябрь.2016 22:06:44 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/7 "2016-10-13T22:06:44Z")

</div>

> [@codinghorror](#):
>
> an easier option to first improve the error message to indicate that the user does not have a) an account on the site or b) access to the topic.

@zogstrip can you add this to your list? A bad error message should always have priority. Good, clear error messages are essential to everyone’s sanity.

---

<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: [11.Апрель.2017 21:55:21 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/8 "2017-04-11T21:55:21Z")

</div>

Any movement on this @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: [15.Май.2019 20:57:05 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/9 "2019-05-15T20:57:05Z")

</div>

@maja can you add to your list to ensure we have a proper error message here?

---

<div class="post-metadata">

### Author: ![maja](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maja/32/129533_2.png) [@maja](https://meta.discourse.org/u/maja)
#### Post date: [04.Июнь.2019 16:37:09 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/11 "2019-06-04T16:37:09Z")

</div>

Proper error message added in:

[https://github.com/discourse/discourse/commit/87d3b86484821cad88e88560be4b6fcd48e3f527](https://github.com/discourse/discourse/commit/87d3b86484821cad88e88560be4b6fcd48e3f527)

---

<div class="post-metadata">

### Author: ![maja](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maja/32/129533_2.png) [@maja](https://meta.discourse.org/u/maja)
#### Post date: [04.Июнь.2019 16:37:21 UTC](https://meta.discourse.org/t/incoming-mail-is-rejected-if-in-reply-to-a-post-in-a-non-accessible-topic-even-if-sent-to-a-group-inbox/49711/12 "2019-06-04T16:37:21Z")

</div>


