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”.


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

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?

1 Like

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?


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.

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

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

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.


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?

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.

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):



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

A post was merged into an existing topic: Email headers showing post ID #

Hello, hope you are all keeping well. This is my first post in this forum. So a big hello to you all.

I am here with an issue which I think is quite trivial for you to resolve.
I’ve read this document several times to do permutation and combination with settings but still don’t get a Topic Title in the Email Subject.

Tried both mailing-list mode and non-mode.

All that I get in the subject is “Topic #45” … the number changes for each topic but that is not informative enough.

I’ve configured Amazon SES for email.

In Admin >> Email >> Email Subject
I’ve tried with both these options
%{optional_re}[%{site_name}] %{optional_pm}%{optional_cat}%{topic_title}
and just
but no luck.

Can you kindly advice on what could be done to fix this.
Do let me know if you would need any more info as well.
Thank you.

It sounds like you have enabled secure email mode in your site settings, to prevent any content from leaking out via email? If you do that, then you get the described behavior.


@codinghorror Dear Jeff, many thanks for the valuable reply.
I was off as we had a baby.

What you say makes perfect sense, I quickly went through this discussion, Secure email mode

Kindly advice on how I can disable the secure email setting.
Many thanks once again.

Turn it off in your site settings?

1 Like

Thank you Jeff,
Got it!
Settings>> Email >> Private Email
Adding this for posterity.


At least on my instance, this currently returns tags without the brackets, which can be confusing. I’m not advocating for the brackets though, instead I’d prefer the tags to appear like:

%{optional_tags}#tag1 #tag2 #tag3


I’m really sorry to be this guy, but can someone please explain this like I’m 5? What are %{these} mysterious things?

And more importantly, can someone provide me with a before/ after example of how to properly use the email template editor in the admin settings?

“Before” being an actual email template from the settings, and “after” being an example of a properly edited template that is ready for implementation.

I would really appreciate it!

Edit: bump