Customize subject format for standard emails

(Sanket Nadhani) #14

How about customizing the digest email? I wanted to show the name of one or more posts (ideally the most popular post) in the subject instead of the standard [Community Name] Digest which doesn’t look fresh/inviting.

Couldn’t find any literature on that - any help?

Customize subject format for digest emails
(Michael Downey) #15

Unfortunately it’s not (yet) possible.

(Pablo Macaluso) #16

How to remove the

Thats make my emails as spam.


On my installation there is no trailing whitespace after %{optional_pm}, everything else works.

(Allen - Watchman Monitoring) #18

What indicates that that [brackets] are a problem?

You might try inviting an email from to your forum, and see how it rates the message.

1 Like
(Clay Heaton) #19

I’m dealing with people who won’t know what PM means… Is it possible to change that text anywhere?

(Mariel Matze) #20

Hi all,

I’m finding that the %{optional_cat} returns the topic’s original category, not current category. Is there a way to make the category in email notification subject lines update according to the topic’s current categorization?



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?

1 Like
(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

(Simon Cossar) split this topic #33

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