andrewdavey / postal

Email sending for asp.net mvc using the view engine system to render emails.
http://aboutcode.net/postal
MIT License
537 stars 169 forks source link

Dynamically injected HTML not parsed #63

Open Remixninja-zz opened 10 years ago

Remixninja-zz commented 10 years ago

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 commented 10 years ago

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.

andrewdavey commented 10 years ago

Have you tried adding this header to your view:

Content-Type: text/html; charset=utf-8
Remixninja-zz commented 10 years ago

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 notifications@github.comwrote:

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 .

jopierrelerm commented 9 years ago

Have you tried this in your html view:

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

@{ WriteLiteral(Model.BodyHtml); }