HTML customization for certain emails

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.

1 Like

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:

<div data-user-posted>
%{header_instructions}

%{message}

%{context}

%{respond_instructions}
</div>

I then added the following CSS rule to the CSS tab of my Customize / Email Style page:

[data-user-posted] {
    color: #ffffff;
    background: #000000;
}

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.

7 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.