Customs email headers and/or subjects tags

AI-generated summary

Customs Email Headers and/or Subjects Tags

A discussion about adding custom email headers or subject tags to automatically sort notification emails sent by Discourse. XioNoX suggests using custom headers similar to Bugzilla’s notification emails.

downey points out a related discussion on showing categories in email notifications. downey also mentions that a category-specific List-Id header is now available, and users can add custom headers using the email custom headers site setting.

llc1990 provides instructions on how to set custom email headers. However, mattdm and mattdm discover that formatting using %{optional_pm}%{optional_cat}%{topic_title} does not work in custom headers.

simon investigates the code and finds that the custom headers setting does not support template substitution. mattdm suggests that using the same templating as the email subject setting could make custom headers more useful.

Hi!

To be able to sort automatically notification emails sent by Discourse, it would be great if they could have customs headers (or a subject tag) based on the message’s content/content:

For example, here is a list of headers Bugzilla sends with each notification email:

X-Bugzilla-Reason: CC AssignedTo
X-Bugzilla-Type: dep_changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Classification: Other
X-Bugzilla-ID: 1014331
X-Bugzilla-Product: mozilla.org
X-Bugzilla-Component: Server Operations
X-Bugzilla-Version: other
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: foobar@email.com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: –
X-Bugzilla-Assigned-To: email@email.com
X-Bugzilla-Target-Milestone: —
X-Bugzilla-Flags:
X-Bugzilla-OS: Linux
X-Bugzilla-Changed-Fields: Status Resolution
X-Bugzilla-Changed-Field-Names: bug_status resolution

Thanks!

「いいね!」 3

See also our discussion at:

Where we’re hoping to get categories in a header. :smile:

FYI, there is now a category-specific List-Id header sent along with unsubscribe headers, and the ability to add your own generic headers for all notifications with the email custom headers site setting.

「いいね!」 2

カスタムメールヘッダーの設定方法が気になる方のために、以下に手順を示します。

  1. 設定パネル >> メール に移動するか、以下のリンクを使用してください。
    https://forums.example.com/admin/site_settings/category/email。ドメイン名はご自身のものに置き換えてください。

  2. email custom headers を検索し、ご自身の設定を入力してください。これで完了です!

カスタムヘッダーに %{optional_pm}%{optional_cat}%{topic_title} のような書式設定を指定することはできますか?

「いいね!」 1

念のため、これをテストしたところ、答えは「いいえ、拡張はありません」でした。たとえば、次のような結果が得られます。

X-Tags: %{optional_tags}

「いいね!」 1

%{optional_tags} のようなものが email custom headers サイト設定に追加されたヘッダーに代入されるようなコードはどこにも見当たりません。カスタムヘッダーの値の設定に使用されているこのメソッドを見つけました。

これは以下から呼び出されています。

設定がどのように使用されることを意図しているのか、カスタムヘッダーに代入できる値は何かについて、Discourse チームから詳細情報を入手しようと思います。

@simon 比較してください。

と

テンプレートとemail_subject設定には複雑さがありますが、私はそれを完全に理解していません。テンプレートがある場合、後者は使用されないようですが、テンプレートがない場合はどうなるのかわかりません!しかし、それはさておき、基本的なことは、カスタムヘッダーを構築した関数が同じテンプレートを使用していれば、これは機能し、カスタムヘッダーには有用な動的な情報を含めることができるということです。

「いいね!」 2