Home | Gifts |
tools/mailnotify
tools/mailnotify
, that generates and sends out the emails based on analysis of cron
(or an equivalent off-line job scheduler), or from the command-line.
The script collates the changes emails so that each subscriber only receives one changes notification for all changes in all webs in the TWiki. Furthermore, users can elect to receive just summaries of changes, or the entire content of topics that have changed.
Each web can optionally contain a topic called WebNotify.
Users subscribe to email notifications using their WikiName or an alternative email address, and can specify the webs/topics they wish to track using one of these bullet list formats:
three spaces * [ webname . ] wikiName - SMTP mail address * daisy.cutter@flowers.comSubscribe Daisy to all changes in all webs that start with
Web
.
* daisy.cutter@flowers.com: Web*Subscribe Daisy to changes to topics starting with
Petal
, and their immediate children, WeedKillers and children to a depth of 3, and all topics that match start with Pretty
and end with Flowers
e.g. PrettyPinkFlowers
* DaisyCutter: Petal* (1) WeedKillers (3) Pretty*FlowersSubscribe StarTrekFan to changes to all topics that start with
Star
except those that end in Wars
, sInTheirEyes
or shipTroopers
.
* StarTrekFan: Star* - *Wars - *sInTheirEyes - *shipTroopersSubscribe Daisy to the full content of NewsLetter whenever it has changed
* daisy@flowers.com: NewsLetter?Subscribe buttercup to NewsLetter and its immediate children, even if it hasn't changed.
* buttercup@flowers.com: NewsLetter! (1)Subscribe GardenGroup (which includes Petunia) to all changed topics under AllnewsLetters to a depth of 3. Then unsubscribe Petunia from the ManureNewsLetter, which she would normally get as a member of GardenGroup:
* GardenGroup: AllNewsLetters? (3) * petunia@flowers.com: - ManureNewsLetterA user may be listed many times in the WebNotify topic. Where a user has several lines in WebNotify that all match the same topic, they will only be notified about changes that topic once (though they will still receive individual mails for news topics). If a TWiki group is listed for notification, the group will be recursively expanded to the e-mail addresses of all members.
cron
job that runs the mailnotify
script.
Note mailnotify
ignores permissions in webs. It is entirely possible for a user to get added to one of the subscription topics in a web, when they are not authorised to view the topics in that web. This could result in them having access to sensitive information, particularly with news mode.
Note that when using the "news mode" ! or ? specifiers are used the entire topic text is mailed out as HTML. The newsletter
template is used to generate the content in this mail, using whatever skin is selected in the topic being mailed.
In addition, the %STARTPUBLISH% and %STOPPUBLISH% markers used by TWiki:Plugins.PublishContribTWiki/Contrib/MailerContrib
code library WebNotify
package described below.
$name
- Name of subscriber (wikiname with no web or email address)
$noAdd
- If false or undef, a new subscriber will be created for this name
$name
- Name of subscriber (wikiname with no web or email address)
$topics
- wildcard expression giving topics to subscribe to
$depth
- Child depth to scan (default 0)
$mode
- ! if this is a non-changes subscription and the topics should be mailed evebn if there are no changes. ? to mail the full topic only if there are changes. undef to mail changes only.
$name
- Name of subscriber (wikiname with no web or email address)
$topics
- wildcard expression giving topics to subscribe to
$depth
- Child depth to scan (default 0)
$change
- ref of a TWiki::Contrib::Mailer::Change
$db
- TWiki::Contrib::MailerContrib::UpData database of parent references
$changeSet
- ref of a hash mapping emails to sets of changes
$seenSet
- ref of a hash recording indices of topics already seen
$allSet
- ref of a hash that maps topics to email addresses for news subscriptions
$topic
- topic name
$db
- TWiki::Contrib::MailerContrib::UpData database of parent references
\%allSet
- ref of a hash that maps topics to email addresses for news subscriptions
$name
- Wikiname, with no web, or email address, of user targeted for notification
$subs
- Subscription object
$subs
- Subscription object
$topic
- Topic object we are checking
$db
- TWiki::Contrib::MailerContrib::UpData database of parents
$topic
- Topic object we are checking
$db
- TWiki::Contrib::MailerContrib::UpData database of parents
$pages
- Wildcarded expression matching subscribed pages
$childDepth
- Depth of children of $topic to notify changes for. Defaults to 0
$mode
- ! if this is a non-changes subscription and the topics should be mailed evebn if there are no changes. ? to mail the full topic only if there are changes. undef to mail changes only.
$topic
- Topic object we are checking
$db
- TWiki::Contrib::MailerContrib::UpData database of parent names
$depth
- If non-zero, check if the parent of the given topic matches as well. undef = 0.
$web
- Web name
$topic
- Topic name
$author
- String author of change
$time
- String time of change
$rev
- Revision identifier
$change
- Change record to merge
$html
- Template to expand keys within
$web
- Web we are building parent relationships for
$webs
- filter list of names webs to process. Wildcards (*) may be used.
$session
- optional session object. If not given, will use a local object.
$verbose
- true to get verbose (debug) output
mailnotify
scripts.
configure
interface (Go to Plugins->Find More Extensions) MailerContrib_installer
perl script and run it.
$TWIKI_PACKAGES
to this directory, and the installer script will look there first for required TWiki packages. $TWIKI_PACKAGES
is actually a path; you can list several directories separated by :
.zip
or .tgz
archives to a temporary directory.
,v
files in your existing install (take care not to lock the files when you check in)
configure
and enable the module, if it is a plugin.
mailnotify
script from the command line, with no parameters. In this case it will print out what it would have done to STDOUT.
cron
(or equivalent) job to run tools/mailnotify
.
Usage: perl -I <bin> mailnotify [-q] [-news] [ web1 web2 ... webN ]
<bin> is the path to the TWiki bin directory, so that the script can find the rest of TWiki.
-q |
Don't print progress information |
-news |
Run in news mode (process NewsNotify instead of WebNotify) |
web1 web2 ... webN |
List of webs to process, separated by spaces or commas. Default is to process all legal TWiki webs. Wildcards (*) are supported. |
/usr/local/twiki
, this cron entry:
0 0 * * * cd /usr/local/twiki && perl -I bin tools/mailnotify -q Public Privatewill generate change notifications for the
Public
and Private
webs every night at midnight.
0 0 * * 0 cd /usr/local/twiki && perl -I bin tools/mailnotify -newswill generate newsletters from all webs every week on midnight Saturday.
mailnotify
. This template must contain the following definitions.
HTML:before |
Section of a HTML mail before the changes |
HTML:middle |
Repeated in a HTML mail for each change |
HTML:after |
Section of a HTML mail after the changes |
PLAIN:before |
Section of a plain text mail before the changes |
PLAIN:middle |
Repeated in a plain text mail for each changes |
PLAIN:after |
Section of a plain text mail after the changes |
MailNotifyBody |
All the above are embedded in this. %HTML_TEXT% expands to the HTML obtained by expanding the HTML:* templates, and %PLAIN_TEXT% from the PLAIN:* templates. |
view
template, using whatever skin is selected in the topic being mailed.
Author: | TWiki:Main/CrawfordCurrie![]() ![]() |
Copyright ©: | 2004, Wind River Systems; 2006, http://WikiRing.com![]() |
License: | GPL |
Change History: | |
12496 | Item3415 mailnotify did not send notifications to intranet users because of wrong call to findUser. |
11672 | Added newsletter support, after much harassment from TWiki:Main.LynnwoodBrown![]() |
11534 | Item2153 Clarified docs. Item2698 Improved error reporting. |
8808 | Item1654 mailnotify must enter the command_line context |
8625 | Item1508 Making the dashes in the separatator clearer |
8606 | Item1508 MailerContrib: Brushing up HTML mailnotify template |
8602 | Item1508 MailerContrib: Cleaning up plaintext e-mail template, removing TEXTAREA |
8522 | Item1511 arguments to getScriptUrl in wrong order ![]() |
8434 | Item1465 Fix 'TWiki.' to '%TWIKIEB%.' |
8398 | Item1460 polished up the comment a bit |
8308 | Item1362 moving mailnotify cron script |
7848 | Item1167 forced all mail operations to generate absolute URLs |
7568 | Item910 use SCRIPTURL{view} instead of complex url expr |
6864 | Item624 mailer templates moved the the right places |
6861 | Item624 Added proper templates support for plain text mails |
6809 | Item623 don't print anything if verbosity is switched off. |
6659 | Item528 Updated MailerContrib. it's working and the sendmail parameter is used. |
6474 | Item420 removed spurious remove_obsolete_locks from MailerContrib |
5924 | Item153 fix mail URL-fixing scheme |
5269 | Minor doc fixes |
5266 | Doc tidy-ups, added filtering of _ webs, added obsolete lock script |
5264 | Changed default to add web name to user name (I hope) |
5263 | Minor doc tidyups |
5261 | Documentation changes, and fixed to scan all webs. |
5253 | runnable as CGI script, minor bugfixes, removed dependency on DBCacheContrib |
5234 | Minor doc changes |
5231 | Made a change an object, added unit tests to CVS, lots of testing. |
4 March 2005 | 1.010 Dakar release ready. |
12 Oct 2004 | 1.004 Added support for anti-subscriptions. Doc fixes from TWiki:Main.PeterThoeny![]() |
6 Oct 2004 | 1.003 Excluded _ webs from processing, added bin/remove_obsolete_locks for full reverse-compatibility |
1 Oct 2004 | 1.002 PeterThoeny provided additional documentation |
27 Sep 2004 | 1.001 runnable as CGI script, minor bugfixes, removed dependency on DBCacheContrib |
8 Sep 2004 | 1.000 Initial version |
Home: | TWiki:Plugins/MailerContrib![]() |
Feedback: | TWiki:Plugins/MailerContribDev![]() |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/MailerContribAppraisal![]() |
Revision r4 - 2007-01-10 - 10:40:36 - TWikiAdminGroup | Edit |