PmWiki /
MailPostsadministrators (basic) obsolete As of PmWiki 2.1.7, the MailPosts capability is being superseded by the more advanced notify.php script. See Notify for details.
The mailposts.php script allows a site administrator to configure PmWiki to send email messages whenever pages are changed on the wiki site. MailPosts can be configured so that multiple page changes over a short period of time are combined into a single email message (to avoid flooding a mailbox). The MailPosts feature is especially useful for sites that have infrequent updates, eliminating the need to frequently check RecentChanges pages just to see if anything has changed. Full configuration details are available in scripts/mailposts.php. Below is a brief synopsis of what needs to go in config.php or a per-group customization script for MailPosts: <?php if (!defined('PmWiki')) exit(); $EnableMailPosts=1; # to enable mailposts $MailPostsTo="somebody@example.com"; # where to send mail $MailPostsDelay=1800; # wait 30+ min after initial post $MailPostsSquelch=7200; # require 2+ hours between mails Note that For newbies: The ONLY file that needs editing is the local/config.php for this recipe to work. Add any or all of the configurations to the config.php file and it should work rather easily, assuming your host meets the other requirements. On a per group basis you could set local/MyGroup.php (Create the MyGroup.php file if necessary) to: <?php if (!defined('PmWiki')) exit(); $EnableMailPosts=1; # Enable mailposts $MailPostsTo="xxx@mail1.com, yyy@mail2.com"; # where to send mail $MailPostsFrom="bbb@mail4.com"; $MailPostsDelay=1800; # Wait 30+ minutes after initial post $MailPostsSquelch=7200; # Require 2+ hours between mails $pagename = ResolvePageName($pagename); $group = PageVar($pagename, '$Group'); $MailPostsMessage = "Recent wiki posts:\n" ." ($ScriptUrl/$group/RecentChanges)\n\n\$MailPostsList\n"; $MailPostsFile = "$WorkDir/.$group.mailposts"; Now make a change or add a document to one of the MyGroup documents and save it. You should receive an email. Be patient. Even if you set (my test settings) $MailPostsDelay=18; # Wait 18 seconds after initial post $MailPostsSquelch=72; # Wait 72 seconds after initial post it took between 5 and 10 minutes for me to get the email. Since an initial post is often followed by several posts containing minor edits, it's useful to wait a short period of time before sending an email.
The defaults for The variables used to control MailPosts are given below, and also described in the mailposts.php script. Note for Windows installationsSites running PHP under Windows may not have PHP's mail function configured correctly. Such sites may need to add a line like ini_set('SMTP','smtp.server.com'); to config.php, where smtp.server.com is the name of your host's preferred outgoing mail server. MailPosts Variables<< | Variables | >>
$EnableMailPosts = 1; # enable mailposts $EnableMailPosts = 0; # disable mailposts
$MailPostsTo = 'admin@example.com, joe@somewhere.org';
$MailPostsFrom = 'wiki@example.com'; $MailPostsFrom = 'Wiki server <wiki@example.com>';
$MailPostsDelay = 360; # send mail 6+ min after first post
$MailPostsSquelch = 43200; # wait 12+ hours between mailings
# default $MailPostsItemFmt = ' * $FullName . . . $PostTime by $Author'; # include the page's URL in the message $MailPostsItemFmt = " * \$FullName . . . \$PostTime by \$Author\n \$PageUrl";
$MailPostsTimeFmt = '%Y-%m-%d %H:%M'; # 2004-03-20 17:44
# call /usr/lib/sendmail directly instead of using mail() $MailPostsFunction = [='MailPostsSendmail'=];
Discussion that was here has been moved to PmWiki:MailPosts-Discussion.
This page may have a more recent version on pmwiki.org: PmWiki:MailPosts, and a talk page: PmWiki:MailPosts-Talk. |