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

查看:88
本文介绍了从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)。它的工作原理,但我不想在我的网站中有一个第二个模板引擎。

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.

推荐答案

一旦post mvc-preview-5-rendering-a-view-to-string-for测试有解决方案的答案,该解决方案也适用于此。一旦你有一个字符串,你可以使用默认的.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天全站免登陆