Adding custom content to summary emails

email

(Neil Lalonde) #1

Today I added a way to insert custom html and text to digest/summary emails. In the past, only the colour scheme could be customized. Now you can insert arbitrary html using the existing Admin > Customize > Text Content interface and searching for “digest.custom”. Narrow it down to the html emails with “digest.custom.html”.

Setting the header field will replace the default header, which is currently your site’s logo on the left side.

The rest of the fields can be used to insert banner ads, special offers, additional unsubscribe instructions, important announcements, and anything else that should be targeted at users who haven’t been on your site for a while.


Can I customize the email 'container' html too?
Summary Email Changes
Summary Email Changes
Customize emails in mailing list mode
(Holly Ross) #2

Huge thank you @neil! We have put this to great use in our community.


(AstonJ) #3

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?


(Neil Lalonde) #4

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.


(AstonJ) #5

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.


(Leah Kramer) #6

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 discoursehosting.com which always has the latest stable release of Discourse. I’m not actually sure how to figure out what version it is.)


(Jeff Atwood) #7

View source to read the version meta-tag


(Leah Kramer) #8

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?


(Neil Lalonde) #9

Yes that explains it. The stable branch will get the custom outlets for summary emails when 1.7 is released.


(Leah Kramer) #10

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.


(Neil Lalonde) #11

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.


(Pad Pors) #12

can one change font of the email digest using these strings?
has anyone tried changing the font of emails so far?