How to change the style of the email template of the digest?

AI-generated summary

Users are seeking ways to customize the CSS styling and layout of Discourse’s digest email template, particularly the header image size and category badge styling, which currently cannot be altered via standard site settings or plugins due to hardcoded .erb templates. eviltrout explains that only the logo is editable, and while plugins can’t override .erb files directly, neil suggests creating a custom email system via a plugin — including a new scheduled job, mailer, and view template — as a workaround. mbcahyono later confirms that overriding the template is possible via plugin and shares an example plugin sam encourages publishing. Others like bts and schungx highlight the need for larger header images, while hnaseri seeks manual file access for RTL fixes. Mittals shares a solution for overriding email templates via prepend_view_path, later found in a related topic. evantill asks where to find the digest template in custom email settings, and codinghorror advises searching for unique text in the email copy to locate it. cathys confirms interest in styling only digest emails, not notifications. As of 2017, full HTML template customization remains unsupported without plugins or code changes.

Hi, i would like to change the css style of the recap template (digest), that is sent to users.

Unfortunately the only part of the digest that is editable is the logo, which can be done via site settings.

CSS in email is quite a tricky task, so we’ve hardcoded the styles in the template:

Hi @eviltrout, thank you very much for the answer, i really appreciate it.
Is there a way to overwrite this file? Maybe with a plugin?

Unfortunately I don’t think .erb templates can be overridden in plugins, although maybe someone on the @team could correct me.

The .erb template can’t be overridden by a plugin.

Car Talk has its own digest emails. How we did that in a plugin was to treat it as a new email entirely. You could disable Discourse’s default digest emails and then use your own. It’s more complicated than making a new template though…

Not ideal, but gives you a lot of freedom to customize the data and logic.

One small thing that could be useful here: a way to change the header image size for this email. See below images — in the first (default) the header image is almost comically tiny (40px height). The latter I tried making three times larger (120px, the actual size of the uploaded image) and it looks much better. Not sure if there’s any way to do this currently but would be nice to be able to use the larger image!

Where can I find this file in my server? I need to change it manually. As reported here, digest emails have serious problems with rtl language and I cant wait till it gets fixed.

Is there anyway to style the element span.badge-category-bg used in the New for you section of these emails? I’ve noticed there’s some inheritence of styling from the customisable stylesheets into the digest, and we have a problem where these items are not sized properly in email clients.

Me too. 40px just isn’t large enough to have the logo blend in with the rest of the template, which uses HUGE fonts.

It can.
I have created a plugin for client to override the default digest template.

Veröffentlichen Sie es gerne in der Kategorie Customization > Plugin

I have published it:

I wonder if there’s a better way to do that now, which does not require a custom plugin nor direct code editing?

November 2017 calling. Is it possible to customize all parts of the email now? Use our own html template?

Sadly, I don’t think the state of the art in emails have progressed much…

@neil can you clarify why it isn’t possible to override an erb template with a plugin?

thanks!

@davedogs Is this not what you want:

I tried something similar for ActionViews but it did not work (need it to change the template for user notification emails)

::ActionView::Base.prepend_view_path File.expand_path(“../custom_views”, FILE)

Tried this as well (from here)
::ActionViews::ViewPaths.prepend_view_path File.expand_path(“../custom_views”, FILE)

Any ideas? New to Ruby/Rails so pardon my mistakes.

Edit: Not working means discourse won’t start.

Found the solution in this topic

Ich versuche, die Zusammenfassungs-E-Mail anzupassen. Laut diesem Thema scheint das möglich zu sein:

Die E-Mail-Einstellung „Benutzerdefinierte Stile auf Zusammenfassung anwenden