开发者

best practice to send fancy email in ASP.NET & MVC

开发者 https://www.devze.com 2023-03-04 12:53 出处:网络
HI, I want to send a very fancy email to users. thats look and feel is same as a web page. one very bad way to use StringBuilder and append text in it.

HI,

I want to send a very fancy email to users. thats look and feel is same as a web page.

one very bad way to use StringBuilder and append text in it.

but i am in search of a best practice solution. where the page is easy 开发者_如何学编程to redesign.

I need solution for both ASP.NET & MVC.

any idea.

thanks,


In ASP.NET MVC, I've been enjoying ActionMailer.Net.


You could try Postal or MvcMailer both are available via NuGet and both allow you to send emails rendered from MVC Views.

Andrew Davey done a good video presentation on Generating email with view engines using Postal at mvcConf2.


You can do that by writing your email template in a separate file (will be good for redesign if it is an HTML file), and then read this file like reading any file and fill it with variables, then use the result as a string to send in an email.


Another way of doing that is by using T4 Templates to compile all of the email templates in the separate assembly.

I blogged about that approach http://asmiki.wordpress.com/2011/05/20/using-t4-templates-for-compiling-net-email-templates/

0

精彩评论

暂无评论...
验证码 换一张
取 消