I use an output panel and rerender to display the HTML Body of an Email Message object query that is invoked by a user.

There is an issue (confirmed by Salesforce Support) with rerendering an output with particular HTML elements (they could provide a list of the elements but pointed to specific MHTML elements that were carried over in emails from users pasting in content from Microsoft Word) that results in the rerender to fail (the HTML Body queried from the Email Message Object are not re-rendered on the page).

To avoid this rerender issue, I would like to sanitize the HTMLBody so that basic HTML elements are retained (such as img, a, b, style, etc.) but other html elements are removed or sanitized. I understand there is a textbody field on the email message object, but I would ideally like to retain a certain level of HTML.

This is possible in the Node/JS space with utilies such as DOM Purify: https://cure53.de/purify, but I'm having trouble conceptualizing an approach that would work pre-rendering the content on the visualforce page.

If any additional information is needed, please comment and I will add it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.