`enable_forwarded_emails` 的行为不符合常规邮件转发

enable_forwarded_emails is a great feature for bringing existing conversations into Discourse, but for users who approach Discourse with a “Mailman-mind” - as many users on our instance do - this feature just doesn’t do what they’re expecting it to.

Within every email client I’ve used, forwarding an email intentionally excludes the original email address from the forward, and subsequent replies. Whereas with this feature, that original email address is included in the created post and subsequent replies.

If this feature isn’t enabled, then Discourse strips the actual forwarded email, which also doesn’t work for us.

My thought is there should be an alternative feature which doesn’t strip the forwarded email and posts it like so:

Thought you all should see this:

---------- Forwarded message ---------
From: Example Person <person@example.com>
Date: Wed, 13 Mar 2019 at 15:11
Subject: An email to be forwarded
To: <some_discourse_user@example.com>

The original email

This would be a lot like the result of the always_show_trimmed_content setting, but with the trimmed content automatically expanded (and therefore visible in email notifications).

@zogstrip what are your thoughts here?

With just a little bit of rejigging of the code you’ve already written for enable_forwarded_emails I think what I want to see would be relatively easy - and that’s rejigging I’m happy to do.

Perhaps the solution here is to create a new multiple-choice site setting, something like:

forwarded_emails_behaviour:

  • hide (default)
  • show (the behaviour I’m advocating for here)
  • create_replies (the existing enable_forwarded_emails behaviour)
9 个赞

I like that :+1:

PR at will :wink:

5 个赞

It took me a little while, but here’s the PR:

8 个赞

Currently, this setting has these options available:

So I suppose the “show” option became “quote”?

Also, I don’t quite get why the other option is called “create replies”. What does it mean? (or: what does it do?)

Yep, as both other options “show” the forwarded email, but this one quotes in in the original post.

What it says on the :canned_food:! It’ll attempt to parse the forwarded email, then create a staged user from the original sender of the forwarded email, and post the forwarded email as the original topic and then any text the forwarder includes as a reply to that topic (at least that’s the way round I remember it working).

4 个赞

Aah, now I get it. It’s the text that the forwarder includes that becomes the reply! But that’s exactly one reply. Why does it say create replies?

Another reason why the terminology is somewhat confusing: both “hide” and “quote” refer to the forwarded text but “create replies” refers to the forwarders commentary om the forwarded text. So perhaps these options could be clarified somehow by saying

  • hide forwarded email
  • quote forwarded email
  • post forwarded mail with replies

As I write, I’m wondering whether this third option is really how it works. I don’t think it ever behaved like that for us but then again we don’t have a lot of forwarded mails, so I’m not sure. Does it even make sense to post the forwarders comment as a reply? Shouldn’t it somehow be made clear that the forwarded email was posted by the forwarder? This is not at all clear when you have the forwarder apparently reply to it.

3 个赞

So I’m using the quote setting and it definitely doesn’t work as described. Maybe I’m still misunderstanding the intended behaviour but this seems pretty clear:

and this is not what I’m getting. So let me be mote precise in what I’m getting: someone forwarded an email starting with a short note like “Look at this” followed by the forwarded email. The forwarded email included text as well as two pdf files as attachments. The post shown on the forum looked like this:

Look at this!
Cheers,
Sara

document1.pdf
document2.pdf

That was all.

So the forwarded email was completely stripped with the exception of the file attachments. I was able to recover it manually and it even started with ---------- Forwarded message --------- so identifying it could not have been easier…

Hmm, I wonder if the attachments are messing things up here. This is how they (correctly) appear for me: Fwd: email to site-feedback.support - Support - Mozilla Discourse Dev

3 个赞

Okay, that looks just like I’d expect it. Good to see that it works at least under certain circumstances. But did your email include an attachment? If not, it seems plausible that discourse is confused by (certain?) attachments.

我仍然遇到转发邮件无法显示的问题。既然我至少有一封带附件的邮件被正确渲染,我现在的猜测是,这可能与转发者是否在邮件中添加了内容有关。据我观察,那些没有添加任何文字就直接转发的邮件都能正确渲染;但如果转发者添加了类似“供参考”(FYI)这样的内容,帖子中只会包含附件,而不会包含转发邮件的正文。

换句话说,这个示例仍然无法正常工作(因为它包含了“我想你们都应该看看这个:”):

