Tags:
changes1Add my vote for this tag email1Add my vote for this tag create new tag
view all tags

MailerContribDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on MailerContrib contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please file bug reports in the MailerContrib bug database.

Feedback on MailerContrib

ALERT! Discussion of the various enhancements to the notification system that have been contributed so far as well as a possible consolidation in core refactored to ConsolidateNotification.

WIBNIF the MailerContrib.....

... allowed custom email templates - the ability to define more than one mailnotify template and designate which template to use either in webnotify configuation and/or user preference. This would accommodate, for example, users wanting either plain text or html emails.
...allowed custom content/layout - Ideally, this feature would allow me to specific a topic to provide the email's content. This would allow one to, for example, create different emails with custom searches for specific purposes, or create a custom-layout for a quasi-newsletter.
...supported immediate (point of change) notification, as in ImmediateNotifyPlugin and NotificationPlugin
...supported the [NEW] option from YetAnotherNotifySystem
...supported the [NOTMINE] option from YetAnotherNotifySystem
...supported the + - syntax from PerTopicWebNotifyReports
...supported notiofication of topics matching a given tag, e.g. using TagMePlugin
...supported frequency of notification on a per-subscriber basis
-- CrawfordCurrie - 11 Oct 2004

Discussions

In the depths of the FormQueryPlugin I have a mailer strategy for notifying changes. it works like this:

  1. User writes a topic with a search in it that produces strictly, but very simply, formatted results.
    • emailOrWikiname: message, one per line to be exact
  2. A cron job comes along and expands the variables in this topic, then parses the result.
  3. Each result contains a mail address, and the data to be sent to that address. The cron job collates, formats, and issues an email.

Thus, what is sent out by the mailer is controlled strictly by what is stated in the search. If the search says "search for topics that have changed in the last hour", then that is what will be shown in the topic, and therefore what will be notified.

This same mechanism could be used to do all forms of notification (except ImmediateNotify) including WebNotify and action tracker notification.

