postal icon indicating copy to clipboard operation
postal copied to clipboard

Dynamically injected HTML not parsed

Open Remixninja-zz opened this issue 10 years ago • 4 comments

I am currently loading a report into an email view dynamically, as a string,

Unfortunately this string does not get parsed as text/html. Is there a way to accomplish this with Postal?

Remixninja-zz avatar Jan 29 '14 21:01 Remixninja-zz

Actually I figured out how to do this using the razor engine. I simply needed @Html.Raw(Model.HtmlString) for it to parse correctly.

Currently trying to get the email parsing the report html now, it's coming up unformatted in Outlook.

Remixninja-zz avatar Jan 29 '14 23:01 Remixninja-zz

Have you tried adding this header to your view:

Content-Type: text/html; charset=utf-8

andrewdavey avatar Jan 30 '14 10:01 andrewdavey

I did actually, thanks for the suggestion though.

It turns out my real issue is outlook 2007+ and the way it parses HTML. Really a nightmare since they don't conform to web standards and use word to parse their HTML.

I got my html to work using @Html.Raw(dynamicHtml) in the view, however the html I'm getting is not parsed correctly in outlook.

On Thu, Jan 30, 2014 at 4:45 AM, Andrew Davey [email protected]:

Have you tried adding this header to your view:

Content-Type: text/html; charset=utf-8

Reply to this email directly or view it on GitHubhttps://github.com/andrewdavey/postal/issues/63#issuecomment-33677016 .

Remixninja-zz avatar Feb 01 '14 17:02 Remixninja-zz

Have you tried this in your html view:

Content-Type: text/html; charset=utf-8

@{ WriteLiteral(Model.BodyHtml); }

jopierrelerm avatar Sep 18 '14 09:09 jopierrelerm