Okay all, please forgive me for the state of the code but it was a quickie plugin. Please point out to me any issues that you see or encounter in it.


There is an issue where if you bring your wiki down and restart it, the email notifier does not start until the page that the plugin is defined on is accessed. Anyone have any ideas on how to get it started automatically after a restart? I purposly made it tolerant of repeated and heavy execution so it could be defined on LeftMenu or LeftMenuFooter or the Main page.

No takers? Well I define it on Main and have a wget wired into my startup script. (Though I guess the wget could get any page so I suppose it could be defined anywhere.) --JohnVolkar

In 2.2 you could put it in a PageFilter's initialize() -routine - then you would get startup notification. --JanneJalkanen

JohnVolkar : Thanks for the tip Janne, I'm debating moving all our internal wiki's up to 2.1.x since it's core functionality seems solid. When I do I'll update this plugin as well.

HEY! The PageFilter's initialize() routine just gets the jspwiki.properties contents! i.e. it doesn't get passed a handle to the WikiContext or the WikiEngine... Upshot is that I cannot wire this in for auto starting without a reference to the WikiEngine... Is there a reason why the engine instance ( or a context from which the engine can be obtained) isn't passed to a PageFilter on initialization? I suppose I could build a one-time trap on a regular filter call, but that's back to the same boat that unless someone looks at a page the notifier wouldn't kick off. --JohnV

Configuration Questions.#

Hi, i am using your EmailNotifierPlugin with the SMTP Authentication on Apache Tomcat Server 5.5.17. However, i have not been receiving any updates. I pasted the plugin codes at the mainpage and it is as follows :