Of course the search support in the FormQueryPlugin makes it quite easy to write appropriate search statements, but I quess a standard SEARCH would work as well (though I haven't tried it). Standard search probably doesn't know about change windows (topic changed within) but that code can easily be cribbed from the action tracker.

I was thinking about stripping out this mechanism into a Contrib. This thought was further crystallised by LynnwoodBrown talking about Soupermail in the support web.

Thoughts, questions, comments?

-- CrawfordCurrie - 28 Aug 2004

Crawford - Sorry to be slow in follow-up on this and your comment in CreatingFormProcessingPlugin. I'm getting ready for a trip and our comments given rise to more throughts that will have to wait for now. But I'd like to give quick response on MailerContribDev.

Let me see if I understand the basic concept here. It sounds essentially like custom WebNotify topics with the added feature that the content can be customized by a search defined in the topic.

Questions:

  • What shall we call these topics? CustomWebNotify?
    • Whatever you want. You tell the mailer script what topics to process.
  • How is the format for the email that goes out set? By the search (i.e. formated search)? By a separate template file?
    • The format of the mail is template based.
  • Would the cron job have to specify each one of these topics individually or could it look for any such topic (perhaps using FormQueryPlugin)?
    • As it stands it has to be told which topics to process.
  • What does the "message" refer to in the string you present above? The search? A subject line? If it's the search, does that mean you can define more than one of these WebNotify in a single topic? If it's not a subject line, that would be a nice variable to add so you can easily identify specific CustomWebNotify emails. Combining these features might look like: * emailOrWikiname: subject line - message
    • Good idea! The message at present is pushed verbatim into the output mail, with all HTML stripped out in the text version. This could be smarter.

The real problem is that SEARCH is not smart enough to provide useful data for the notification. For example, you can't search for topics that changed in the last 48 hours.

-- LynnwoodBrown - 30 Aug 2004

OK, I wrote a mailer for Wind River at the request of PeterThoeny. It supersets mailnotify, and adds the capability to notify specific topics, but does not (at this point) support flexible per-user scheduling of notifications, or the strategy described above. For the foreseeable that is all I'm going to do, but if anyone feels motivated to take this further and implement something like what is described above, you have my full support.

Any and all reviews of the code are more than welcome. Because of the difficulty in testing mail notifiers without spamming people, the testing is unit tests and testing up to the point of sending the mails without actually sending them; full final testing will be done when everyone is satisfied.

-- CrawfordCurrie - 06 Sep 2004

Seems to work for me okay (thanks for the CGI update Crawford!).

I altered the $sendmail flag from 0 to 1 (default is disabled) and used the patch below to obey the default.

*** mailnotifier        Tue Sep 28 01:46:01 2004
--- mailnotifier~       Tue Sep 28 01:23:30 2004
***************
*** 42,48 ****
      # a browser environment?
      use CGI;
      $query = new CGI;
!     $sendmail = $query->param( 'sendmail' ) || $sendmail;
      $verbose = $query->param( 'verbose' ) || 1;
      my $webz = $query->param( 'webs' ) || "";
      @webs = split( /[, ]+/, $webz);
--- 42,48 ----
      # a browser environment?
      use CGI;
      $query = new CGI;
!     $sendmail = $query->param( 'sendmail' ) || 0;
      $verbose = $query->param( 'verbose' ) || 1;
      my $webz = $query->param( 'webs' ) || "";
      @webs = split( /[, ]+/, $webz);
Seems to work fine in straight replacement mode, but have not tried it with the more exotic topic-specification setting.

In order to have a chance at replacing the default implementation with an interface in Dakar, we need to compare and consolidate all these notification systems to come up with a spec that meets everyone's needs.

Have you had any interest from the other notification developers?

-- MartinCleaver - 28 Sep 2004

The default $sendmail value is deliberate - it reduces the risk of accidental spammings during install/upgrade/test.

No other notification developer has contacted me, no.

-- CrawfordCurrie - 28 Sep 2004

There's a proposal to have a way to mail everybody registered on the twiki; since the MailerContrib gathers this information, it would be natural to use the API to provide this.

-- CrawfordCurrie - 28 Sep 2004

Crawford - I have been thinking about some improvements I'd like to see in webnotify and throught I'd mention them here just in case they could be incorporated into your efforts without too much extra work.

  • custom email templates - the ability to define more than one mailnotify template and designate which template to use either in webnotify configuation and/or user preference. This would accommodate, for example, users wanting either plain text or html emails.
  • custom content/layout - Ideally, this feature would allow me to specific a topic to provide the email's content. This would allow one to, for example, create different emails with custom searches for specific purposes, or create a custom-layout for a quasi-newsletter.
  • send current topic as email - I'm not sure if this is relevant or not but most closely relates to the situation I was dealing with in CreatingFormProcessingPlugin. It would allow one to include a link or a form command that immediately sends the content of a topic or form to one or more recipients.

Hope I'm not too off-topic or out-of-line in offering these wish-list items! I know you do a lot of the code-heavy-lifting and MailerContrib looks like a great step forward!

-- LynnwoodBrown - 06 Oct 2004

Here is a doc version where users can copy text from a textarea (edit and take the source to the doc topic)

  • Modify your WebChangesAlert topic: Replace the part between the STARTINCLUDE and the STOPINCLUDE with the following help text:

(Note that this text should use as little screen real estate as possible since this help text is shown in all WebNotify topics.)

-- PeterThoeny - 07 Oct 2004

Crawford/Peter - presumably there is a piece of UI code that provides a "subscribe to this topic" button? If so, can you share this with us your implementation? I would much appreciate it.

If not, could you outline how you think this needs to work, and I'll spend a couple of hours building the code for it.

-- MartinCleaver - 24 Nov 2004, 1 Dec 2004

MailerContrib_Installer.pl says "I can't automatically update the revision history for data/TWiki/MailerContrib.txt. Please edit the topic in TWiki and Save without changing it to update the history." even after I've done exactly that.

Also the disabled parameter for textarea means that the text inside the textarea is not selectable or copyable in Firefox.

-- MattWilkie - 12 Feb 2005

the docs say the format is a space separated list of topics while the example text to be copied and pasted is a comma separated list. Which is correct?

-- MattWilkie - 14 Feb 2005

I'm not wunning this and my users are compling, loudly.

The mail they receive is HTML mail, and it is an abominatble reformatting of the pattern skin. All the Top, Left and Bottom bars getting in the way.

MailNotifyInPlainTextFormat raised the issue of plain text notification. Perhaps we can revisit that.

-- AntonAylward - 07 Mar 2005

Anton, the look of the HTML mail is defined by the changes template. If the look is wrong, it is easy enough to change over to a better template - though I suspect none has been defined.

-- CrawfordCurrie - 10 Mar 2005

Crawford - Looking at the description of MailerContrib, I see you've offered option to set per-topic notification. How hard would it be to add feature whereby the actual topic is sent out in body of HTML email, or alternatively, the in-line diff for the topic?

Along similar lines, I don't know if you've noticed the MailPageAddOn I cobbled together. I wonder how hard it would be to incorporate this functionality into MailerContrib?

-- LynnwoodBrown - 10 Mar 2005

Is there a way to specify the skin for this and only for this?

As things standa I get mail with the same skin as the system default -- that is PatterSkin.

I'd like something less obtruse, say a print skin.

-- AntonAylward - 11 Mar 2005

Martin (or anyone) - Was any progress made on your request about the "subscribe to this topic" comment dated 1 Dec 2004.

I know that the YetAnotherNotifySystem has it, but I wonder if this is the "approved" approach. i.e. A subscribe button and another cgi-bin script to update the WebNotify page. I may be able to hack this plugin to use the MailerContrib functions, but I'm not 100% sure this is the right way... Any direction would be helpful.

IMHO, this is an important requirement (and expected by end users).

-- SteveHobbs - 19 Aug 2005

Had I been email subscribed to this topic perhaps I would have seen your request, Steve. Its possible that you won't see my answer either...

ConsolidateNotification basically summarises... this is the code to extend... and no, we've not done anything (CurrentStateOfEmailConsolidateNotification) about it.

Anything you have to offer would be gratefully considered... perhaps you can join us on TWikiIRC?

-- MartinCleaver - 07 Oct 2005

Hi, I use Windows 2000, Cygwin and Apache. I have followed in installation procedure for MailerContrib and ran the MailContrib_intaller.pl using the command

c:\Twiki\bin>c:\cygwin\bin\perl MailContrib_intaller.pl

It said it installed the package without any errors. But now when I run the script mailnotifier, using the command:

C:\Twiki\bin>c:\cygwin\bin\perl -wT mailnotifier, it gives this error:

Can't locate URI/Escape.pm in @INC (@INC contains: ../lib . /usr/lib/perl5/5.8/c ygwin /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site _perl/5.8 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin /us r/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8) at ../lib/TWiki/Cont rib/MailerContrib/Change.pm line 21. BEGIN failed--compilation aborted at ../lib/TWiki/Contrib/MailerContrib/Change.p m line 21. Compilation failed in require at ../lib/TWiki/Contrib/Mailer.pm line 26. BEGIN failed--compilation aborted at ../lib/TWiki/Contrib/Mailer.pm line 26. Compilation failed in require at mailnotifier line 64. BEGIN failed--compilation aborted at mailnotifier line 64.

Is Escape.pm required to be present anywhere ? I don't have that file on my server.... can anyone please help ?

-- ChengappaCB - 20 Oct 2005

Same here - no such thing in the distribution zip nor as part of Cairo distro.

-- SteveRJones - 23 Oct 2005

It appears that there is a dependency on an external Perl module -- CPAN:URI::Escape

-- SteveRJones - 23 Oct 2005

-- ChengappaCB - 24 Oct 2005

I visited the site and downloaded Escape.pm. Now what do I do ? I am not familiar with perl etc. Can I possibly make this work ?

-- ChengappaCB - 24 Oct 2005

Well, your best bet is to utilize CPAN to handle the install. Check out http://twiki.org/cgi-bin/view/Codev/CpanPerlModulesRequirement

-- SteveRJones - 25 Oct 2005

Hi SteveRJones, well, I don't know how to do that either :-(. I went thru the documents in the site yopu mentioned but coundn't figure out what to do. I have a test setup of Twiki in which all the other plugins etc are working fine, except this. I desparately want to install MailerContrib. Is it too much if I ask for a step by step procedure ?

-- ChengappaCB - 25 Oct 2005

I just figured out how to get this done. The command install URI::Escape was all that was required. O boy ! Life IS difficult here if you are not a programmer.

Now I have a new problem (hopefully the last one !). If a topic is modified once, Twiki keeps sending the mails regarding the same topic everytime I run the mailnotifier command, even if the topic is not modified again. As per the instruction, I do run the remove_obsolete_locks command after the mailnotifier.

It looks like remove_obsolete_locks is not removing the locks. There is blank output when I run the remove_obsolete_locks command.

If I run mailnotify (after removing the list of topics in webnotify), the problem gets solved.

Any suggestions ?

-- ChengappaCB - 25 Oct 2005

If a web has the ALLOWTOPICVIEW variable set to a user or group, mailnotifier will report that it has no subscribers. I'd've thought this was a bug, since you're bound to have TWikiAccessControl on lots of webs, but MailerContrib won't work on these webs. Dang! Otherwise it's so useful. (I'm running Cairo.) The standard mailnotify system (in Cairo) doesn't have this limitation.

