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, которую я до конца не понимаю — похоже, что последняя не используется, если есть шаблон, но я не уверен, когда шаблона нет! Но aside от этого, главное в том, что если бы функция, создающая пользовательские заголовки, использовала тот же шаблон, это сработало бы, и пользовательские заголовки могли бы содержать полезную динамическую информацию.

2 лайка