{[{INSERT com.mckessonaps.jspwiki.plugin.emailnotifier.EmailNotifierPlugin 
WHERE server='mail.server.com' from='myemail@mycompany.com' subject='Wiki Changes' 
subscriptionPage='NotificationList' minuteOffset='01' hourInterval='0' 
useAuthentication='true' authUsername='myemail@mycompany.com' authPassword='mypassword' 
changedPagePattern='<li><a href=http://www.jspwiki.org:8080/Wiki/Wiki.jsp?page=

The following pages have changed in the last 24 hours.
To remove your email address from this list, edit the 
<a href=http://www.jspwiki.org:8080/Wiki/Wiki.jsp?page=SUBSCRIPTION_PAGE>SUBSCRIPTION_PAGE</a> page.

Is there something which i have to configure on the Tomcat server ?

Also, the username i used for 'authUsername' is my own company email, so, does that mean i have to use my email's password under 'authPassword' ? Wouldn't that allow everyone to know my password ?

UPDATE (4th Aug 2006) : I now have these two errors :

  • 2006-08-04 15:16:32,571 http-8080-Processor25 ERROR org.ceryle.wiki.plugin.emailnotifier.NotifierTask - No mail session properties ('emailnotifier.mail.*') defined?

I dun really understand the first one as i dont know what file is it looking for and as for the second one, i checked the class file and it actually refers to the userid, password, mail and minuteOffset fields. I am sure that i have entered these fields except the 'mail' field. Anyone knows what is it suppose to take ?

Thx for the help.

Excuse my naive questions.

First of all, do I have to include the INSERT type line on every page, or is there a way to configure it so notification is available by default for any page in a given Wiki?

You only put the plugin on ONE page (any page) and it starts a background thread that monitors the entire wiki.

Secondly, can the subscription lines be placed as comments in a given page, so they don't display for the reader?

What's a "comment" on a page?

Finally, where is the configuration information that tells the notification mechanism how to authenticate to the specified POP server?

Hmmm, you specify mail.smtp.host to teh plugin, that's the only email server related parameter available.

If you can point to a public Wiki where I can see an example of it in use, that would be great.

Sorry, but all the wiki's I have running are private. --JohnVolkar

Bernard bernard.at.bernardfarrell.com

I found out about Hula and found it very useful, so I'm using that. I've made some changes to it's functionality and submitted those back to MahlenMorris.

Bernard bernard.at.bernardfarrell.com

I found some NPEs while using this plugin with 2.0.52 (I know it's an older version :) ), but NPEs aren't nice. See the attachments and look for the comment lines marked "FIX: for NPE". You can updated your sources as you see fit. This stopped the NPEs and the Plugin is working great!
- Steve (spoz@bea.com)

Thanks Steve, I've updated my source and these changes will be in my next drop. --JohnV

Is there the possibility to get access to all sources? I'd like to adapt the following:
  • add possibility to specify smtp-auth-information: smtp-host, username, password,
    so that all notifications get sent by this smtp-host.
Cheers, magro (martin.grotzke_at_javakaffee.de)

The McKessonApsWikiPlugins .jar file contains both compiled .class files as well as the source .java files for all the plugins. Just unjar the file or (chnage the extenson to .zip and use whatever. --JohnV

When we save the page where plugin is inserted it shows only this text on the page


and thats the only content on the page.

You need a newer version of log4j.jar. Version 1.2.8 works, version 1.1.3 doesn't. You can drop the new log4j.jar into WEB-INF/lib and restart JSPWiki.

Hmmmm..... can't get the notification to work. I keep getting:

javax.mail.MessagingException: Unknown SMTP host: mailserver;

I've set the server parameter to: server='mail.myServer.com'. Why is it not picking this up? Instead it keeps using the default! -CraigGreen

No clue. Post the chunk of wiki-text with the plugin invokation and a relevent section of your log up here and I'll take a look. We and other folks seem to use this with no issues so I'm confident that it's just a configuration issue. --JohnV

Thanks for the reply John, here is the wiki-text:

 [{INSERT com.mckessonaps.jspwiki.plugin.emailnotifier.EmailNotifierPlugin
WHERE server='mail1.myServer.com',from='me@myServer.com',subject='test',
subscriptionPage='NotificationList',minuteOffset='45',hourInterval='1',changedPagePattern='* CHANGED_PAGE_NAME\n'

The following pages have changed in the last 24 hours.
To remove your email address from this list, edit the SUBSCRIPTION_PAGE page.

...and the Exception was: <SNIP, by JohnV, trace not useful.>

I agree, I'm sure it must be a config. issue. --CraigGreen

Craig, try the plugin invokation without the commas between the parameters. I can't remember if that's legal syntax. I always just use spaces as the delimiter. The fact that it's still trying to use'mailserver' as the server= parameter value inidcates that it's not getting the invokation parameters. Let me know if that was your issue. --JohnV

I am trying to set up this plugin and was having the same problem. It turned out to be that when I cut-and-pasted the wiki-text from this site, it had line breaks in it. Take out the line breaks, and the plugin should be able to read in the parameters. --Mbarrows

My smtp server requires authentication, user and password. Do you intend to add parameters for this. JasonWester
Let me look into it over lunch tomorrow, I've made some minor changes in a few of the McKessonApsWikiPlugins that I've never got around to uploading here. If I can I'll get you user/password auth setup on this, as well as twisting it to be page filter based. Fair waring I only run a test with CVS head so currently 2.1.110 or so. --JohnV

What is the status of this, like Jason I also need to use authentication which for the moment prevents deploying this plugin. --RobertMcGovern 2004-12-14

I have now added it. See EmailNotifierPlugin page for details and download. Enjoy. AndrewBroughton

JSPWiki has detected an error

Can anyone help, I have installed the emailnotifier plugin & get a bunch of errors when i try to view the page

The page (tester) shows

Error Message
Place where detected
    com.ecyrd.jspwiki.tags.IncludeTag.doEndTag(), line 71
and the log shows
2004-12-15 03:04:39,015 [http800-Processor25] WARN com.ecyrd.jspwiki.tags.WikiTagBase Starlight Wiki:Login.jsp Starlight Wiki:tester - Including
failed, got a servlet exception from sub-page. Rethrowing the exception to the JSP engine.
javax.servlet.ServletException: javax/mail/Message

I just cannot get this to work... any suggestions?

thanks steven ---2004-12-15

I saw this problem same problem while upgrading our JSPWiki (engine version 2.0.52) installation from using Tomcat 4.1.27 to 5.0.28. Our front page used the mail notifier from McKessonApsWikiPlugins.jar.

I found that adding mail.jar to Tomcat's 5.0.28 shared/lib directory solved the problem. (4.1.27 was shipped with mail.jar).

keith wall -- 2004-01-17

I have it installed and inserted the plugin text on my Main. I see the next notification at line with the link to the subscription page. I see in the log where accesses to the Main set the parameters ok subject, _body, smtp server, etc. I changed the interval to 0 and offset to a few minutes into the future and reloaded the Main until the next notification shows the change to the minutes....but alas still not getting any notifications, AND not getting any errors in the log and I have the log.Category including DEBUG.

What next?

MikeOliverAZ -- 2005-02-19

Um, do you have a subscription page with a subscription on it scheduled for some particualr hour right? I'd say it it was currently 9am, set teh hour offset to 10, and make sure you have a subscription indicating 10. Then give it an hour. I've found sometimes that it's just an impatient thing. Let me know of it still doesn't work out for you. --JohnV
Here is the important part of my entry on the Main page, "com.mckessonaps.jspwiki.plugin.emailnotifier.EmailNotifierPlugin WHERE server='localhost' from='mikeoliveraz' subject='Alarius Wiki Changes' subscriptionPage='AlariusSubscriptionPage' minuteOffset='40' hourInterval='0' changedPagePattern='* CHANGED_PAGE_NAME\n'"
And my AlariusSubscriptionPage entries
  • oliverm sourceonenet.com 17
  • oliverm sourceonenet.com 15
  • oliverm sourceonenet.com 16

I tried updating the settings on both trying to and the logs show the changes being set, but nothing else.

Use a non-zero hourOffset and make it match your subscription page (15, 16, 17). I don't recall exactly what the expected behaviour with a 0 is... --JohnV

Success! Getting DEBUG level in the logs revealed,

javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: 553 5.5.4 <mikeoliveraz>... Domain name required for sender address mikeoliveraz

So while 'mikeoliveraz' is a valid user, the from='mikeoliveraz' does not work, it needs to be from='mikeoliveraz@localhost' or at least a valid email address to send through sendmail.


I'm running this plugin on jspwiki 2.2.20, Tomcat 4.05, Apache 1.3.31

It works fine once. And then I never receive another email notification until I edit and resave the page a couple of times? The configuration command is included on my main page and shows the next notification correctly. My email address is on the "NotificationList" page and as I said, everything will work just fine one time. After that I do not get any more updates until I edit the notification config statement and save the main page a couple of times. And then it works fine one time and then nothing until I edit it again. The log files are not showing any errors.

Any ideas?

--chaworth 2005-07-14

Uh... there are edits on the wiki for it to notify you about right? And uh, you are waiting the 24 hours for you to notify you again right? <sorry>if these are dumb questions</sorry>, but just checking as if it works once, it should work forever unless the notifer thread dies (and that woudl show in the logs)... --JohnV

No it's fine to ask those questions, but unfortunately, yes I changed pages and yes I waited several days. I'll go comb the logs again and see if I find something. --Chaworth

Found some issues on my server. Everything is working correctly now. By the way my jspwiki version is now 2.2.28 --chaworth

I have installed the plugin and everything is working ok, thanks ... but I have a small issue.

I am working with BEAWLS, if I apply a small change to JSPWiki (like a new JSP) and a STOP and REDEPLOY is done, it looks like a second Notifier thread is created and multiple notifications are sent. I have to completely stop the server and restart it to avoid multiple notification.

I will be nice to avoid multiple notification without the need to RESTART the server. --Real

Ah, yeah that will happen. I'll add it to the list. I plan on updating all my plugins to 2.2 release and the 2.3.x branch real soon now (yeah right I've been saying that for quite a while now)... Anyway this issue can be fixed fairly easily if I remember the code right, so you can patch if you really need to. The updated version will be startable both via the PageFilter and InitializablePlugin interfaces. And yeah you'd probably still ahve this issue. Anyway folks, I do have a list, and will get around to it, but work has taken an unexpected turn in the last 6 months (you all know how it is.) --JohnV

Hey, I've installed this plugin but I'm not getting any emails, or errors in the logs. Can I check whether CHANGED_PAGE_NAME is literal, or whether I need to put a pattern / specific pagae name in there?

Any help appreciated! --AdamSmith

It's a literal, turn logging to DEBUG to see more info. Be aware that if your mail-server requries auth you'll have to patch this plugin. I've a newer version for release but want to wait until I'm personally happy with 2.3 as I intend to make it specific to 2.3 --JohnV

I have been unable to get email notification working with the EmailNotifierPlugin. I’m using JSPWiki 2.2.33 with Tomcat 5.5.17. The JSPWiki log shows that the notifier tries to run, but the connection to localhost port 25 is "refused". No further explanation is available as to why it is refused either in the JSPWiki log or Tomcat logs. I tried using Telnet to connect to localhost 25, and received the error message “Unable to Connect to localhost port 25”.

I have Java Mail 1.4 installed on my localhost. I originally put mail.jar and activation.jar in Tomcat’s /shared/lib directory. That didn’t work. I also put the .jar files in the /common/lib directory based on something I read on the Apache web site. That didn’t work either. I keep getting the same error message about the connection being refused.

I’m stuck. I suspect that I may still have some configuration to fix within Tomcat. Any ideas? Do I need to do something else to get SMTP working in Tomcat? Do I need to add something to server.xml, web.xml, or some other configuration file to get this working? I do not get the impression that editing the configuration files manually is necessary from what I read on this site, but maybe everyone else knows this is a basic pre-requisite for using Tomcat and Java Mail.

--Jeff Wilkins

--Jeff Wilkins, 07-Sep-2006


I suspect you're running up against your host provider's spam control. If the smtp server you're trying to use is not that of your host provider, it may simply block it.

The trick is to either (a) use the host provider's smtp server, or (b) if your other smtp server provides service on other ports as well (as is fairly common), you can use this other port.


--TS, 07-Sep-2006

UPDATE - 9/11/06
I finally got email notifications working. My biggest problem was an invalid assumption I made that Java Mail included an SMTP server. Evidently it does not. Mail.jar is only an SMTP client. I turned on the SMTP server that is part of IIS and that got me a step closer. Then I needed to change the SMTP server so that it would accept connections from the wiki machine (yes, even though it was localhost). I found out how to do this from an Exchange support forum on the web. I had to:

1. Bring up the IIS administration tool from the Administration Tools folder under the Control Panel.
2. Locate Default SMTP Virtual Server.
3. Right click and select properties.
4. Click Access tab and select Relay button.
5. Alter setting to enable an IP Address or range.
6. Restart Virtual Server by right click on Virtual Server in menu and selecting stop and start.

Anyway, it works now.

--Jeff Wilkins, 11-Sep-2006

There is a rewritten version of this plugin available at http://kaukoluwiki.opendfki.de/wiki/EmailNotifier that supports subscription patterns ("subscribe to all but THIS page" patterns, too) and simpler configuration using an admin webfrontend.

--Kiesel, 18-Sep-2006

Has anyone tried this rewritten version on a server with multiple wikis? Just wondering if it supports this better than the ceryle version appears to. I experienced what I think was a dead-lock when I tried the ceryle one on 10 wikis running under a single Tomcat. If the rewritten one supports this I'm definitely interested in taking a look, but don't want to waste time setting it up if it's basically the same code with better configuration.

--Loren Halvorson, 21-Sep-2006

Updated Configuration Instructions (20-Sep-2006)#

I have finally figured out how to get the EmailNotifierPlugin from the 2006-07-26 distribution of ceryle wiki plugins running under JSPWiki 2.4.53. The configuration instructions on this page must be for earlier versions, the way you do it with this latest version is very different. It took me some trial and error, and finally cracking open the source for the plugin to figure out how it is supposed to work. Just wanted to save someone else some time if they were thinking about putting e-mail notification in place.

Many of the parameters now go into the jspwiki.properties file instead of right in the plugin tag in the page.


# For org.ceryle.wiki.plugin.EmailNotifier
emailnotifier.subjectLine=Widget Wiki Changes

And the plugin configuration on your main page goes something like this:

[{org.ceryle.wiki.plugin.EmailNotifier changedPagePattern='<li><a href=http://wiki.mycompany.com/wiki/CHANGED_PAGE_NAME>CHANGED_PAGE_NAME</a></li>'

<head><style>body { font-family:arial }</style></head>
The following wiki pages have changed in the last 24 hours.
To remove your email address from this list, edit the
<a href=http://wiki.mycompany.com/wiki/SUBSCRIPTION_PAGE>SUBSCRIPTION_PAGE</a> page.

Possible Deadlock?

We have multiple wikis on one server, and the EmailNotifierPlugin worked beautifully for a day or two on one of them. So I proceeded to put the plugin tag in all of the rest of the wikis at once. The minute I put it on the rest of the wikis the machine hung with the tomcat process taking 100% of the CPU. Anyone know a reason why this might be happening?

I'm suspicious of this code in NotifierTask.java simply because of the humorous comment.

     * NOTES: synchronized for no good reason other than I do not feel like thinking it thru.
     * We're busy, period, the monitor is mine.
    synchronized void execute()
        try {
        } catch ( Exception e ) {
            log.warn("Unexpected exception whie executing the notifier task, swallowing.", e);
        } finally {


--Loren Halvorson, 20-Sep-2006

if i m senting mail from using the java mail api then i get always exception, i m using this code on my self system,

i always show the exception following blz

Plz any one solve this isue then plz sent me code & some document abt these thing.....

mail id: aks_ashish_iway@yahoomail.com

Thanks Ashish

====================================================================== <html> <head> <title>JSP JavaMail Example </title> </head>


<%@ page import="java.util.*" %> <%@ page import="javax.mail.*" %> <%@ page import="javax.mail.internet.*" %> <%@ page import="javax.activation.*" %>

<% try{ // String host = "yourmailhost"; String host = "mail.smtp.host"; out.println("host:"+host); String to = request.getParameter("to"); out.println("host:"+host); String from = request.getParameter("from"); out.println("host:"+host); String subject = request.getParameter("subject"); out.println("host:"+host); String messageText = request.getParameter("body"); out.println("host:"+host); //exit(); boolean sessionDebug = false;

Properties props = System.getProperties(); props.put("mail.host", host); props.put("mail.transport.protocol", "smtp");

Session mailSession = Session.getDefaultInstance(props, null);


Message msg = new MimeMessage(mailSession);

msg.setFrom(new InternetAddress(from)); InternetAddress address = {new InternetAddress(to)}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(messageText);

Transport.send(msg); out.println("Mail was sent to " + to); out.println(" from " + from); out.println(" using host " + host + "."); catch(Exception e) { out.println("hi Ashish"); }

%> </table> </body> </html> ==================================================================

Getting Exception...........


Exception report


description The server encountered an internal error () that prevented it from fulfilling this request.


javax.servlet.ServletException: Sending failed; nested exception is: class javax.mail.MessagingException: Unknown SMTP host: yourmailhost; nested exception is: java.net.UnknownHostException: yourmailhost org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:795) org.apache.jsp.sendMail_jsp._jspService(sendMail_jsp.java:98) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: Unknown SMTP host: yourmailhost; nested exception is: java.net.UnknownHostException: yourmailhost javax.mail.Transport.send0(Transport.java:218) javax.mail.Transport.send(Transport.java:80) org.apache.jsp.sendMail_jsp._jspService(sendMail_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.

--Ashish, 26-Jan-2007

Sometimes I've encountered a similar error on other e-mail applications. In my situation, what was happening was that Java was mixing up two different versions of mail.jar and activation.jar. The solution was to remove the two jar files from my application's lib directory (that is, from JSPWiki's lib dir). Once that was done, everything worked fine.

--TS, 26-Jan-2007

If you are attempting to connect to an Exchange server that requires authentication then you need to make sure that basic authentication hasn't been disabled on the server. Most corporate security policies only allow GSSAPI and NTLM which pretty much limits access to the exchange server from integrated windows applications (i.e. outlook express etc).

--skibuddy, 02-May-2007

I am using jspwiki 2.6.0 with ceryle-wikiutil-1.0a12-20070216.jar. I have the following on my main page:

[{INSERT EmailNotifier server='localhost' from='do-not-reply@myserver.net' subject='Wiki Changes' subscriptionPage='NotificationList' minuteOffset='01' hourInterval='0' useAuthentication='false' changedPagePattern='<li><a href=http://www.myserver.net/Wiki/Wiki.jsp?page=CHANGED_PAGE_NAME>CHANGED_PAGE_NAME</a></li> \n'

<p>The following pages have changed in the last 24 hours.</p>
To remove your email address from this list, edit the <a href=http://www.myserver.net/Wiki/Wiki.jsp?page=SUBSCRIPTION_PAGE>SUBSCRIPTION_PAGE</a> page.

It saves okay and says on my main page:

Wiki next notification at Feb 28, 2008 3:46:00 PM. Subscribe at NotificationList.

But I am still not getting any emails... Any ideas?

--BrianAnderson, 29-Feb-2008

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
EmailNotifierPlugin.java 352.0 kB 2 03-Jan-2006 23:12 Dirk Frederickx
NotifierTask.java 17.6 kB 1 28-Feb-2004 17:53 StevenPozarycki
Subscriber.java 5.7 kB 1 28-Feb-2004 17:53 StevenPozarycki
s88log.txt 2.7 kB 1 13-May-2003 04:50
« This page (revision-181) was last changed on 16-Mar-2011 21:27 by Janne Jalkanen