-- MarcusLeonard - 04 Nov 2005

Sorry for all the trouble. I was running mailnotifier with the 'T' switch like

c:\cygwin\bin\perl -wT mailnotifier -m. Once I removed the 'T', everything is solved.

-- ChengappaCB - 10 Nov 2005

Tiny issue: The </blockquote> just above the Contrib Info section had a missing closing angle bracket.

-- PeterThoeny - 17 Dec 2004

Crawford, I made some enhancements to the NewContribTemplate and created supporting Contrib topics. With this I changed the MailerContrib topic text:

  • Added SHORTDESCRIPTION in "Settings" section
  • Added a note to the "Installation Instructions" section
  • Added link to GPL in "License" table row
  • Added "Appraisal" table row
  • Fixed heading levels (use level one only once on top)

Could you take that into the next release of the package?

-- PeterThoeny - 22 Mar 2005

Oops, also here, all my changes are gone. Please check the Dev topic once in a while! Please understand that I am already working many hours a day on open source TWiki and simple cannot allocate more time to mail the author, file a bug or do the doc fixes myself.

Steve fixed the link to the earlier Plugin version.

Suggestion: Avoid "here" link labels. Instead of "WARNING: TWiki-4 only. If you want to use this extension with an earlier version of TWiki, please see here", you could write: "__NOTE:__ This version is TWiki 4.0 specific. Download the previous version if you want to use this extension with an earlier version of TWiki."

-- PeterThoeny - 28 Feb 2006

This contrib is listed in the ContribPackage index page, but there is no indication what it does. The contrib needs a SHORTDESCRIPTION.

-- PeterThoeny - 07 Mar 2006

Hi, I am using Linux OS, Apache Server. I managed to install MailerContrib and yes, it reported that it installed properly without any problem. But when I tried running this. perl -I ~/public_html/cgi-bin/twiki/bin ~/public_html/cgi-bin/twiki/tools/mailnotify -q

It +gave me these error...any idea why?

Can't locate TWiki/Contrib/Mailer.pm in @INC (@INC contains: ... /public_html/cgi-bin/lib ... /public_html/cgi-bin/twiki/bin /home/stulocal/lib-pc.i86.linux/perl5 /home/stulocal/lib/perl5 /etc/perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ~/public_html/cgi-bin/twiki/tools/mailnotify line 44. BEGIN failed--compilation aborted at ~/public_html/cgi-bin/twiki/tools/mailnotify line 44.

-- SuwandyTjin - 12 Mar 2006

