Saturday, 24 September 2005

The PostMailerPlugin

« Installing blojsom | Main | stakhanov »

A missing feature in blojsom is the capability to send, every time an entry is added, an email with its content (title and description). For example blogger allows it and I find it useful because I'm using email as an archiving system (thanks to the recent avalability of free, with large disk storage and well working email services).

Fortunately, blojsom is open source software and so I could add this functionality. Its plugin architecture facilitated notably my job.
I took the CrossPostPlugin (with its event handling behaviour) and added a send email funtionality copying from the CommentPlugin. The result is the PostMailerPlugin (maybe not a good name). The source code with a velocity template for the email body and a sample configuration file are avalaible here.

2005-Nov-13 CET: update.

Posted by Nicola Piccinini at 6:53 PM CEST in blojsom/

Comments on this entry:

Left by Dave Douglas at 4 Nov 12:29 AM

How does one install this plug-in?

Left by Nicola Piccinini at 4 Nov 3:06 PM

see this other post, if it isn't clear enough ask again, ciao

Left by Nicola Piccinini at 4 Nov 3:12 PM

also pay attention that the plugin is for blojsom 2.x

Left by Dave Douglas at 5 Nov 9:21 PM

I did try to follow the instructions and I do believe that I have the plugin loading. I am using a stock Apple Tiger server install. What version of blojsom is part of the Apple config?

Left by Nicola Piccinini at 5 Nov 10:50 PM

it's almost certainly a variant of 2.x branch but, as far as I know (from some messages in mailing list), there isn't a clear relationship between Apple config and blojsom

Left by Dave Douglas at 6 Nov 3:49 AM

Any thoughts on how one could verify the plugin has loaded correctly?

My Blojsom log has the following line:

2006-11-05 12:01:25 WebappLoader[]: Deploy JAR /WEB-INF/lib/blojsom-postmailer.jar to /Library/Tomcat/blojsom_root/webapps/ROOT/WEB-INF/lib/blojsom-postmailer.jar

This would make it look like it is in fact loading.

Left by Nicola Piccinini at 6 Nov 11:33 PM

you can check for:
1. initialization log messages after context startup, these are like:
nov 05 22:51:16 DEBUG [http-8180-Processor4] event.SimpleBlojsomEventBroadcaster - Added event: org.blojsom.plugin.postmailer.PostMailerPlugin with process all events filter
nov 05 22:51:16 INFO [http-8180-Processor4] servlet.BlojsomServlet - Added blojsom plugin: org.blojsom.plugin.postmailer.PostMailerPlugin

2.diagnostic log messages every time an entry is added or updated, these are similar to:
nov 05 22:57:32 DEBUG [Thread-45] postmailer.PostMailerPlugin - Event detected
nov 05 22:57:32 DEBUG [Thread-45] postmailer.PostMailerPlugin - It is a BlogEntryEvent
nov 05 22:57:32 DEBUG [Thread-45] postmailer.PostMailerPlugin - It is an AddBlogEntryEvent or an UpdateBlogEntryEvent
nov 05 22:57:32 DEBUG [Thread-45] postmailer.PostMailerPlugin - PostMailerPlugin is enabled for this type of event
nov 05 22:57:33 DEBUG [Thread-45] common.VelocityPlugin - Merged template: org/blojsom/plugin/postmailer/postmailer-plugin-email-template.vm