PmWiki > Notify
Index | Hilfe | Suche:

administrators (basic)]
The notify.php script allows a site administrator to configure Pm Wiki to send email messages whenever pages are changed on the wiki site. Notifications can be configured so that multiple page changes over a short period of time are combined into a single email message (to avoid flooding mailboxes).

This feature is useful for sites and pages that have infrequent updates, as it eliminates the need to frequently check RecentChanges pages just to see if anything has changed.

In order for notifications to work, the notify.php script must be enabled in the site's local customization. Usually this is as simple as placing the following in local/config.php:

    $EnableNotify = 1;

Once enabled, the notification system gets its configuration from the Site.Notify List page. The Site.Notify List page contains entries of the form:

This says that information about page changes should be periodically emailed to The Site.Notify List page can contain multiple "notify=" lines to cause notifications to be sent to multiple addresses.

A number of options exist for limiting the pages that result in a notification. The group= and name= parameters can be used to restrict notifications to specific pages or groups:

    # send notifications about the Main group to group=Main

    # notify of any changes to the home page name=Main.Home Page

    # notify of changes to pages except in Main group=-Main

For maintaining arbitrary lists of pages, i.e., "watchlists", it's generally easier to build a trail of pages to be watched. The following entry in Site.Notify List will send an email containing changes to any of the pages listed in the Profiles.Alice trail:

    # notify Alice of changes to pages listed in Profiles.Alice trail=Profiles.Alice

Note that once this entry has been added to Site.Notify List, Alice can easily change her watchlist by editing the Profiles.Alice page and doesn't need to edit the Site.Notify List page. In particular, this means that an administrator can restrict editing of Site.Notify List, yet allow individuals to maintain custom watchlists in other pages.

This is probably a good place to point out that edit access to Site.Notify List should be controlled, otherwise malicious persons can use the notification capability to flood others' electronic mailboxes. By default, Site.Notify is blocked against edits except by the admin (as is the case for most pages in the Site group). It may also be useful to place a read password on the Site.Notify List page, to restrict the availability of email addresses from spam harvesters.

Controlling notification frequency

To prevent flooding of recipients' mailboxes, the notify script uses a "squelch" value as the minimum amount of time that must elapse between messages sent to any given email address. The default squelch setting is 10800 (three hours), which means that once a recipient address is sent a notification message, it will not receive another for at least three hours. Any edits that occur during the squelch interval are queued for the next notification message.

The site administrator can change the default squelch interval via the $NotifySquelch parameter

    # enable notifications
    $EnableNotify = 1;
    $NotifySquelch = 86400;    # wait at least one day between notifications

In addition, individual addresses can specify a custom squelch parameter in the Site.Notify List page:

    # Alice receives at most one email per day squelch=86400

    # Bob can get notifications hourly trail=Profiles.Bob squelch=3600

    # Charles uses the site default squelch 

Because a page will often receive several edits in rapid succession (e.g., a long post followed by several minor edits), a site administrator can also set a $NotifyDelay value that specifies how long to wait after an initial post before sending notifications:

    # enable notifications
    $EnableNotify = 1;
    $NotifySquelch = 86400;    # wait at least one day between notifications
    $NotifyDelay = 300;        # wait five minutes after initial post

Note that the squelch and delay values are minimums; notifications are sent on the first execution of Pm Wiki after the delay period has expired. For inactive sites, this could be much longer than the specified delay periods. This isn't really considered an issue since timely notifications are less important on relatively inactive sites. (Active sites will
generally receive timely notifications.)

Note for Windows installations

Sites running PHP under Windows may not have PHP's »mail function configured correctly. Such sites may need to add a line like


to config.php, where is the name of your host's preferred outgoing mail server.

Notify Variables

<< Other Variables | Variables | Mail Posts >>

Tells stdconfig.php to enable the notify script.
        $EnableNotify = 1;          # enable notify
        $EnableNotify = 0;          # disable notify
Return email address to be used in the sent email.
        $NotifyFrom = '';
        $NotifyFrom = 'Wiki server <>';
The length of time (seconds) to wait before sending mail after the first post. Defaults to zero - posts are sent as soon as any squelch period has expired.
        $NotifyDelay = 300;    # send mail 5+ min after first post
The default minimum time (seconds) that must elapse between sending mail messages. Useful when $NotifyDelay is set to a small value to keep the number of mail notification messages down. Defaults to 10800 (three hours). Individual recipients can override this value in the Site.Notify List page.
        $NotifySquelch = 43200;  # wait 12+ hours between mailings
The text to be sent for each changed item in the post. The string "$PostTime" is substituted with the time of the post (controlled by $NotifyTimeFmt below).
        # default
        $NotifyItemFmt = ' * $FullName . . . $PostTime by $Author';
        # include the page's URL in the message
        $NotifyItemFmt =
          " * \$FullName . . . \$PostTime by \$Author\n     \$PageUrl";
The format for dates/times in $PostTime above. Defaults to the value of $TimeFmt.
        $NotifyTimeFmt = 'm-H:%M';  # 2004-03-20 17:44
The body of the message to be sent. The string "$NotifyItems" is replaced with the list of posts (as formatted by $NotifyItemFmt above).
The subject line of the mail to be sent.
String of extra mail headers to be passed to the mail() function.
String of additional parameters to be passed to PHP's mail() function »[1].
The scratch file where Notify keeps track of recent posting information. Defaults to "$WikiDir/.notifylist". Note that this file must generally be writable by the webserver process.
The name of the page containing notify= lines for use by notify.php. Defaults to {$SiteGroup}.NotifyList.
An array of notify= specifications that can be specified from a local customization file (used in addition to entries in Site.Notify List).
        # send notifications to
        $NotifyList[] = ''

<< Troubleshooting | DocumentationIndex | Web feeds >>

Powered by PmWiki 2.1 Impressum | Letze Änderung: 01.06.2006 | Besucher: 261 Historie | Editieren