Yes, I got something similar. It's because by default TWiki4 uses a relative path (../lib) to find its libraries. If you aren't cd'd to a subdir of the twiki dir, this won't work (if you look at the first entry in your @INC there, you can see that it's gone up a level higher than intended (public_html/cgi-bin/lib instead of public_html/cgi-bin/twiki/lib), presumably because you were cd'd to the twiki dir top level. The solution is to create bin/LocalLib.cfg (based on bin/LocalLib.cfg.txt) and specify the full path to the library dir where indicated. -- BenWheeler - 19 Jul 2006

Important Cairo vs. Dakar Distinction

I'm running Cairo and wanted to install MailerContrib so I could do per topic notification. The only version of the .zip file I could download and unzip from Plugins.MailerContribAddOn was the most current one (used in Dakar) - I'm still not sure why I wasn't able to open any previous versions of these zip files (Windows issue?). Anyway, I unzipped it and then followed the instructions for installing it on Cairo. It didn't work so I posted the issue over in the Support web. Peter eventually attached the correct version of the .zip file to that topic, which I was able to use. However, because the Cairo version doesn't include/require a new mailnotify.tmpl file, my system was still using the Dakar version of the mailnotify.tmpl file that is packaged in the the .zip file!

By chance, I happened to look at the contents of the "Dakar" MailerContrib.zip and noticed that it included a mailnotify.tmpl file. I then compared the code of that file with the mailnotify.tmpl file included in the Cairo installation distribution. When I noticed they were different, I copied in the installation version of that file, tested the mailnotify script and it worked again. I then went out and made changes to multiple topics to see if the mailnotifier script would only report changes for topics to which I had subscribed; it did.

The moral of the story is, if you run Cairo and want to install MailerContrib verify the mailnotify.tmpl file is the same one that comes with the Cairo installation distribution.

Btw, the error that is generated when you attempt to run either /bin/mailnotify or /bin/mailnotifier on Cairo with the Dakar version of /templates/mailnotify.tmpl is:

- Changed topics since 02 Mar 2006 - 18:42: WebNotify WebChanges
- Sending mail notification to: name@email.com
Use of unitialized value in concatenation (.) or string at c:/twiki/lib/TWiki/Net.pm line 156.
* ERROR: Can't send mail, missing 'From:'
- End TWiki.Main
Checking TWiki.Manuals
- Note: No topics changed since 02 Mar 2006 - 15:19
*(where name@email.com is my actual e-mail address)

My Support web topic that relates to this issue is UninitializedValueInConcatenationOrStringAtNetPM.

-- JasonVensel - 21 Mar 2006

A note on the documentation only.. in the line that shows usage of mailnotify job, the 'code' tags do not protect the < and > markers and hence the output is scrambled and quite confusing for people setting this up. Otherwise this is a great feature! Thanks.

-- FrankCarnovale - 11 Apr 2006

I noticed the same thing that FrankCarnovale did. that usage line really confused for me for a while frown

-- TroyGoodson - 27 Apr 2006

Sorry about that; it's fixed now.

-- CrawfordCurrie - 28 Apr 2006

Is MailerContrib supposed to show in my InstalledPlugins ? Is the 'subscribe button' implemented in the MailerContrib package for Cairo ?

-- RobbieWebster - 06 May 2006

(1) No, it shouldn't show. it's a Contrib, not a plugin. (2) No. That's not something for the MailerContrib to provide. That functionality should be provided by a plugin (e.g. a SubscribePlugin). Any takers to write one?

-- CrawfordCurrie - 07 May 2006

add perl's Algorithm::Diff to the installation/dependencies because this does not come preinstalled on os x 10.4.x.

-- JustinMaxwell - 17 May 2006

also i had to edit the mailnotify script and add

use lib '/Library/WebServer/twiki/lib';
to get it to work under mac os x 10.4.x. I could have additionally specified this in the include strings, I suppose, but simply following the cron instructions of specifying the bin path was insufficient.

-- JustinMaxwell - 17 May 2006

Should be no need to do that, set up LocalLib.cfg instead as I explain above.

-- BenWheeler - 19 Jul 2006

Help on setting up Cron on Max OS X relocated to CronOnMacOSX.


To the maintainer: Could you please add a SHORTDESCRIPTION setting so that the contrib is listed with explanation in the ContribPackage table?

-- PeterThoeny - 20 May 2006

I have successfully in stalled Mailnotify plugin, The issue i am facing now is that it is not sending auto email if any document is uploaded with different version. It si showing in showing in webchanges that change took place, no notification from mailnotify...

Any idea how can i solve this issue...

-- BilalAhmad - 25 May 2006

Another Issue is possible to issue Mailnotify for changes made in pages with ViewAllow permissions?

-- BilalAhmad - 25 May 2006

I have solved issue about version change with new file upload by putting ReplaceIfEditedAgainWithin =0 in configuration. But other problem with mailnotify for webs with permissions is not solved

-- BilalAhmad - 25 May 2006

When i run Mailnotify it gives following error

/twiki/data/.htpasswd open failed: Permission denied at /twiki/lib/TWiki/Users/H tPasswdUser.pm line 75.

-- BilalAhmad - 25 May 2006

It was error due to wrong subscriptions in the notify page, once corrected now working fine.

-- BilalAhmad - 27 May 2006

In mailnotify.tmpl there is a %REVISION% variable that gets expanded to e.g. r1->r6 if since last mail notification there were 6 new revisions.

It would be great if there could be an argument to %REVISION% like %REVISION{type="first"}% to get the numbers of the two revisions.

This way, it'll be possible to provide appropriate links to the compare script (CompareRevisionsAddOn)

I hope this applies to MailerContrib?

-- JosMaccabiani - 27 Jun 2006

I found that mailnotify now get installed in ...twiki/tools directory instead of twiki/bin. If we try to execute it from shell it gives error Can't locate setlib.cfg . I saw various articles but could not understand that. Finally I copied that into twiki/bin directory and it starts working.

-- TapeshAgarwal - 11 May 2006

I fixed the Usage: above a bit (There were some < > hiding their contents). Unfortunately that seems not to be the only error here. I can't get it to work in the current version. If I find out more I'll add it.

-- ChristianZiemski - 02 Aug 2006

I transferred a twiki to a new server, at the same time upgrading to 4.04. After installing this new mailnotify ik keep getting "malformed header from script. Bad header=Processing Abctest: /home/soundwit/public_html/cgi-bin/tbin/mailnotify ". Abctest is a new test web i created under 4.04. What could this be?

-- IstvanLeelossy - 04 Aug 2006

I moved above comments from TWiki.MailerContrib to here.

-- PeterThoeny - 05 Aug 2006

I think the doc could be clearer about what subscriptions will not work, in addition to the good examples of what will work. To be more precise, the fact that:

   * ExampleWikiName - example@mail.com : * - *Topic
will not apply the filter.

-- JosMaccabiani - 29 Aug 2006

please note:
1) In page http://twiki.org/cgi-bin/view/Plugins/MailerContrib Installation Instructions,
I would prefer : "Unzip MailerContrib.zip in your twiki installation directory e.g. /home/httpd/twiki/"
2) It is unclear whather to unzip ALL MailerContrib.tgz files to twiki installation directory, or unzip it with its directory tree
3) In MailerContrib_installer.pl Script Error: =syntax error at MailerContrib_installer.pl line 286, near ""{$major}{$minor}";"=
S.B. : "{$major}{$minor}");
4) Typo: =http://twiki.org/cgi-bin/view/Plugins/MailerContrib=
-> Installation Instructions -> 4th line S.B. : "Run the installer script MailContrib_installer.pl or ..."

