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

**URL:** https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653
**Category:** Development
**Tags:** activity-summary
**Created:** [4월 26, 2017, 4:35오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653 "2017-04-26T16:35:45Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![broz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/broz/32/61170_2.png) [@broz](https://meta.discourse.org/u/broz)
#### Post date: [4월 26, 2017, 4:35오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/1 "2017-04-26T16:35:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [4월 26, 2017, 5:32오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/2 "2017-04-26T17:32:08Z")

</div>

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:

> <https://github.com/discourse/discourse/blob/main/app/views/user_notifications/digest.html.erb>

---

<div class="post-metadata">

### Author: ![broz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/broz/32/61170_2.png) [@broz](https://meta.discourse.org/u/broz)
#### Post date: [4월 27, 2017, 6:23오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/3 "2017-04-27T18:23:42Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [4월 27, 2017, 7:50오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/4 "2017-04-27T19:50:39Z")

</div>

Unfortunately I don’t think `.erb` templates can be overridden in plugins, although maybe someone on the [@team](https://meta.discourse.org/groups/team) could correct me.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [4월 27, 2017, 8:04오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/5 "2017-04-27T20:04:57Z")

</div>

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…

- Create a new scheduled job in the plugin that is the same as [enqueue\_digest\_emails.rb](https://github.com/discourse/discourse/blob/master/app/jobs/scheduled/enqueue_digest_emails.rb) but will queue your new email. `Jobs.enqueue(:my_custom_digest_email, user_id: user_id)`
- Create your new mailer in `app/mailers`. Copy [the digest method from the user\_notifications.rb mailer](https://github.com/discourse/discourse/blob/master/app/mailers/user_notifications.rb#L99-L178) into your mailer.
- Put your new template for the email in `app/views/mailers/my_custom_digest_email`.

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

---

<div class="post-metadata">

### Author: ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)
#### Post date: [5월 25, 2017, 4:34오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/6 "2017-05-25T16:34:00Z")

</div>

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!

 ![](https://global.discourse-cdn.com/meta/original/3X/e/6/e6d97b471f206008d55b00c44d4e81886424aa82.png) ![](https://global.discourse-cdn.com/meta/original/3X/9/0/903449358a09abab0f923057ffbb9b1c01021f86.png)

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [6월 12, 2017, 5:27오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/7 "2017-06-12T17:27:47Z")

</div>

Where can I find this file in my server? I need to change it manually. As reported [here](https://meta.discourse.org/t/emails-for-rtl-languages-have-ltr-direction/41972), digest emails have serious problems with rtl language and I cant wait till it gets fixed.

---

<div class="post-metadata">

### Author: ![hellorich](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@hellorich](https://meta.discourse.org/u/hellorich)
#### Post date: [7월 25, 2017, 2:16오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/8 "2017-07-25T14:16:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [8월 26, 2017, 1:15오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/9 "2017-08-26T13:15:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mbcahyono](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbcahyono/32/97721_2.png) [@mbcahyono](https://meta.discourse.org/u/mbcahyono)
#### Post date: [8월 26, 2017, 3:04오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/10 "2017-08-26T15:04:06Z")

</div>

> [@neil](#):
>
> The .erb template can’t be overridden by a plugin.

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [8월 28, 2017, 11:49오전 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/11 "2017-08-28T11:49:36Z")

</div>

Feel free to publish it in the #Customization > Plugin category

---

<div class="post-metadata">

### Author: ![mbcahyono](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbcahyono/32/97721_2.png) [@mbcahyono](https://meta.discourse.org/u/mbcahyono)
#### Post date: [8월 29, 2017, 10:38오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/12 "2017-08-29T22:38:17Z")

</div>

I have published it:

> [@Example Plugin: Custom Activity Summary Template](https://meta.discourse.org/t/example-plugin-custom-activity-summary-template/69016):
>
> Hey everyone, I have created an example plugin to override default Activity Summary (digest) template: [https://github.com/muhlisbc/discourse-custom-activity-summary-template](https://github.com/muhlisbc/discourse-custom-activity-summary-template) Screenshot: [[image] ](https://raw.githubusercontent.com/muhlisbc/discourse-custom-activity-summary-template/master/custom-digest1.jpg)[[image] ](https://raw.githubusercontent.com/muhlisbc/discourse-custom-activity-summary-template/master/custom-digest2.jpg) The main purpose of this plugin is to show how to override default .erb templates on Discourse. I hope this helpful for someone.

---

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [10월 12, 2017, 1:47오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/13 "2017-10-12T13:47:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Quintin\_Par](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/quintin_par/32/120500_2.png) [@Quintin\_Par](https://meta.discourse.org/u/Quintin_Par)
#### Post date: [11월 27, 2017, 12:15오전 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/14 "2017-11-27T00:15:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [12월 5, 2017, 2:50오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/15 "2017-12-05T14:50:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![davedogs](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@davedogs](https://meta.discourse.org/u/davedogs)
#### Post date: [4월 21, 2018, 12:09오전 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/16 "2018-04-21T00:09:07Z")

</div>

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

thanks!

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [4월 22, 2018, 12:11오전 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/17 "2018-04-22T00:11:39Z")

</div>

@davedogs Is this not what you want:

> [@Example Plugin: Custom Activity Summary Template](https://meta.discourse.org/t/example-plugin-custom-activity-summary-template/69016?source_topic_id=61653):
>
> Hey everyone, I have created an example plugin to override default Activity Summary (digest) template: [https://github.com/muhlisbc/discourse-custom-activity-summary-template](https://github.com/muhlisbc/discourse-custom-activity-summary-template) Screenshot: [[image] ](https://raw.githubusercontent.com/muhlisbc/discourse-custom-activity-summary-template/master/custom-digest1.jpg)[[image] ](https://raw.githubusercontent.com/muhlisbc/discourse-custom-activity-summary-template/master/custom-digest2.jpg) The main purpose of this plugin is to show how to override default .erb templates on Discourse. I hope this helpful for someone.

---

<div class="post-metadata">

### Author: ![Mittals](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mittals](https://meta.discourse.org/u/Mittals)
#### Post date: [1월 24, 2019, 8:43오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/18 "2019-01-24T20:43:26Z")

</div>

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](https://apidock.com/rails/ActionView/ViewPaths/prepend_view_path))  
::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.

---

<div class="post-metadata">

### Author: ![Mittals](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Mittals](https://meta.discourse.org/u/Mittals)
#### Post date: [1월 24, 2019, 11:17오후 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/19 "2019-01-24T23:17:03Z")

</div>

Found the [solution in this topic](https://meta.discourse.org/t/replacing-email-notification-html-via-custom-plugin-tips/87529/3)

---

<div class="post-metadata">

### Author: ![evantill](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evantill/32/116219_2.png) [@evantill](https://meta.discourse.org/u/evantill)
#### Post date: [4월 16, 2020, 7:21오전 UTC](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653/20 "2020-04-16T07:21:54Z")

</div>

요약 다이제스트 이메일을 커스터마이즈하려고 합니다. 이 주제에 따르면 가능해 보입니다:

> [@Mittals](#):
>
> [이 주제에서 해결책을 찾았습니다](https://meta.discourse.org/t/replacing-email-notification-html-via-custom-plugin-tips/87529/3)

이메일 설정의 `apply custom styles to digest`가 활성화되어 있지만, 커스터마이즈할 수 있는 이메일 템플릿 목록에서 요약 이메일을 찾을 수 없습니다.

요약 이메일용 커스터마이즈 템플릿을 어디에서 찾을 수 있나요?

[다음 페이지](https://meta.discourse.org/t/how-to-change-the-style-of-the-email-template-of-the-digest/61653.md?page=2)
