`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.

転送されたメールが表示されないという問題がまだ続いています。添付ファイルを含むメールが正しくレンダリングされたものが少なくとも 1 つあるため、私の推測では、転送者がメールに何かを追加したかどうかに関係しているようです。私の観察では、転送されたメールの上にテキストを追加せずに転送されたメールは正しくレンダリングされましたが、転送者が「FYI」のようなものを追加した場合、投稿には添付ファイルのみが含まれ、転送されたメールの本文は含まれません。

つまり、この例はまだ機能しません(「Thought you all should see this:」が含まれているため):

上記の結果の代わりに、このメールは次のようにレンダリングされます:

Thought you all should see this:

それ以上何も表示されません。

この問題が私のインスタンス固有のものなのか、それとも他の場所でも存在するのか、確認していただけませんか?

特に添付ファイル(例:PDF ファイル)を含むメールを確認してください。テキストが追加されている場合かつ添付ファイルが存在する場合にのみ問題が発生する可能性があります。

私も、これらの異なるラベルや機能の役割がまだよくわかりません。チケットプラグイン :tickets: と連携させるために受信メールの設定を試みていますが、挙動が一貫していません。

デフォルトの動作としては、転送されたメールが、そのメールを作成した(ステージングユーザーまたは通常ユーザー)によって投稿されるべきだと考えています。メールが転送される理由の多くは、メールを受け取った誰かが、Discourse で対応したほうが良いと感じたためです。そのため、そのトピックはメールの作成者によって開始されるのが最も適切だと考えられます。

(ただし、私のユースケースが実際にはエッジケースなのかもしれませんが…)

enable_forwarded_emailscreate_replies に設定すると、そのように動作するはずです。転送されたメールが最初の投稿となり、転送者がテキストを記述した場合は返信が作成されます。それ以外の場合は、誰が最初の投稿を転送したかが明確になるよう、小さなアクション投稿が作成されます。

「いいね!」 2

はい、ようやく理解できたと思います。

forwarded emails behaviour サイト設定の値として create_replies が選択されている場合、元のメッセージがトピックの最初の投稿となり、転送されたメッセージのに書かれた内容は、第三者のメッセージのにあるトピックへの返信となります。:confused:

Q: このサイト設定の他の値、つまり hide または quote は、元の第三者のメッセージのみを処理し、それ以上は何も処理しないのでしょうか?

Microsoft Outlook クライアントから送信する際に発生している奇妙なエラーの原因が、これらの「create replies」の分割処理にあるのではないかと疑問に思っています。

追伸:この設定は、サイト設定の説明テキストからリンクされる FAQ/ハウツー記事に値するのではないでしょうか?私だけかもしれませんが、過去 7 年間でこれほど Discourse の設定に困惑したことはほとんどありません。あるいは、もっと :coffee: :smile: が必要なのかもしれません。

いいえ。転送されたメッセージの前にテキストがない場合、小さなアクション投稿が表示されます。

この機能はまだ実験的なものとしてマークされており、それには十分な理由があります。メールは通常、インラインで転送されます。そのため、転送されたメールを抽出するのは非常に困難です。なぜなら、各クライアントが元のメールヘッダーを転送する方法が異なるからです。中には、元の From ヘッダーのメールアドレスを非表示にしたり、ローカライズされたヘッダーを使用したりするものもあります。

メールがインラインではなく添付ファイルとして転送される場合、はるかにうまく機能するはずです(Discourse がこれをサポートしていることは 99% 確信しています)。

「いいね!」 1

[quote=“gerhard, post:14, topic:111501”]
添付ファイルとしてメールを転送する方が、インライン表示よりもはるかにうまく動作するはずです(Discourse はこれをサポートしていると99%確信しています)。[/quote]

処理を正しく行うには、その方がずっとクリーンな方法だということには同意します。なぜ私が添付ファイルを処理させられないのか不思議です(転送された添付ファイルの内容は投稿にタグ付けされた生コンテンツに含まれていますが、レンダリングされるのは「コメント」だけで、転送された元の内容は表示されません。少なくとも MS Outlook の場合の話です。他のクライアントでも試してみます。)

「いいね!」 1

もしかして結局実装されていないのでしょうか?まだコードを見ていません。:blush:
他のクライアントでも動作するかどうか、ご報告ください。

「いいね!」 1

quote モードと create_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 形式の添付ファイルが許可されている場合、「create_replies」モードでは eml ファイルが添付され、フォーラムの訪問者はそれをダウンロードするオプションを持つようになります。

転送されたメールメッセージをメール通知に表示させる方法はありますか?

  • forwarded_emails_behaviour を “quote” に設定し、
  • always_show_trimmed_contentオン に設定すると、

Discourse サイト(2.6.0、stable)では、三点リーダーをクリックすると、転送されたメールが期待通りに表示されます:

ただし、メール通知では転送されたメールが完全に省略されています:

「いいね!」 1