HTML Entities and escape characters in text/plain outgoing email alternative

We recently setup an experimental Discourse instance and noticed that the posts sent to watchers contain HTML entities in the text/plain alternative version of them. Sounds like a bug to me.

The instance is here: https://discourse.osgeo.org
Screenshot of one such email can be seen here: Sandro Santilli: "@pmusaraj@mstdn.ca I can tell, and that hurts! @D…" - Mapstodon.space
The compete email can be read from discourse itself here: PSC Vote: Let's move this list to discourse - #11 by Martin_Spott - SAC mailing list - OSGeo
And another view of the email can be read on the Mailman archive, which is how it reached Discourse: PSC Vote: Let's move this list to discourse

The mail received by Mailman to subscriber is ONLY text/plain 7bit us-ascii but the one received via Discourse becomes multi-part and also has an HTML version which is obviously made up as the original poster did not write in HTML

1 Like

Downstream ticket: #3073 (Discourse email having malformed text) – OSGeo

2 Likes

The upstream ticket is unanswered for 4 days now, I suspect neither Discourse dev nor Discourse proponent care about email mediated communication, making this problem’s only possible fix being a “scratch your own itch” project.

We do care about email mediated communications, that’s why we put an extensive amount of work adding support for both incoming and outgoing emails in Discourse. That said, it’s a tremendously difficult task to account for every use cases as those often conflict with one another.

Trying to diagnose your issue and better understand your user case, here’s how I understand things are going

  • Your instance is setup to receive incoming email from a mailing list
  • The user “Martin_Spott” sent a text/plain email to your mailling list
  • Discourse processed the email, transforming the plain text into markdown / html to be displayed in Discourse
  • You received a copy of that email, because you’re watching that topic / category on Discourse
  • The content of that email is mangled

Am I correct?

2 Likes

Well, what happens inside Discourse I don’t know but what I observe is:

  • Our instance is setup to receive incoming email ( from anything )
  • trac.osgeo.org sends text/plain emails to the Discourse incoming email address, assuming monospace fonts are used
  • Discourse does something I dunno
  • Users of Discourse who opted to receive email notifications receive a multipart email containing an html and a text/plain alternative, with the text/plain having dashes escaped and html entities in them

Now, the above mentioned problem (trac emails being malformed) seems to have been fixed at the moment but I don’t know by which event: https://trac.osgeo.org/osgeo/ticket/3073#comment:14

Could things have changed due to me toggling “Mailing List Mode” on and off ?

1 Like

I doubt it. It’s more likely the “incoming email prefer html” site setting.

Glad it’s better now :raised_hands:

1 Like

I talked too early: #3073 (Discourse text/plain email use html entities, markdown and backslash-escapes for no reason) – OSGeo

Are you suggesting it is beter to set “incoming email prefer html” to YES or NO ?

@robe2 mentioned the (temporary) fix was probably due to her unchecking the “Category is mirror” checkbox - hopefully this gives more information for a fix

Correct when I unchecked the “Category is mirror” the email being sent looked better and looking at the posts, they looked cleaner too.

However I had to check the box back because it was preventing threading and was also causing some emails from our ticket tracker to be rejected with rejection error Title has already been used