今天我添加了一个功能,允许在摘要邮件中插入自定义 HTML 和文本。过去,仅能自定义配色方案。现在,你可以通过 管理 > 外观 > 站点文本 界面,搜索 “digest.custom” 来插入任意 HTML。若要专门针对 HTML 邮件,请进一步筛选为 “digest.custom.html”。
设置 header 字段将替换默认页眉,目前默认页眉是位于左侧的站点标志。
其余字段可用于插入横幅广告、特别优惠、额外的退订说明、重要公告,以及任何需要针对长时间未访问站点用户的其他内容。
今天我添加了一个功能,允许在摘要邮件中插入自定义 HTML 和文本。过去,仅能自定义配色方案。现在,你可以通过 管理 > 外观 > 站点文本 界面,搜索 “digest.custom” 来插入任意 HTML。若要专门针对 HTML 邮件,请进一步筛选为 “digest.custom.html”。
设置 header 字段将替换默认页眉,目前默认页眉是位于左侧的站点标志。
其余字段可用于插入横幅广告、特别优惠、额外的退订说明、重要公告,以及任何需要针对长时间未访问站点用户的其他内容。
Huge thank you @neil! We have put this to great use in our community.
Hi @neil, there seems to be a small issue with this - when you use the below popular topics template it does not include the There were 22 other new topics bit. This prevents us from adding extra blocks/sections to the mailer without it looking awkward:
Ideally There were 22 other new topics would appear above any customisations made here - would you agree?
Hmm, here’s another example of that outlet being used:

I think it makes sense when the category breakdown is rendered. For some reason your digests can’t get that, so that string is rendered instead.
Maybe because some of our categories are members-only?
Is there any other way to get custom html right at the bottom of the digest? Even in your example above I would argue that the sponsor messages should be below all regular content (or the template should be labelled as above 'new discussions since last visit' block).
If not, can I hack the template directly to change this? (Are there any links on how to do this please?).
Edit: I’ve worked around it by using the ‘above footer’ template.
Hi Neil. We’re looking to do something exactly like what you describe. But when I go to Admin > Customize > Text Content and search for digest.custom, I don’t get any results. (I can search for other terms and find them but not digest.custom.)
Is this part of a beta version of Discourse?
(The forum I’m working on is hosted by Communiteq (formerly DiscourseHosting) which always has the latest stable release of Discourse. I’m not actually sure how to figure out what version it is.)
View source to read the version meta-tag
Thanks for that info @codinghorror. Looks like we’re running Discourse 1.6.3. Does that seem to explain why we don’t find digest.custom on that screen?
Yes that explains it. The stable branch will get the custom outlets for summary emails when 1.7 is released.
Hi @neil. I have a question about this general topic. Does Discourse strip it out any formatting in the custom content such as inline css or table tags?
Our goal is to insert into certain emails, a blob of html which says:
Brought to you by: LOGO LOGO LOGO LOGO
Since we’re using the current stable branch (1.6.3) and we don’t have access to any of the “digest.custom” overrides, I’m attempting to stick this html into some other overrideable field such as “user_notifications.reply_by_email”.
So for example, I change:
user_notifications.reply_by_email
[Visit Topic](%{base_url}%{url}) or reply to this email to respond.
to:
user_notifications.reply_by_email
[Visit Topic](%{base_url}%{url}) or reply to this email to respond. MY-BLOB-OF-HTML-GOES-HERE
The problem I’m encountering is that somewhere along the line, any inline css within my blob of html is being stripped. Does Discourse strip the inline css out? It doesn’t appear that my email reader is doing the stripping (I tried gmail and one other) but the inline css is missing by the time it reaches my inbox.
The digest.custom.html values won’t be stripped of inline css or html tags. The problem you’re having with the reply_by_email string is because it’s processed as markdown, so html is being stripped out.
can one change font of the email digest using these strings?
has anyone tried changing the font of emails so far?
这个问题有什么解决方案?我有点像 Markdown 新手。
您可以多谈谈您想做什么、您尝试了什么、发生了什么以及这与您想要发生的情况有何不同。
抱歉!我将此内容输入了 user_notifications.digest.custom.html.header 的文本内容字段。我期望它能通过 CSS 将文本居中。
<p style="text-align:center;">
The Postcall community thrives when you add to the conversation.
<strong>Jump into one of the topics below and reply to someone in need!</strong>
</p>
保存/刷新后,它变成了这样(已移除内联 CSS):
<p>
The Postcall community thrives when you add to the conversation.
<strong>Jump into one of the topics below and reply to someone in need!</strong>
</p>