Incoming HTML Email Inconsistent

AI 生成的摘要

JamesNorth reports inconsistent rendering of HTML emails in Discourse, where images are stripped in the main post but appear correctly in the HTML preview. codinghorror explains that HTML is converted to Markdown for posting, and email HTML standards vary, making consistent rendering difficult. LeoMcA clarifies that the post display uses Markdown conversion, while the HTML preview in the overlay shows the original email HTML directly in the browser, hence the difference.

Hi Folks,

I’ve been trying to use the incoming email method for posting pretty html emails into a sort of news thread on one of my Discourse forums.

I find that when the post is rendered, it strips out a bunch of images … but when I click on the little mail icon on the top right of the post and press ‘HTML’ it renders correctly.

Post Render

HTML Preview Render

Should they not look the same?

The first thing to bear in mind is that HTML is converted to Markdown for posting. Not all HTML converts reasonably to Markdown.

On top of that, HTML standards are all over the map for email, so it’s indeterminate – depending on your mail client that may not render at all. It would be nice if you could assume

recent email client = current-ish version of modern web browser

but that is almost never the case. Even with Gmail there are significant limitations, that is why services like https://litmus.com/ exist and are critical.

Thanks for the response Jeff.

So the fact that it’s in a post makes the markdown come into effect, whereas when Discourse itself previews the HTML in the overlay window in my post above, it’s not going through the markdown engine?

Yes, the contents of the post is a result of the email HTML being converted to Markdown, which is then converted back to HTML to display in your browser.

The HTML tab in the Incoming Email modal is just the email HTML being rendered in your browser directly.

Thanks @LeoMcA!

Ah well :slight_smile: