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

1.3k views Asked by At

Is there a way to email an ASP.NET View using the standard view engine (not spark)?

5

There are 5 answers

0
Darin Dimitrov On BEST ANSWER

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.

0
Shea Daniels On

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

0
Todd Smith On

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);
0
David Glenn On

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.

0
Sohan On

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

Hope it helps!