Customize subject format for standard emails


Hi all,

Don’t know this is the correct place to ask this question. Can someone tell, what are the “standard emails” in Discourse. In the Admin / Settings / Email / email subject it says, “Customizable subject format for standard emails”.


(Jiamin Zhu) #22

I would also love to have bracket removed. Or if that’s not possible, if there another way to get category name?

(Tarek Loubani) #23

Hello friends,

I am trying to show only the subcategory, since I have unfortunately long descriptions for categories and subcategories. Several iphone users report the emails don’t show the actual topic due to this. I have reduced the community name to 3 letters, but not sure how to get only the subcategory. Any thoughts?

(Tarek Loubani) #24

By way of follow-up, I’ve found the line responsible, but can’t figure out how to properly access the “subcategory” variable:

This is line #68 in lib/email/message_builder.rb:

subject.gsub!("%{optional_cat}", @template_args[:show_category_in_subject] ? "[#{@template_args[:show_category_in_subject]}] " : '')

Obviously the variable includes both category and subcategory. Any ideas how I could blow these apart and only take the sub-category?

(Steve) #25

I was trying to only show the subcategory. On my site, the categories simply group the subcategories. On an email, category isn’t as important as subcategory.

(Tarek Loubani) #26

Any luck with this? I haven’t yet had any figuring out how to show only subcategories.

(Steve) #27

The only solution I found was to move the subcategories into categories. I also made the category names shorter.

(Alex Armstrong) #28

I’d also be interested in only having a field that showed: subcategory OR category. In other words, that would show the subcategory, if available, or the category otherwise.

(Peter N Lewis) #29

In the Admin settings, there is a field for “email prefix” - which says “The [label] used in the subject of emails. It will default to ‘title’ if not set.”. I have this set, and my “email subject” set to “%{optional_re}[%{site_name}] %{optional_pm}%{topic_title}” but the former is not used, the site title is used instead.

How does one use the “email prefix” in the subject? Or should I just repeat it explicitly?

(Peter N Lewis) #30

Actually, looking back, it appears this might be a regression in around June 2017. At least, that was the time the email subject changed to stop honouring the “email prefix” setting.

(Alex Armstrong) #31

I find it amusing when I search for how to do something on Meta and find that I’ve searched for it before (and failed to find a solution):


(Sam Saffron) split this topic #32

A post was split to a new topic: Allow adding tags as a custom format for emails

(Jothan Frakes) #33

on email subject line, topic_title token is being sent as the topic id # instead of the actual text of the topic

How does one make the topic text instead of the topic number?