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 « J'aime »

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 « J'aime »

Pour ceux qui se demandent comment définir l’en-tête e-mail personnalisé, le voici.

  1. Accédez à votre Panneau de paramètres >> E-mail ou utilisez le lien ci-dessous
    https://forums.example.com/admin/site_settings/category/email, vous devez remplacer le nom de domaine par le vôtre.

  2. Recherchez en-têtes e-mail personnalisés et définissez les vôtres. C’est tout !

Est-ce que des éléments de mise en forme comme %{optional_pm}%{optional_cat}%{topic_title} peuvent être placés dans les en-têtes personnalisés ?

1 « J'aime »

Pour information, je viens de tester cela, et la réponse est : non, pas d’expansion. J’obtiens, par exemple

X-Tags: %{optional_tags}

1 « J'aime »

Je ne vois nulle part dans le code où quelque chose comme %{optional_tags} serait substitué dans un en-tête qui a été ajouté au paramètre du site email custom headers. Ce que je trouve, c’est cette méthode qui est utilisée pour définir la valeur des en-têtes personnalisés :

Elle est appelée depuis :

J’essaierai d’obtenir plus de détails de l’équipe Discourse sur la manière dont le paramètre est censé être utilisé et quelles valeurs pourraient être substituées dans les en-têtes personnalisés.

@simon Compare

à

Il y a une certaine complexité avec les modèles par rapport au paramètre email_subject que je ne comprends pas complètement — il semble que ce dernier ne soit pas utilisé s’il y a un modèle, mais je ne suis pas sûr quand il n’y en a pas ! Mais au-delà de cela, l’essentiel est que si la fonction qui a construit les en-têtes personnalisés utilisait le même système de modèles, cela fonctionnerait et les en-têtes personnalisés pourraient contenir des informations dynamiques utiles.

2 « J'aime »