# 用于定制摘要和通知邮件的钩子

**URL:** <https://meta.discourse.org/t/hooks-for-customization-of-digest-and-notification-emails/164394>\
**Category:** Feature\
**Created:** [2020 年9 月 17 日 22:13 UTC](https://meta.discourse.org/t/hooks-for-customization-of-digest-and-notification-emails/164394 "2020-09-17T22:13:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
发布日期： [2020 年9 月 17 日 22:13 UTC](https://meta.discourse.org/t/hooks-for-customization-of-digest-and-notification-emails/164394/1 "2020-09-17T22:13:46Z")

</div>

我有一位客户希望在摘要邮件和通知邮件中包含广告。我“制作”了一个[插件](https://github.com/pfaffman/discourse-add-to-summary)，允许在摘要邮件中添加一些文本（我认为该插件需要更新，以跟上模板的变更）。

我不喜欢为了自定义这些邮件而必须覆盖整个模板的做法。

是否有可能提供一种方式，在不覆盖模板的情况下向这些邮件添加内容？

该插件的工作原理是：通过自定义字段获取一个主题 ID，并将该主题中最新帖子的 `raw` 内容作为文本添加到邮件中（位于标题之前或之后）。虽然我认为这是一个相当巧妙的技巧，但似乎作为核心功能建议添加显得过于繁琐。也许可以让广告插件能够向摘要和汇总邮件应用内部广告？

### 管理脆弱的插件

也许我应该编写一个测试规范，比较开启插件但未配置添加任何内容时的摘要邮件，与关闭插件时的摘要邮件？这样我就能捕捉到核心模板的变更。

---

_[View the full topic](https://meta.discourse.org/t/hooks-for-customization-of-digest-and-notification-emails/164394)._
