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@example.com";
PropertyBag["to"] = "firstname.lastname@example.org";
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.
So I have the links to all the stuff I use in one place:
and of course, jQuery and jQuery UI.
Addendum (26 Nov):
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.
In any case, downloads:
Windows Script 5.7 for Windows XP
Windows Script 5.7 for Windows 2000
Windows Script 5.7 for Windows 2003 Server
Made another attempt to update the current project I am working on from SubSonic 1.0.6 to the newly released 2.0 Beta 3. The issue I had with Beta 1 is gone. Great job.
As a public service, these were the things I needed to do for the update.
- Move the attributes of the SubSonicService tag down to the provider tag, apart from the defaultProvider and templateDirectory attributes.
- Specify the generatedNamespace. I did not do so for this project, and it seems like it stops the generated code from compiling as the namespace is left blank.
- Because of 2), search for “using SubSonic;” in my codebehind files and replace that with “using <MyNamespace>;”.
- Copy the new DLLs into the bin directory.
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.
Just found out about brainfuck from Peter Schneider’s blog post about his Powershell brainfuck interpreter and compiler. Classed as an “esoteric programming language“. So subversive. And such an appropriate name. Created by Urban Müller in 1993, it has only eight commands. Wow!
“Hello World!” looks like this:
[>+++++++>++++++++++>+++>+<<<<-] The initial loop to set up useful values in the array
>++. Print 'H'
>+. Print 'e'
+++++++. Print 'l'
. Print 'l'
+++. Print 'o'
>++. Print ' '
<<+++++++++++++++. Print 'W'
>. Print 'o'
+++. Print 'r'
------. Print 'l'
--------. Print 'd'
>+. Print '!'
>. Print newline
Needless to say, I will not be using it in any project soon.
I decided to hand optimise the default CSS that came with the CS 2.1 package, both for the mental exercise as well as to derive a less verbose set for me
to customise any future CS projects from.
The totaled file size is reduced from 179 KB to 140 KB, not too impressive but I’m sharing it anyway in the hopes someone might find it useful.
CS2.1 Optmimised CSS v1.1
Note that there should be no changes at all, visually.
Update: Ran the files through CSSTidy, down to 103 KB.
Originally a design by sofaspud, adapted for WordPress by Sadish which was used as the basis for the CS 2.1 adaptation.
Intense for CS2.1 v1.0
Kubrick is, of course, the default theme of WordPress. I have been working on it on and off, and I figure I should release it before the imminent release of the first beta of CS3.
Includes variant ChinaRed by BigheaD (大頭綠豆).
Kubrick for CS2.1 v1.0