Customs email headers and/or subjects tags


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-Component: Server Operations
X-Bugzilla-Version: other
X-Bugzilla-Severity: normal
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: –
X-Bugzilla-Target-Milestone: —
X-Bugzilla-OS: Linux
X-Bugzilla-Changed-Fields: Status Resolution
X-Bugzilla-Changed-Field-Names: bug_status resolution



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.


For those who are wondering how to set the custom email header, here it is.

  1. Go to your Settings Panel >> Email or use below link, you should replace the domain name with your own.

  2. Search for email custom headers, and set your own. That’s it!

Can formatting things like %{optional_pm}%{optional_cat}%{topic_title} go in the custom headers?

1 Like

For the record, I just tested this, and the answer is: nope, no expansion. I get, for example

X-Tags: %{optional_tags}

1 Like

I’m not seeing anywhere in the code where something like %{optional_tags} would get substituted into a header that’s been added to the email custom headers site setting. What I am finding is this method that’s used for setting the value of custom headers:

It’s called from:

I’ll try to get some more details from the Discourse team about how the setting is intended to be used and what values could be substituted into custom headers.

@simon Compare


There is some complexity with templates vs. the email_subject setting which I don’t completely understand — it looks like the latter isn’t used if there is is a template, but I’m not sure when there isn’t a template! But that aside, the basic thing is that if the function that built the custom headers used the same templating, this would work and the custom headers could have useful dynamic information.