3.2.x still ignores some custom email templates

AI-generated summary

In a support thread titled “3.2.x still ignores some custom email templates,” nordize reports that in Discourse v3.2.2, customizations to email templates (e.g., user_notifications.user_watching_first_post.text_body_template) are being ignored — particularly for first posts in new topics. Despite editing templates in Admin > Customize > Text, emails still use default content including full post bodies. nordize also criticizes the limited, non-paginated search in Customize > Email (max 50 results, search only by code name), making it hard to find relevant templates. They also note that %{base_url} and other valid placeholders are still ignored, a bug previously reported here. JammyDodger confirms that bug reports here are appropriate, though prioritization varies. Osama clarifies that user_watching_first_post and user_watching_category_or_tag are the correct templates for new topic notifications — and confirms they work when edited — suggesting nordize check /admin/email/sent to verify which email type is being sent. Osama also agrees the hardcoded Customize > Email list is outdated and links to a PR to update it. nordize reiterates requests for better search, pagination, and mirroring template tags with friendly names — or removing the incomplete list entirely.

Using v3.2.2. I edited the “User Posted” email template body to say only

%{username} posted in "[%{topic_title}](%{url})".

--

but the email sent still uses the original template which includes the entire post body, etc.

This is when a new topic is created (first post).

I also edited other templates from the Admin > Customize > Text list, e.g. user_notifications.user_watching_first_post.text_body_template and user_notifications.user_watching_category_or_tag.text_body_template and all others I found that would match when a topic is created. It seems they are all ignored (I can’t say which one should be triggered though, it’s not very clear).

These above tags could also be mirrored with friendly names in the separate Customize > Email section, or just get rid of the latter entirely (having an incomplete list is more problematic than not having it at all).

Could you also please

  • allow more than 50 search results
  • provide some pagination or some other way to see all results
  • allow searching in the body and subject of the template (not just the template code name)

… it’s impossible to identify all templates of interest for certain things. E.g. searching for “post” lists some that are relevant to me, but a ton others, yet limited to first 50 and I can’t get to any others … asking me to refine my search is pointless as I don’t know what to search for if you only allow searching by template code name.

In addition, as reported quite a while ago, the custom email templates still ignore valid placeholder tags such as %{base_url}. That bug report apparently hasn’t reached anyone revant.

All these bugs seem to have been introduced in 3.0.

If reporting bugs here about email templates isn’t a good way to flag them to the maintainer, could someone point me to a better way, perhaps let me know who the maintainer of the email templates code is so I can ping them directly, or some other route?

Creating a Contribute > Bug report here is the way. :+1: Though we do have to prioritise what gets worked on at any given time so some may be slower than others depending on the amount of reports received and the perceived severity.

Can anyone help with the rails object name or rails console command to force a text for the notification on the first post of a topic?

For completion, the tags I listed in the first post should also be mirrored with friendly names in the Email tags list in Customize > Email section. Either that or get rid of the Customize > Email section entirely (having an incomplete list is more problematic than not having it at all).

Could you also please

  • allow more than 50 search results
  • provide some pagination or another way to see all results
  • allow searching in the body and subject of the template (not just the template code name)

… it’s impossible to identify all templates of interest for certain things. E.g. searching for “post” lists some that are relevant to me, but a ton others, yet limited to first 50 and I can’t get to any others … asking me to refine my search is pointless as I don’t know what to search for if you only allow searching by template code name.

(I added this to the 1st post for convenience)

The “User Posted” template is used for emailing about a new post in a topic that the user is watching. user_watching_first_post and user_watching_category_or_tag are used for emailing about new topics. I’ve tested editing those templates on my local instance and the changes do reflect in the emails that get sent:

Can you look in /admin/email/sent and see what email types are not getting the changes you’ve made to the template?

Yes, this is an excellent point. The list of email templates in /admin/customize/email_templates is hardcoded and hasn’t been updated for years so it’s missing many new emails that have been added. Here’s a PR to add all new templates:

https://github.com/discourse/discourse/pull/28075