Sunday 15 August 2010

javascript - How to display an HTML email in a web application? -



javascript - How to display an HTML email in a web application? -

i wrote web application fetches email via imap. need display these emails user. thought simple (i displaying html within html-capable browser) until looked little... , discovered there tons of issues, such as:

javascript & security style breaking surely more

is there good, safe way display html email? err "safe" rather "gorgeous", though don't want display text version of email (which not guaranteed there anyway...)

i realise obvious reply "put in frame" -- though? actually work?

i using node server side if helps...

..most obvious reply "put in frame"...will actually work?

yes, e.g. whiteout networks gmbh's whiteout.io in /src/tpl/read.html , /src/js/controller/read-sandbox.js. of security issues handled dompurify

..there tons of issues..is there good, safe way..?

i know message info format under names eml or mhtml looking good "xy html converter" or "html5 document viewer xy support" may point usable results (e.g. groupdocs.viewer)

some e-mail clients (e.g. gmail) don't utilize iframe, instead utilize mail service parser (e.g. andris9/mailparser) , html parser (e.g. cheeriojs/cheerio) extract e-mail-safe-html subset (see stack overflow: guidelines html email design there? , stack overflow: styling html email gmail examples) or utilize html sanitizer (e.g. google's caja, cure53/dompurify) , embed code straight page.

but not easy thing, there no consensus on constitutes e-mail-safe-html subset , don't wont inline perchance infected attachments nor run anonymous cors scripts within secured user's session.

anyway, always, studying source code of various e-mail clients (see wikipedia: comparing of email clients) way find out..

javascript html email mime

No comments:

Post a Comment