views:

364

answers:

3

I would like to be able to use an ASP.NET view as an email template, complete with the <%= "hi there" %> syntax. Is there a way to invoke/setup this view engine in a standalone way?

A: 

One option would be to use Cassini to host a site; however, have you considered just using IIS and getting the HTML? One option is to do this from a client app, another option which I used recently in a web application, was to override the render method, and provide my stream writter which I pass. This lets me get the HTML which I then pass to the email objects.

In my case this works well as I can let the user preview the email. If this doesn't work for you then you will have to look into the hosting API's and host your own instance (Which is what Cassini does).

JoshBerke
+1  A: 

There is an old Scott Guthrie article about running Asp.Net from the command line you might want to check out.

http://aspalliance.com/220_Running_ASPNET_within_a_CommandLine_exe_Outside_of_IIS

Josh
A: 

Rick Strahl has an article here:
http://www.west-wind.com/weblog/posts/481.aspx
which uses an approach that sounds like it might work for you.

seanb