Castle Monorail has been my web framework of choice for some years now. I’ve been using the obsolete RenderEmailAndSend method as that was how it is done in the sample code. Monorail 2.0 uses Core 1.2 which features an integrated email sender component, and the old sample code does not work anymore since Castle.Components.Common.EmailSender.Message has been removed.
The “new” way of sending isn’t documented officially anywhere, hence this blog post.
First, you’ll want a NVelocity template in the ViewsMail folder. We’ll call it Hello.vm:
Hello $name, this is a message from $site
Now for the controller, which we’ll name EmailController.cs (I’m not very imaginative):
public class EmailController : Controller
public void Send()
PropertyBag["from"] = "[email protected]";
PropertyBag["to"] = "[email protected]";
PropertyBag["name"] = "Your Name";
PropertyBag["site"] = "http://mywebsite.com/";
DeliverEmail(RenderMailMessage("hello", null, PropertyBag));
That’s it. The RenderMailMessage method signature I’m demonstrating is RenderMailMessage(string templateName, string layoutName, IDictionary parameters). We don’t need a layoutName if we are sending a plain text email which we are doing, hence we are passing in null.
Of course, you’ll want to set up your SMTP server properly in your monorail config section as per the instructions.
All I can say is, SUEET! It is a project that integrates best of breed Open Source .NET software to produce an online community suite. That makes it a direct competitor to Community Server and, to a smaller extent, mojoPortal.
I’ll be looking at the possibility of migrating That Stupid Club which is currently running on CS to Sueetie. CS was nice, and for a while was the only choice, but it is just too big and too complex to customise easily.
Its been a long time since I touched any classic ASP, apart from the odd quick fix to legacy projects.
Anyway, I recently helped a friend out with a project and was surprised to learn that there was an update to Windows Script, from 5.6 to 5.7. Wow! 5.6 shipped with XP, so it’s at least 5 years old.
No official release notes, but the comments in this thread indicate that:
All the security fixes/updates made in Windows Scripting from Windows Script 5.6.
The adaptive GC fix which was done in Jscript that ships with IE7. This is now available publicly on down level OS and for all hosts.
…and a partially fixed circular reference problem. Sigh…
It seems that the GC fix will really boost AJAX performance on IE6, so it’s a good download for Windows 2000 users who have not yet gotten with the programme and switched to Firefox, Opera, or anything else, really.
SubSonic has shipped 2.0 Beta 1. I have used SubSonic (formerly ActionPack) in a few projects now and I have been waiting for this release. Very exciting.
So I downloaded the zip file, updated the DLLs, web.config, compiled successfully. Went to the home page of the web application, so far so good. Datagrid, OK. Clicked for details, BAM! “KeyNotFoundException”. Eh, right.
Oh well, no time to deal with that at the moment, so back to 1.0.6. Thanks Subversion.
The new features for the 2.0 release are very nice though. I particularly like the syntactic sugar from improved querying (WHERE, AND, OR etc.) and the new AutoScaffold page is magic.