与上述结果不同,这封邮件会被渲染为:

我想你们都应该看看这个:

除此之外没有任何内容。

能否有人确认一下,这个问题是仅存在于我的实例中,还是其他地方也存在?

请特别检查带有附件的邮件(例如 PDF 文件),因为有可能只有当添加了文本且同时存在附件时,才会出现该问题。

我也仍然困惑这些不同的标签/功能具体是做什么的——我正在尝试设置传入邮件以配合 工单插件 :tickets: 使用,但遇到了不一致的行为。

我觉得默认行为应该是:任何被转发的邮件内容,都应由创建该邮件的用户(无论是临时用户还是正式用户)发布为帖子。邮件被转发的原因通常是因为收到邮件的人认为在 Discourse 上处理更合适,因此该话题似乎最应由邮件作者发起,而不是转发者。

(但也可能我的使用场景实际上属于边缘情况……)

当你将 enable_forwarded_emails 设置为 create_replies 时,应该按此方式运作。转发的邮件将成为第一楼,如果转发者写了文字,系统会创建回复;否则,系统会创建一个简短的操作帖,以明确是谁转发了第一楼。

2 个赞

好的,我想我终于明白了——

如果 create_repliesforwarded emails behaviour 站点设置所选的值,那么原始消息会成为话题的开头帖子,而电子邮件中写在转发消息上方的任何内容,都会成为该第三方消息下方对话题的回复:confused:

问: 该站点设置的其他值——即 hidequote——是否仅处理原始的第三方消息,而不做其他操作?

我在想,尝试拆分这些“创建回复”是否可能是导致我在从 Microsoft Outlook 客户端发送内容时遇到一些奇怪错误的原因。

附:我在想,这个设置是否值得在站点设置下方的描述文本中链接一个常见问题解答(FAQ)或操作指南条目?也许只是我个人觉得,但过去 7 年来,我很少对 Discourse 的某个设置感到如此困惑。或者,也许我只是需要多来点 :coffee: :smile:

不是的。如果在转发消息前没有文本,你会收到一个小型操作帖子。

我认为该功能仍被标记为实验性,这是有充分原因的。邮件通常以内联方式转发,这使得提取转发邮件变得相当困难,因为每个客户端转发原始邮件头的方式各不相同。有些甚至隐藏原始 From 头的电子邮件地址,或使用本地化的邮件头。

如果邮件作为附件而非内联转发,情况应该会好得多(我 99% 确定 Discourse 支持此功能)。

1 个赞

我同意,这确实是确保正确处理的更清晰方式。我想知道为什么我在尝试时无法让 Discourse 处理这些附件。(转发附件的内容确实出现在帖子标记的原始内容中,但只渲染了“评论”,而没有渲染转发的原始邮件。至少对于 MS Outlook 是这样的;我得试试其他客户端。)

1 个赞

也许最终并没有实现?我还没查看代码。:blush:
如果它在其他客户端上能正常工作,请反馈一下。

1 个赞

启用了 quotecreate_replies 模式后,内联转发的消息会被截断。

有什么建议吗?

原始消息(已移除部分头部信息):

From: Jeffrey Lastname <jeff@myemail.us>
To: test-cat@example.org
Subject: Fwd: Thank you for your support!
X-Mailer: MailMate (1.14r5745)
Content-Type: text/plain; format=flowed

Some really long sample text.

Forwarded message:

> From: Donations Team <giving@example2.org>
> To: jeff@myemail.us
> Subject: Thank you for your support!
>
> Dear Jeffrey,
>
> Our heartfelt thanks for your donation to Example Project, 
> especially now. Together we will write the future.

论坛帖子中的消息(两种模式表现相同):

Some really long sample text.

Forwarded message:

将消息作为附件转发似乎也不起作用。eml 附件会被拒绝。如果允许 eml 附件,那么在“创建回复”模式下,它会附加 eml 文件,论坛访客可以选择下载它。

有没有办法让电子邮件通知显示转发的邮件内容?

当设置如下:

  • forwarded_emails_behaviour 设为 “quote”,且
  • always_show_trimmed_content 设为 on

我们的 Discourse 网站(2.6.0 稳定版)在点击三个点时,会按预期显示转发的邮件:

然而,电子邮件通知却完全省略了转发的邮件内容:

1 个赞