-- HaggaiST - 06 Sep 2006

Thanks, yes, I know. It's fixed in SVN, but I haven't had a chance to re-release yet.

-- CrawfordCurrie - 07 Sep 2006

Hi All,

I have been experimenting with the latest Mailer Contrib, and made some slight modification to allow Immediate Notfication using the cool new "mode" feature that somebody was kind enough to add smile

I was wondering what people thought of this idea:

All I did was:

Index: MailerContrib/WebNotify.pm
===================================================================
--- MailerContrib/WebNotify.pm   (revision 231)
+++ MailerContrib/WebNotify.pm   (working copy)
@@ -315,7 +315,7 @@
     my ( $this, $who, $spec ) = @_;
     my $ospec = $spec;
     $spec =~ s/,/ /g;
-    while ( $spec =~ s/^\s*([+-])?\s*([\w\*]+)([!?]?)\s*(?:\((\d+)\))?// ) {
+    while ( $spec =~ s/^\s*([+-])?\s*([\w\*]+)([!?#]?)\s*(?:\((\d+)\))?// ) {
         my $mode = $3 or 0;
         my $kids = $4 or 0;
         if ( $1 && $1 eq '-' ) {

... to add a new mode: '#' which indicates "Immediate Notify"

And create a plugin to enable the afterSaveHandler - attached (I do not know how to make a plugin, so I "gutted" ImmediateNotifyPlugin (thanks to Walter, Juergen and Steffen) and simply borrowed parts of it and the MailerContrib (matching template here)

It uses the MailerContrib to process the the WebNotify page and obtain the subscriptions. Then only subscriptions with a mode of '#' are emailed. Also, I did not make it process children since I was afraid it would be too much overhead to the save.

Anybody care to take a look and see if what I did is good or bad. I did not notice a major performance degradation, but then again, not too many users know about it yet! (not so many emails going out the door! smile )

Also, I suspect I need to make the processing of the "mode" a little more specific in WebNotify->processChange() and WebNotify->processCompulsory() so that it will ignore my extra mode.

Haven't done a lot of testing, but things like:

   * Username: *Discussion# MyHomeTopic#
in WebNotify work fine.

-- DarrenElkerton - 20 Oct 2006

Darren, sounds cool! Best thing to do is to release it, and see what happens!

-- CrawfordCurrie - 14 Nov 2006

Discussion on error in templates moved to bug DB Bugs:Item3143

-- CrawfordCurrie - 14 Nov 2006

On immediate notify performance issue: How about spanning an asynchronous process that sends out the mail?

-- PeterThoeny - 14 Nov 2006

It seems to me that anybody can subscribe to topics they don't have view permissions for and in that way glean some information about the topic?

Am I mistaken? If not, is this hard to fix?

To me the main problem is that the mail is generated once per web, instead of once per user. The former is more efficient in a well-subscribed case, but the latter allows easy permission handling and is more efficient in a low-subscribed case.

-- WoutMertens - 21 Dec 2006

On immediate notification: We had that in the previous incarnation of our TWiki install, and it was a nice way to get people who mostly communicate through email to click on the link.

I wrote it by adding code to the save executable that sent off a mail containing the full diff of the topic.

The annoying thing was when someone was making lots of small changes and clicking save every time, that would send off a lot of mails obviously.

So I would recommend implementing immediate notify as a cronjob that runs every 5 minutes, and only sends out topics 20 minutes after they have been changed.

To handle topics that change a lot, the notification should also check if it has been more than 2 hours since a notification was sent and then send one anyway.

Finally, it's great to have a full diff of the raw topic changes, but sometimes it's hard to read due to long lines. I never got around to formatting the diffs to be 74 characters wide, since I just used the output of rcsdiff -u. I think the easiest way would be to get both revisions, wrap them at 74 chars, and then run a diff on them.

-- WoutMertens - 13 Jan 2007

Will it be possible at some point to use a %SEARCH{} to list the topics to be notified on. I basically want to be notified on topics that are assigned to me (which is set in a form in the topic) but the last change was not done by me. i can use %SEARCH to find these and when the page is rendered by TWiki it lists the topics properly but when the mailnotify script runs it reads the %SEARCH{...} and obviously reports it as a bad format.

-- TomBriden - 15 Jan 2007

The notifier operates as the admin user, so yes, it is possible that someone can subscribe to changes on a topic they don't have view permission for. Perhaps someone would like to tackle the job of making it "safe"?

-- CrawfordCurrie - 18 Jan 2007

Bug# 12496 doesn't appear to have been fixed. I'm on TWiki-4.1.1 and I'm using Intranet login therefore the login name is different from WikiName. The following notification entry doesn't work:

   * WikiName

But the following works:

   * WikiName - twiki_user@example.com

-- AlokNarula - 02 Mar 2007

It would be nice if we could exclude some webs from the mailnotify, so we could set up a cron job for all webs except a select few. Maybe something like -TWiki -Sandbox or _TWiki _Sandbox? Not sure bout the best way to do this.

This would allow us to set up daily notifications for most people, but weekly for certain webs.

Looking at the code, it does not seem to hard to do so I may give it a go myself. Just pass an extra argument to mailNotify($webs, $session, $verbose, $excludeWebs), then add to the $webstr regex so it does not match these webs? Not sure what the regex for not matching is but sure google can help.

Anyway I will add to the WIBNIF table above and if I decide to do it myself I shall post a patch.

-- AndrewRJones - 03 Apr 2007

I am using TWiki 4.1.1, LdapContrib with NewUserPlugin, and SubscribeAddOn, and trying to figure out how mailnotify should behave. My user pages have UserForm attached, with the Email field filled in, and since I'm using LdapContrib, that's the only place a user's email address is available.

Should mailnotify be pulling the user's email address from the Email field in UserForm? It doesn't seem to be: I get e.g. WARNING: Failed to find email for    * JohnWorsley: * when the script runs. (I tried to figure this out myself, but got lost in the object-oriented maze :-b)

-- JohnWorsley - 16 Apr 2007

The latest MailerContrib (24 Apr 2007) appears to have a bug in the function that recognizes a topic change. After I installed this extension, I started getting mails even though the there is no change in the topic content.

-- AlokNarula - 28 Apr 2007

I'm also getting this problem where, once a topic has changed, emails are sent every time for that topic - even when there have been no further updates. Seems to be that it is correctly recognising changes, but not the fact that they have been notified. Any thoughts?

-- MartinMoss - 03 May 2007

It's running on develop.twiki.org, and is clearly not demonstrating that behaviour there.

The most likely reason is that the file (which it uses to record the time/date of the last mailshot) is not being updated. It should be in pub/_work_areas/webname (one file per web). Check writability of that file for the user running the cron.

-- CrawfordCurrie - 03 May 2007

Bug reports moved to Bugs:Item4014 and Bugs:Item4015

-- CrawfordCurrie - 04 May 2007

I've been having a lot of trouble making this addition work as expected. I keep getting notifications for changes in the entire web, even though I have specified a topic (by wildcard).

It's been suggested that I'm hitting an irregularity in syntax; that I must specify EITHER a Wiki Name OR an email addres, but cannot specify both??

This is implied by the docs

three spaces * [ webname . ] wikiName - SMTP mail address
three spaces * [ webName . ] wikiName
three spaces * SMTP mail address
three spaces * SMTP mail address : topics
three spaces * [ webname . ] wikiName : topics

but seems very wrong... that is,

three spaces * [ webname . ] wikiName - SMTP mail address : topics
should be possible

Is this a bug/feature enhancement or a misunderstanding on my part?

-- VickiBrown - 30 May 2007

Implemented new version of access rights checks, looks like it works - please evaluate.

This patches will work for:

  • User name (access checks will be done for that name)
  • Group names (it will be expanded to the individual members, and access checks done for that member)
    • Groups will be recursively expanded
  • e-mail addresses (it will check that TWikiGuest has access)

Special notes

  • you need to set the $TWiki::cfg{MailerContrib}{CheckPermissions} = 1; in your lib/LocalSite.cfg for the actual permission checks to be done (else: reverts to the previous way, except the group expansion capability)
  • it is recommended that the WebNotify topic be protected against modification in non-trusted setups

Known problems

  • If a group contains itself or there is a loop somewhere, an infinite loop will result

Enhancement ideas

  • document the check is now done

Thanks to

  • AndrewRJones
    • TWikiGuest idea
  • C* on IRC
    • ability to enable/disable through config
    • encouragement to document
  • the customer who paid for

See also

-- MarcSCHAEFER - 28 Jun 2007

You may be better off posting your patch in the Bugs Web, as its more likely to get noticed. Also, a unified diff would be easier to read.

Permissions are something I need to look into in the next couple of days, so will post what I find.

-- AndrewRJones - 19 Jun 2007

Erm, Marc, see Bugs:Item4284

Or is this extending further than that change already does?

-- CrawfordCurrie - 03 Jul 2007

I just downloaded and installed the newest version of MailerContrib, and I'm getting the following error when I run mailnotify on all of our webs with a cron job:

Too many failures sending mail Can't locate TWiki/Contrib/MailerContrib/TopicContext.pm in @INC

I have no idea where to get that file since it doesn't seem to exist in the .tgz I downloaded, and I did a few searches for it, and can't find it either.

mailnotify actually seems to run on some of the webs, and then stops when that error comes up. If I run it on singular webs on the command line, it works fine.

-- MichelleHedstrom - 26 Jul 2007

I should add that it's look for that file in Mailer.pm line 320.

-- MichelleHedstrom - 26 Jul 2007

Mail notification stopped working for me a few weeks ago. The error message I get is:

AccessControlException: Access to VIEW RestrictedProject for TWikiGuest is denied. access not allowed on topic

i.e. whenever a change is made to a topic with restricted VIEW access.

The error goes away when I comment out the call to handleCommonTag in expandHTML in Change.pm. But why?

Any ideas? I'm running 4.0.2 in cygwin, with latest version of MailerContrib

-- JohnFitzpatrick - 05 Sep 2007

Crawford, thank you for the new version of MailerContrib. I have installed it and all my problems above just went away!

-- JohnFitzpatrick - 06 Sep 2007

  • I installed this extension, I started getting mails even though the there is no change in the topic content. -- AlokNarula - 28 Apr 2007
  • Seems to be that it is correctly recognising changes, but not the fact that they have been notified. Any thoughts? -- MartinMoss - 03 May 2007
  • The most likely reason is that the file (which it uses to record the time/date of the last mailshot) is not being updated. It should be in pub/_work_areas/webname (one file per web). Check writability of that file for the user running the cron.

I just ran into this problem too. Witness line 221 of the current version: if ($timeOfLastChange = 0) { if( open(F, ">$notmeta" )) { print F $timeOfLastChange; close(F); } }

I had accidentally run mailnotify as root. When I switched to run as the CGI user it could no longer update the file. I'd suggest something like writing a warning and/or deleting the file.

-- MartinCleaver - 12 Oct 2007

Hello, i just fighted my way though the new MailerContrib and i think we have a problem in the default regexp of{MailerContrib}{EmailFilterIn}: ([A-Za-z0-9.+-_]+\@[A-Za-z0-9.-]+)

As this is suggested in the code : /^\s+\*\s($TWiki::cfg{MailerContrib}{EmailFilterIn})\s*:(.*)$/

We have double inner brackets which results in, that $1 and $2 both are the email, while the code wants $2 to be the weblist ( after the :), instead its $3.

-- MayerEugen - 28 Oct 2007

Sorry, the soloutin is just, to drop the outer brackets in the default regexp

-- MayerEugen - 28 Oct 2007

We've run into the same problem. If any topic with a "?" newsletter subscription requested is changed, the mailnotify run fails with the error Can't locate TWiki/Contrib/MailerContrib/TopicContext.pm in @INC Can someone please post the missing file! Thanks

-- GeorgeClark - 20 Dec 2007

When I installed the MailerContrib, I got the MailerContrib Topic as part of my TWiki Web. The problem is, that my WebLeftBarnow appears at the very bottom of the page after the end of the topic. Has anyone else seen behavior such as this?

-- DanielDowlin - 11 Jan 2008

Has anyone considered interacting with, e.g. TagMePlugin? Instead of only accepting wildcards, let me subscribe to pages that are tagged a certain way...

-- VickiBrown - 21 Jan 2008

Spouse is considering ways to specify frequencies per subscriber: default and/or per topic tracked. Has anyone looked into this idea?

-- VickiBrown - 21 Jan 2008

Vicki, great ideas. Please raise ehancements in Bugs web so we can track them to completion. I'll comment there.

-- CrawfordCurrie - 22 Jan 2008

I wonder why there is no function to completely remove subscription, not just unsubscribe. I mean unsubscribe adds unsubscription record i.e. one more line to the WebNotify topic. What if I need to remove existin subscription or unsubscription line?

-- AndrewTutolmin - 24 Jan 2008

Trouble with accent in page name : Badly formatted subscription for AntTam: Requêtes1015 Requêtes1016 ... The big regex check for alphabetical letter and don't like 'accent'. (with Twiki 4.1.1), Is there a solution ? upgrade the regex to use utf8 ? What the official twiki position about accent in page/filename ? can they be automatically switch to a 'clean' html or uuencode format ?

-- CyrilleMastchenko - 25 Jan 2008

Andrew, the problem is that a group subscription may include an individual who does not want to be subscribed. The only way they can unsubscribe is by adding an unsubscription. Cyrille, accented character and UTF8 support is not good. if you can identify, isolate and report bugs you find, that will help people trying to fix them. See Bugs:MailerContrib

-- CrawfordCurrie - 26 Jan 2008

Crawford, not sure I understood you correctly. What I'm talking about is there are two API functions called 'subscribe' and 'unsubscribe'. Both of them add new lines to the WebNotify topic. But there is no say 'remove' function that will remove previously added subscription line.

-- AndrewTutolmin - 26 Jan 2008

That's right, because subscribe and unsubscribe are designed to subscribe individuals and groups, and not to add/remove lines from a file; that's just how they happen to be implemented.

Consider this scenario: WillyWhale is a member of CeteceanGroup. WillyWhale subscribes to PetFoods. CeteceanGroup, a group which WillyWhale is a member of, is subscribed to all changes in the Japan web. WebNotify contains:

Willy decides it's all too frightening, and wants to unsubscribe from PetFoods. If we did this simply by removing the: line, then Willy would still be subscribed as a result of being a member of CeteceanGroup. However by adding: we are able to protect Willy from the worst excesses of the Japanese pet foods industry.

Even if Willy is not a member of CeteceanGroup, he might be added to that group at some point in the future, at which time he will suddenly start getting notifications for a topic he had previously explicitly stated he didn't want notifications for.

Rather than trying to constantly re-optimise the subscriptions list, I decided the best thing was simply to do the simple thing, and leave it to a manual cleanup step. There are other cleanups - such as removing non-existant users and groups - that I also decided not to try to support.

-- CrawfordCurrie - 27 Jan 2008

Well I can give you another example. Imagine most of the users on a twiki site are not experienced ones and don't know how to edit WebNotify topic. Or they are not allowed to edit WebNotify.

Instead users have two buttons 'Subscribe' and 'Unsubscribe' on each topic. If a user clicks on 'Subscribe' button the Plugin adds a new record to WebNotify topic. Then user might want to unsubscribe by clicking 'Unsubscribe'. Now we have a record in WebNotify topic like this:

The problem is if the user decide to subscribe to this topic again by clicking 'Subscribe' button there is no way to remove '- SomeTopic' using API functions.

-- AndrewTutolmin - 28 Jan 2008

new version of the "add ACL checking" and "add group support" patch

-- MarcSCHAEFER - 29 Jan 2008

Hello Crawford,

Was support ever added for EmailAllTWikiUsers ?

-- KeithHelfrich - 07 Mar 2008

Andrew, good point, within the scope of a signe subscription line it ought to be possible to optimise that. Please go ahead and raise an enhancement request in Bugs web, and I'll get to it - or, better, give me a patch :-).

Marc, what (subversion rev number) version is that patch against?

Keith, given that there was no tracking topic in Bugs web, I suspect not. I can't remember having done it, sorry.

-- CrawfordCurrie - 08 Mar 2008

No problem Crawford, but still it would be handy to have one place from which the administrator could send an email to all registered TWikiUsers. Do you think this would be difficult to implement ? If not in this plugin, then somewhere. I wonder if the SendEmailPlugin could do it ?

-- KeithHelfrich - 08 Mar 2008

This isn't necessarily something for the MailerContrib, so I created a feature request for you in EmailAllTWikiUsers.

-- CrawfordCurrie - 09 Mar 2008

In TWiki3 this method TWiki::getEmailOfUser( $userName ) returned the email address. Is there an OFFICIAL way of doing this in TWiki4? There is nothing listed in the available functions for plugins. (What is the right place to ask these type of questions?)

-- ClausLanghans - 10 Mar 2008

Similar to the comment by TomBriden from January 2007 (which I didn't see an answer to), I'm wondering if there have been any attempts to incorporate form fields into the expressions that MailNotify can understand for generating a list of topics per subscriber. This seems like it would be extremely handy to have.

-- GarySprague - 02 May 2008

MailerContrib and notify time for TWiki 4.2.0 on Linux.

Problem: When a topic is modified once (or since 01 Jan 1970 - 00:00), MailerContrib keeps sending the mails regarding the same topic everytime I run the mailnotify command, even if the topic is not modified again. This is similar to a problem from ChengappaCB on 25 Oct 2005.

Solution: Check permissions on the working/work_areas/MailerContrib directory. With TWiki 4.2.0, the mailnotify command writes the latest notify time to this directory. Without write permission, the mailnotify command cannot update the notify time file. When run from a cron job, the cron user account must have write permission.

$ cd working/work_areas
$ chown -R apache:apache *

-- GilbertHerschberger - 05 May 2008

MailerContrib Duplicate notifications

Problem: I've been seeing duplicate notifications from MailerContrib. Described in detail in http://twiki.org/cgi-bin/view/Support/DuplicateNotificationsFromMailerCon, where it's gone quite some time without any reply.

Would appreciate some help with how to troubleshoot. (In the Support TWiki - I don't monitor Development, and the issue belongs in one place.)

Thanks in advance.

-- TimotheLitt - 13 May 2008

After 10 months, 3 TWiki installs (2 versions), a few MailerContrib updates, and many, many hours of searching topics on Codev and Support and emailing TWiki consultants, we've finally got it working on our TWiki/Mac OS install.

On our current install (Leopard Server/4.2) we could not get mailnotify to compile until the most recent update to that contrib was posted (Thank you for that!!). It still was very difficult to figure out how to configure the system. All the docs describe Cron, which is deprecated on Mac OS X.

I got a jump start with CronOnMacOSX today. Please consider factoring into the official release docs for MailerContrib the information contained in that topic.

-- DavidWolfe - 16 May 2008

I have upgraded to 4.2.2 and get the following cron error from mailnotify: "Can't locate TWiki/Contrib/MailerContrib.pm in @INC (@INC contains: /var/www/lib bin /usr/lib/perl5/..."etc finishing with "BEGIN failed--compilation aborted at tools/mailnotify line 47." What did I do wrong???

-- HansSchwing - 12 Aug 2008

OK figured out I had to create LocalLib.cfg in /bin/ with proper path...

-- HansSchwing - 12 Aug 2008

The mailnotify script appears to be working (running from the command line) but it is not sending any email. SMTPMAILHOST is set in TWikiPreferences and in Configure. Where can I look for debugging information?

-- AlanRubin - 2009-07-19

Looks like there hasn't been much discussion here this year ..

Anyone interested in seeing a notification schedule that can be set per user rather than just per web?

"In the future it is intended that individual users will be able to control the frequency with which they are notified of topic changes, by changing a schedule specification in their home topic. However at present, the notification schedule is controlled by the frequency of activation of the cron job that runs the mailnotify script. "

Can this be added to WIBNIF?

What code would need to change in order to make this happen?

-- RobertHawkins - 2009-10-15

Would it be possible to have an option to exclude the user himself who changed a topic from the notification on that topic?

That would reduce the overall amount of notification mails for users in highly frequented webs.

-- MichaelGulitz - 2011-02-03

New WatchlistPlugin is now available. It covers some of the functionalities of the MailerContrib and is much easier to use. The WatchlistPlugin will eventually replace the MailerContrib.

-- Peter Thoeny - 2013-03-04

Can someone please tell me what file does mailercontrib read to get the user email? Thx.

-- Jay Timber - 2013-08-06

That depends on the PasswordManager manager used. If you use the default TWiki::Users::HtPasswdUser look into twiki/data/.htpasswd

-- Peter Thoeny - 2013-08-06

Topic attachments
I Attachment History Action Size Date Who Comment
Perl source code filepm DarrenElkerton_ImmediateNotifyPlugin.pm r1 manage 4.3 K 2006-10-20 - 20:42 UnknownUser Test "Plugin" to allow immediate notifications using Mailer Contrib
Unknown file formattmpl DarrenElkerton_immediatenotify.tmpl r1 manage 0.7 K 2006-10-20 - 20:41 UnknownUser Template for testing my Immediate Notify method
Unknown file formatpm-2007-06-13-check-access-permissions patch-WebNotify.pm-2007-06-13-check-access-permissions r1 manage 0.6 K 2007-06-13 - 11:17 UnknownUser Quick patch for respecting VIEW permissions in notify.
Unknown file formatpm-2007-06-28-check-access-permissions patch-WebNotify.pm-2007-06-28-check-access-permissions r2 r1 manage 3.8 K 2008-01-29 - 14:41 UnknownUser Group and ACL support, new version
Edit | Attach | Watch | Print version | History: r134 < r133 < r132 < r131 < r130 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r134 - 2013-08-06 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.