Question

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.

Was it helpful?

Solution

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).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top