Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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,

like image 337
Saboor Awan Avatar asked May 07 '11 05:05

Saboor Awan


4 Answers

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

like image 50
Dave Ward Avatar answered Oct 23 '22 08:10

Dave Ward


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.

like image 31
David Glenn Avatar answered Oct 23 '22 08:10

David Glenn


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.

like image 29
Amr Elgarhy Avatar answered Oct 23 '22 08:10

Amr Elgarhy


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/

like image 1
asmiki Avatar answered Oct 23 '22 09:10

asmiki