对“通过电子邮件回复”的错误消息感到困惑

This might just be a personal failing, but I’m a bit confused by some of the error reporting I’m getting after setting up reply-by-email.

When someone replies to a message from an e-mail address not associated with their account, the error message (on a self-hosted Discourse instance) might be the wrong one? It seems like the message one should receive if they sent to an incorrect address, rather than from an unrecognized address.

The message I receive in that case has the subject line Email issue – Unknown To: Address, and the body looks like:


We’re sorry, but your email message to [“SNIP”] (titled Re: Help Please) didn’t work.

None of the destination email addresses are recognized, or the Message-ID header in the email has been modified. Please make sure that you are sending to the correct email address provided by staff.


Changing the From: address in my replies to match the one associated with the account seems to fix the problem.

Is there an easy way to modify this behavior? Have I misconfigured something?

(I should maybe say that what I would really be hoping for is an option to ignore the From: header altogether and instead just use the reply key as discussed here; is there any chance of that?).

1 个赞

Ah, maybe this is because it’s a response to a PM, rather than a public topic, and so Discourse doesn’t think that the person sending the e-mail (which it doesn’t recognize as a valid user) should be able to send to that address?

That might explain why it is marking the To: address as invalid, rather than the From: address?

In the meantime, I’ve changed the text of that message to clarify that it could be an issue with From: or with To:.

4 个赞

Why would Discourse accept a random email address, not matching any valid user account on the target site? :thinking:

You must always have a valid, authenticated account to post anything in Discourse.

(There is an exception for staged users, but that’s specific to handling an email inbox through Discourse PMs)

3 个赞

This would be because the permission error is transformed into a “not found” error somewhere in the stack, and then the email code uses the message for “not found”…

3 个赞

One could argue that the reply_id (which seems to map both to a topic and the person replying) is identifier enough, and spoofing reply_id is harder than spoofing an e-mail address, so it’s effectively just as strong with or without coming from the right e-mail address.

But I’m not actually trying to argue that. What you’re saying here makes total sense. And, after thinking on it, I realize that the thing leading to this behavior is definitely an edge case (we have SSO creating an account with university e-mail addresses, but people sometimes forward those to other addresses, from which they respond).

My real question is about the contents of the error email people receive in that case, which seems like it could be misleading. The real issue, or at least the thing the person receiving the error e-mail has control over in this case, is the “From” address (and the address associated with their account), not the “To” address, as far as I can tell.

Anyway, I already have a workaround by:

  • changing the content of that message (love that Discourse is so customizable!) and
  • telling people to change their email address if they want to use reply-by-email

but I’m just wondering if it makes sense to change something about what error messages are sent in which situations, given this potential confusion.

If the answer to that is “No, things are fine as-is,” that’s totally fine.

4 个赞

We do have preliminary support for alternate email addresses per user.

I wonder @sam and @eviltrout when will we formalize this a bit more so users can add a secondary email address? Should this be added to the 2.5 roadmap?

10 个赞

I think we should start by surfacing this in the admin user page so you can see / add email addresses for 2.5. Maybe next after that add some rudimentary UX in the admin pages for merging users now that we have the well tested rake task.

8 个赞

We’d have to validate each address right?

5 个赞

我仍然难以理解,既然 From: 头可以被极其简单地伪造,为什么 Discourse 还要信任/验证它?

回复 ID 头提供了有用的验证,因为坏人无法猜测或获知它。

验证 From: 头只会导致合法用户在尝试通过电子邮件发帖时,如果恰好从不同的电子邮件地址回复(这是一种比人们预想中更常见的边缘情况),就会收到令人困惑的拒绝信息。

1 个赞

电子邮件就是身份标识。所谓“不同的电子邮件地址”,就好比说“不同的 DNA”。

1 个赞

我有很多电子邮件地址,我的一些用户也是如此。

我真诚地并非想挑起争执。我只是对这个问题的后果略感心累,因为它导致我某个论坛的一位重要成员决定不再为该论坛做贡献。

那么你应该倡导支持每个用户设置多个邮箱地址的功能,不妨往上翻一翻,读一读相关内容?

2 个赞

很遗憾,我不确定所提议的功能是否能解决我在 Discourse 实例中遇到的问题。

在我的案例中,该用户是一位民间团体的主席。她有两个电子邮件地址和两个 Discourse 账户(每个地址对应一个账户)。一个账户代表她的个人身份,另一个则用于代表该民间团体发布“官方”帖子。

当她通过电子邮件回复时,经常从“错误”的电子邮件地址发送,导致她的回复被拒绝。

我推测上面讨论的功能将涉及每个 Discourse 账户支持多个电子邮件地址,但(自然地)会禁止每个电子邮件地址对应多个 Discourse 账户。因此,很遗憾,这无法解决我的使用场景。

1 个赞

难道不能直接合并这两个账户,将其中一个电子邮件地址设为次要地址吗?

如果不能,很遗憾,目前 Discourse 中没有任何工具可以帮助用户记住他们当时使用的是哪个身份。

1 个赞

从技术上来说我可以这么做,但用户能够以两种不同的身份(个人身份/代表民间社会)发帖是有意为之的。

2 个赞

是的。有时候人们确实会陷入这种场景,但我可能更愿意称之为“极端情况”而非“边缘情况”:smile:

我理解得对吗?这个人实际上有两个身份,但由于某种原因,这两个身份最终都关联到了同一个邮箱账户?如果是这样,他们似乎不仅仅在 Discourse 上会遇到这个棘手的问题,可能在其他地方也会遇到。也许这个问题更适合在邮件客户端层面处理?

我的工作邮箱中有一些与工作相关的别名,但我的邮件客户端在回复时会将“发件人”地址匹配为邮件原本发送到的地址…

4 个赞

我同意,这是一个边缘情况,如果她不是如此知名的用户,这本来不会成为大问题。

为了创建两个 Discourse 账户,我们使用了 Gmail 点号技巧,以便她能为自己的 Gmail 邮箱创建两个不同的电子邮件地址,从而注册两个 Discourse 账户。

当她通过电子邮件回复论坛帖子时,Gmail 未必使用 Discourse 所期望的那个电子邮件地址变体。

依我看,只要回复 ID 有效,Discourse 就应该接受该回复。

dot hack 极其脆弱,他们很可能使用加号地址(plus addressing)会顺畅得多。

如果两个账户都使用加号地址,且没有任何账户使用裸地址,那么“发件人”地址切换器将正常工作;若忘记设置,邮件只会被拒绝,而不会错误地提交到错误的账户。

使用加号代替点号也能让你的筛选规则更加清晰 :sweat_smile:

7 个赞

@dan,你能把这个加到你的清单里吗?

5 个赞

我已提交一个拉取请求,以改进对多个电子邮件地址的支持:

8 个赞