Customs email headers and/or subjects tags

AI 生成的摘要

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. 搜索 邮件自定义头,然后设置您自己的内容。就这么简单!

自定义头部中可以放入 %{optional_pm}%{optional_cat}%{topic_title} 这样的格式化内容吗?

1 个赞

就我所知,我刚刚测试过,答案是:不行,没有扩展。我得到例如

X-Tags: %{optional_tags}

1 个赞

我没有在代码的任何地方看到类似 %{optional_tags} 的内容会被替换到 email custom headers 站点设置中添加的标头里。我发现的是这个用于设置自定义标头值的方法:

它被调用自:

我将尝试从 Discourse 团队获取更多关于该设置预期用途以及可以替换到自定义标头中的值的详细信息。

@simon 比较

和

模板和 email_subject 设置之间存在一些复杂性,我不太明白——看起来如果存在模板,后者就不会被使用,但我不确定没有模板时会怎样!但除此之外,基本情况是,如果构建自定义标头的函数使用了相同的模板,这将起作用,并且自定义标头可以包含有用的动态信息。

2 个赞