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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With