Plaintext and / or raw emails for mailing list mode


(Greg) #1

Hi all,

As my Google Groups migration gathers pace, a few users have suggested a couple of things that might make sense, and I wanted to see if I missed an option for these, or if perhaps patches would be welcome…

Firstly, the emails sent out are of course HTML + text, but the plaintext version is actually just the markdown that was written. This makes quotes and inline images both appear a bit weird:

[quote="Gwmngilfen, post:36, topic:7472, full:true"]
blah blah
[/quote]
![image|677x500](upload://ked5br4s5WmtG5wWf8O7a7dmev6.png)

It would be great if we could do some kind of HTML-to-plaintext render before sending it out, so that we get something more like:

> blah blah
https://mydiscourseorg/uploads/default/optimized/1X/8dc6b8e02d074eb09ab3017561ef6c2fda5b9c00=_1_677x500.png

Perhaps as a user-level setting?

Another request they had was about the reply quoting - Discourse trims most quoted material when it receives a mail, and that’s understandable for the UI. But since we store the raw email that came in (visible via the :e-mail: icon), is there any reason not to send that raw mail back out again? It feels like it would satisfy many mailing list mode users, but I’m probably missing a reason :wink:. Again, this could potentially be a user setting, I think.

Thoughts on either of these? I’m willing to attempt patches if they’re of interest… might need some hand holding though :slight_smile:


(Sam Saffron) #2

We have a HTML summary convertor in Nokogiri but it not rich enough for this purpose, it would need to be extended. I think we would be open to a pull request that did a richer HTML -> text conversion, it is a fair bit of work with lots of edge cases. So, at least initially, it would have to be default off. (and it would need lots of tests)

I think it is complicated, especially in mixed (HTML+text) mode and especially if you want to account for edits and such. Feel free to try it out and report how it works out for you.

Also email is formatted in Markdown, we assume what you send us is Markdown and since there is no JavaScript in email we can not suppress the full context from the UI, which can lead to pages of scrolling just to find the link or unsubscribe button.


(Greg) #3

I’ll see what I can do, might be a while though :wink:

I agree, it’s got a lot of edges. Obviously this only applies when Discourse has received a mail, for posts written in the UI all the usual rules apply. My thinking is that sending out the raw email received (plus unsubscribe footer, and a few altered headers, of course) is exactly what you’d expect of a mailing list, so it may satisfy some users. I think it should be fairly straightforward for us to test, I’ll let you know how it works out.