The discussion revolves around customizing HTML for specific email templates in Discourse. hollyw inquires about adding HTML customization to email templates under Customize > Email, as well as notification emails. simon responds that all emails are wrapped in the template set in Customize > Email Style > HTML Template, except for summary emails when a specific site setting is deselected.
simon confirms that HTML can be added to email templates for specific email types in Customize > Email. However, only HTML that won’t be stripped out by Discourse can be added. To illustrate this, simon provides an example of adding HTML and CSS to the User Posted email template and Email Style page, which works as expected.
It’s essential to note that email display depends on the client used, so testing customizations on multiple popular email clients is recommended to ensure compatibility.
I know under Admin I can go to Customize > Email Style to customize the template that’s used for HTML emails.
My question is whether we’re able to add HTML customization to the other emails under Customize > Email. This contains lots of different templates for things like “Account Created” and such. I know we can change the text in those emails, but is there any way to customize with HTML?
I have the same question about the notification emails that users can receive, like when someone responds to their post or mentions them. Are those customizable with HTML?
I found this thread asking a similar question, but back then it appeared to not be something that was available, and I’d like to confirm whether that’s still the case.
All emails sent from your site will be wrapped in the email template that’s set on your Customize / Email Style / HTML Template section. The only exception to this that I’m aware of is that you can deselect the apply custom styles to digest site setting so that summary emails do not use the custom email template.
It is possible to add HTML to email templates for specific email types. This is done in the Customize / Email section of your site. These templates will be wrapped in the email template that is set in your Customize / Email Style / HTML Template section.
You can only add HTML to these templates that will not get stripped out by Discourse when the template is saved.
To test out this functionality, I set the User Posted email template on my development site to:
The CSS gets added as inline styles to the div and is displayed correctly in the email.
One thing to keep in mind with any customizations you make to emails is that the display of emails is dependent on the client that the email is viewed on. If you are making complex changes, it would be good to test them on a few popular email clients so that you know how they will be displayed.