开发者

HTML Email created with ASP.NET MVC 2 View (standard view engine)

Is there a w开发者_Go百科ay to email an ASP.NET View using the standard view engine (not spark)?


If by standard view engine you mean WebForms then you could take a look at this blog post. If by standard view engine you mean Razor you may take a look at the following blog post. You may also take a look at MvcContrib way of doing it. And also DotLiquid.


Andrew Davey done a recent presentation on Generating email with View Engines at mvcConf 2.

You can find out more information about the open source Postal project he created from the Postal project site or download it via NuGet.

It allows you to generate emails from the Razor view engine as well as the WebForms view engine.


You might want to take a look at Postal and see if that works for you.


You can render a view to a string then send that as the body of your message using:

MailMessage message = new MailMessage ();
AlternateView htmlView = AlternateView.CreateAlternateViewFromString (htmlMessage, "text/html")
message.AlternateViews.Add (htmlView);


Did you take a look at MvcMailer? See the NuGet package here and the project documentation

Hope it helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