什么是从Asp.net MVC发送HTML电子邮件的最好方法? [英] What is the best way to send a HTML email from Asp.net MVC?

查看:96
本文介绍了什么是从Asp.net MVC发送HTML电子邮件的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够呈现一个视图,并把它作为电子邮件,类似于可以用Ruby on Rails的完成。什么是做到这一点的最好方法是什么?

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?

编辑:我的解决方法到目前为止是使用模板引擎(NHaml,StringTemplate.net)。它的工作原理,但我会preFER不会有第二个模板引擎在我的网站。

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.

推荐答案

在帖子<一个href=\"http://stackoverflow.com/questions/115060/mvc-$p$pview-5-rendering-a-view-to-string-for-testing\">mvc-$p$pview-5-rendering-a-view-to-string-for-testing具有在它的溶液的答案,该解决方案适用于这一个为好。一旦你有一个字符串,你coud使用默认的.NET邮件选项邮寄(以dimarzionist所示:的SendMail / SmtpClient)。

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

这篇关于什么是从Asp.net MVC发送HTML电子邮件的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