What is the best way to send a HTML email from Asp.net MVC?

I would like to be able to render a view and send it as an email, similar to what can be done with Ruby on Rails. What is the best way to do this?

EDIT: My solution so far is to use a templating engine (NHaml, StringTemplate.net). It works but I would prefer not to have a second template engine in my site.


Once the post mvc-preview-5-rendering-a-view-to-string-for-testing has an answer with a solution in it, that solution applies to this one as well. Once you have a string, you coud mail it using default .net mail options (as indicated by dimarzionist: SendMail / SmtpClient).

You can consider MvcMailer. See the NuGet package here and the project documentation

Hope it helps!

This looks like a possible implementation of the approach suggested by Haacked.

I'd advise Postal

It allows you to create e-mails using (strongly typed) MVC views, and send them using the standard SmtpClient.

Sorry mate, but I thing there is something wrong with your understanding of ASP.NET MVC. It's still the part of ASP.NET and framework, so you can use the same techniques you used there like SendMail and SmtpClient.

Need Your Help

Submit Button bypasses Captcha security

php html5

I have been having spam through my contact form, to cut a long story short my captcha is not working. I have used Sweet Captcha (http://sweetcaptcha.com/) as this offers more user friendly approach...

Fused Location Api Get time from GPS

android time gps fusedlocationproviderapi

I have an application that tracks users location.