Extension:Email notification

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Email notification

Release status: unmaintained

Implementation Notify
Description E-mail notification (ENotif) - a scheme allowing for page change or creation notifications sent as e-mail (listed as enhancement bugzilla 454) and

E-mail address confirmation (EConfirm) - a mechanism to confirm the stored e-mail address by mailing a link (enhancement bugzilla

Author(s) Wikinaut
Latest version 3.08
License No license specified
Download No link

Translate the Email notification extension if it is available at translatewiki.net

Check usage and version matrix; code metrics


Note: The documentation of the extension has only partially been maintained since March 2006, but most of its features have been added to MediaWiki version REL1_6 in 2006. See Manual:Configuration settings#Email notification (Enotif) settings et al. Please take note that all Foundation wikis have Email notification enabled since May 14, 2011 - check your personal preferences to opt-in if you like to receive notification mails for changes on your user page (see also the help page).
This page and related bugzilla bugs will be updated in the next couple of days to reflect the current state. --Wikinaut 11:35, 14 May 2011 (UTC)


Email Notification (ENotif) v3.x/CVS REL1_4, REL1_5DocumentationScreenshotsInstallationTo-Do listFAQBugsVersionsYour feedbackBugzillaall pages at once

 

  • E-mail notification (ENotif) - a program which allows a user to be notified by e-mail of page changes or page creation (listed as enhancement bugzilla 454) and
  • E-mail address confirmation (EConfirm) - a program which confirms the stored e-mail address by mailing a link (enhancement bugzilla 866)

For the impatient: quick how-to[edit | edit source]

Operating System GNU/Linux
Distribution Debian Jessie
Mediawiki version 1.20.3
E-mail server Postfix, installed on the same server as mediawiki

1. Installing PHP PEAR:

sudo aptitude update; sudo aptitude install php-pear

2. Install PEAR packages:

sudo pear install mail net_smtp

3. Edit:

sudo cp /srv/www/wiki/LocalSettings.php /srv/www/wiki/LocalSettings.php.bak
sudo vim /srv/www/wiki/LocalSettings.php

And add below lines:

# Email
$wgEnableEmail = true;
$wgEnableUserEmail = true;
$wgEmergencyContact = "admin@example.com";
$wgPasswordSender = "app_robot@www-1.local.example.com";
$wgEnotifUserTalk = true;
$wgEnotifWatchlist = true;
$wgEmailAuthentication = true;
$wgSMTP = array(
 'host'     => "127.0.0.1",
 'IDHost'   => "www-1.dev.local.jamgo.org",
 'port'     => 25,
 'auth'     => false,
);

NOTE : the value " IDHost " must match the hostname (run command "hostname")

4. Edit the postfix config file:

sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
sudo vim /etc/postfix/main.cf

And make sure the lines are as follows:

myhostname = www-1.dev.local.jamgo.org
mydestination = www-1.dev.local.jamgo.org

5. Restart services:

sudo /etc/init.d/postfix restart
sudo /etc/init.d/apache restart

6. Setting the User "watcher " to receive emails

6.1. Sign in mediawiki

6.2 . Go to "preferences/user profile"

6.3 . Make sure that you have valid email address and check all the options on "Email options" box

6.4 . Edit "page" and watch it.

7. Log in with user "editor" and edit "page". Once you are done save the changes.

Expected behaviour: www-1.dev.local.jamgo.org host should send an e-mail to e-mail address of user "watcher". You can check it live with:

sudo tail -F /var/log/mail.log

If it's not working, just in case:

1. Log out both users 2. Login user "watcher" and unwatch and watch again page "page" 3. Repeat step 7

EConfirm: E-mail address confirmation[edit | edit source]

  • When a user adds or changes the e-mail address during account creation or on the user preferences form, the wiki sends a link for confirmation to this address; the address remains marked as unconfirmed until the user has followed the link which was mailed. All enhanced mail functions, currently a) e-mail to user and b) e-mail notification, do only send mails to confirmed addresses, and nothing is sent to unconfirmed addresses.
  • E-mail address confirmation can be used and configured independently from ENotif: enabled or disabled with the switch $wgEmailAuthentication. If the switch is set to false, messages regarding (un)confirmed addresses are suppressed, and all e-mail functions do work (if e-mails as such are enabled on this wiki) as in standard MediaWiki.
  • When using ENotif, you should always enable EConfirm. In that case, the wiki mails only to confirmed addresses.
  • E-Mail addresses of bureaucrats, developers or sysops become confirmed as they are entered, i.e. without the confirmation cycle. This behaviour can be configured (enabled as described or disabled) with switch $wgEmailConfirmationRequiredForAll.
  • The status (unconfirmed or date/time of confirmation) is always shown beneath the address on the user preferences page
  • E-mail addresses are currently not checked to be compliant with RFC-2822 when they are stored in the database. This is issue of bugzilla:959.
  • If a user changes their e-mail address to another, non-empty address, the wiki automatically sends a link for confirmation.

List of bugzillas which it influences, implements or solves[edit | edit source]

  • Bug 1932 Tracking ENotif/EConfirm & further enhancements (tracking)
add your address to the CC list of this enhancement bugzilla, if you want to be informed of any changes on one of the others
  • Bug 454 E-mail notification (EN) for page changes of watch-listed pages, user_talk page, and for new pages
add your address to the CC list of this enhancement bugzilla, if you want to be informed of changes and new versions of ENotif only
  • Bug 181 Assign lasting ID to latest revision of articles (OPEN)
  • Bug 505 Specify timezones by location, to allow automatic adjustments (OPEN; TOUCHED HERE BY INTRODUCING $wgTimeCorrectionOverwrite)
  • Bug 536 For pages on watchlist save last seen version number (OK)
  • Bug 581 treat user_talk pages as every other "normal" page (OK)
  • Bug 603 Delete + undelete cycle doesn't preserve old_id (OK in REL1_5)
  • Bug 664 UserMailer.php php mail() -f additional parameter field for SMTP mail sender envelope vs. PHP safe mode enabled (TOUCHED)
  • Bug 727 Number of watching users per page to be shown on recent changes view (OK)
  • Bug 782 User option "show only the current revisions of pages" suppresses listing of all older revisions of pages in recent changes view (OK)
  • Bug 804 create an LVR REPOSITORY for last-visited revisions until they are visited (OK)
  • Bug 824 user preference page: do not show help for realname if "realname" field is disabled by sysop (OK)
  • Bug 866 EConfirm (EC): e-mail address confirmation by sending a link comprising a token to the unconfirmed mailaddress (OK)
  • Bug 907 UserMailer() function revision to allow for parameters in the form "name (..) <emailaddress>" (OK)
  • Bug 952 table user got new columns user_email_confirmed, user_email_token, user_email_token_expires
  • Bug 959 Email addresses need to be checked before storing in database to comply with RFC-2822 (OPEN)
  • Bug 1116 E-mail notification for page changes or new pages, where title or body or category matches a regular expression (OPEN)
  • Bug 1125 WYSIWYG editor integration (FCKeditor 2.0) (OK)
  • Bug 1133 EmailUser: additional option to send a (blind) copy to oneself (OPEN)
  • Bug 1363 Enotif Reset Nofication Flags does not work (OK)
  • Bug 1370 ENotif mails are not automatically reenabled after sent when watching users visits watched and notified page (OK)
  • Bug 1541 "mail me a new password" email has no FROM: (OK)
  • Bug 1572 Add diff link to "You have new messages" (OK)
  • Bug 1746 Subject of email-notifications must be quoted-printable. (OK)
  • Bug 1831 request for 3 CVS HEAD changes (please fix) (OK)
  • Bug 1855 waste through varchar in database (OK)
  • Bug 1876 Show "You have new messages on your user or user_talk page" -- i.e. both pages are notified (OK)
  • Bug 1891 Assign lasting ID to oldest (=first, =initial) revision of articles (OPEN)
  • Bug 1895 Recent changes views show "(last seen)" -- for "difference to my last seen revision of that page" (OK)
  • Bug 2014 ENotif code clean-up patch for REL1_5 (patchlet #1)
  • Bug 2066 adding e-mail notification for _new_ pages to ENotif patch (patchlet #2)
  • Bug 2082 Related changes views (Special:Recentchangeslinked) do not indicate one's watched page (OPEN)
  • Bug 2105 Any mediawiki mail functions are potentially blocked by missing "space"in php mail() call in UserMailer::userMailer() (OK)
  • Bug 2126 Unable to set new password after using emailed password (problem confirmed and found; will be fixed in Enotif > 3.25)
  • Bug 2259 patch for User.php: login with temp.password also indicates that the e-mail address is valid
  • Bug 2439 e-mail confirmation error message issues (OK in EnotifWiki 3.28)
  • Bug 5220 E-mail notification: proposal to enable now $wgEnotifUserTalk in Default/LocalSettings in the major wiki (enwiki, dewiki, frwiki, nlwiki) (OK) --Wikinaut 11:24, 14 May 2011 (UTC)

Some of the enhancement bugs are marked as (OPEN); this means, that I will implement these enhancements in one my next versions.

"What can I expect and how does it work ?"[edit | edit source]

Basics[edit | edit source]

A single e-mail is sent to the watching user x

  • if the WikiSysop has globally enabled this feature in the DefaultSettings.php or LocalSettings.php
  • and if the user has stored an email address in the user preferences
  • and if the user has enabled the personal enotif options in the user preferences

on the event that

  • someone else changes a watched page listed in user x's watch list or
  • someone else changes the user or user_talk page of user x or
  • someone else creates a new page (if enabled by WikiSysop; a user option is shown in the preferences page)

No further mails are sent to you until you re-visit the watched page - or a difference view against it.

Update marker[edit | edit source]

All users can enjoy a side-effect of enotif - regardless whether they have enabled or disabled their personal enotif options:

  • a garish updated marker  updated (since my last visit)  indicates new contents on watch-listed pages since the last visit (of user x). The updated marker is shown on the a) watchlist page, b) recent changes page close to the bold-titled page names of pages being watched, and c) page history. Be reminded: your own changes never trigger notification mails or "updated" markers, so you are only informed about changes of somebody else, which you have not yet seen.
The marker is so garish and big to attract your attention and because it is directly linked to show you the difference between current and last seen version of that page, see below. Before complaining: you can switch it off by unchecking the corresponding option in your preferences.

improved version shows "(last seen)" to avoid "(last)"

1:  updated (since my last visit) 
Markers indicate all watched pages with unseen changes.
Markers are also direct links to the (same) difference view between the current revision of that page and the(my) last-visited revision.
They link to http://server/testwiki/index.php?title=User:Test&diff=0&oldid=1956 in the example.
2: (last seen) : a direct link to Difference between this revision and the last seen revision (lsr)
not implemented in ENotif version v2.x
These links are also active for older-than lsr revisions (e.g. you can quickly compare any arbitrary revision with the version, you saw last)
Only watched pages having unseen changes bear active (last seen) links; in the example you see some black inactive (last seen) links, because these pages are not watched pages. They cannot show unseen changes, because only watched pages offer information about last seen revision, which is used to determine unseen changes of any watching the user.
3:   (last seen)   :
The(my) last visited revision of that page
not implemented in ENotif version v2.x
4: [4] :
Number of users watching that page

See further screenshots on the versions page.

Features[edit | edit source]

  • The ENotif patch was developed for small- to medium-scale MediaWiki implementations. Personalised e-mails (with recipient's name; times expressed in local time of the recipients) for every watching user. [The program flow will be changed in next versions to allow bulk notification mails to be sent, depending on parameters, to save processing time and bandwidth.]
  • The sub-feature notification on user_talk page (UTP) changes could be enabled even for the largest WikiPedia, because the number of UTP changes is surprisingly low - according to Brion Vibber. About 800 alien UTP changes (changes by others than yourself) per day have been counted in August 2004, which would result in the same (relatively low) number of enotifs sent to the UTP owners.
  • All features are configurable (enable/disable) in module DefaultSettings.php respectively LocalSettings.php for the WikiSysop, who can separately allow or disallow notifications for
    1. changes of pages in all name spaces (AO/UO) and/or
    2. changes of user and user_talk pages (AO/UO)
    3. creation of new pages (AO/SO/UO)
user preferences with an authenticated e-mail address and the new page notification option
  • Implements and solves
Bug 1572 Add diff link to "You have new messages" (OK)
Bug 1876 Show "You have new messages on your user or user_talk page" -- i.e. both pages are notified (OK)

Newmessage.png

(AO) admin option:
allows to disable or fine-tune these extensions globally
(SO) special user option:
for bureaucrats, developers and sysops only
(UO) user option:
if the admin option enables the feature globally, a user option in user preferences is shown and allows the users to opt-in or opt-out to this feature at their discretion.
  • The subject line and text of the notification message are pages in the MediaWiki:namespace and can therefore be changed live by Sysops. You can use several named $variables such as $PAGEEDITOR, see example below.
  • The notification message contains a direkt link to the difference view (last seen) between the current page version and the last one the watching user has seen i.e. the page version just before the page change notification was sent. Remark: the (last seen) link is valid forever, because page revision identifiers are now sticky (permanent), they survive delete/undelete cycles since REL1_5 (this is not the case in older MediaWiki versions).
  • Your own page changes or creation of a page (if enabled) never trigger a notification mail sent to yourself.
  • Minor edits may trigger notification e-mails sent out depending on your preferences (AO/UO).
  • All UTP changes trigger a notification to be sent, no matter whether the changing editor declared the change as minor edit or not.
  • Only one mail is sent on the first page change. Further mails are suppressed until you re-visit the changed page or until you reset all notification flags. A new button has been introduced for this purpose on the watchlist page.
  • On the watchlist page, a new marker  updated (since my last visit)  indicates such watched pages for which a notification mail was sent, meaning that the page has new contents since your last visit (AO/UO).
  • The marker is also shown on your recent changes page and on page history pages for the pages watched by you (already marked bold) and which do have new contents since your last visit (AO/UO).
  • Recent changes view and page(article) footers show number of watching users (AO/UO).
  • If you wish, you can add not-yet existing page names as usual to your watch list and you will receive an email notification as someone creates a page with that name. You will see the updated marker for the page until you actually visit that page.
  • Debuggers can activate server beeps on notification mails, this is disabled by default. (AO)

Prerequisites[edit | edit source]

You definitely need a working php mail() system on your server. I suggest you quickly check your current wiki installation before trying the E-mail notification patch. Try requesting a temporary password for your wiki user account by clicking the button mail me a temporary password on the wiki login screen. If, sooner or later, you receive an e-mail from your "old" wiki, everything looks fine and ready for the installation of ENotif.

ENotif/EConfirm has been developed to work smoothly with

  • php mail()
    thus it is not using the PEAR:Mail() module; see /includes/UserMailer.php
    $wgSMTP = false;

and

  • MySQL database server
    thus it is not checked to work with PostgreSQL
    $wgDBtype = "mysql";
    $wgSearchType = "MyISAM";

For further information such as

  • how to configure the php mail()
  • Why do I need to set up a sender address information ("FROM:")
  • and how to configure MySQL

please consult /includes/DefaultSettings.php

If you want to use it together with PEAR:Mail and/or PostgreSQL

  • please let me know.

Code security and general issues[edit | edit source]

The code was peer-reviewed several times and the version 2.00 was committed to CVS HEAD (version 1.5) in December 2004. However, since then, several persons have modified this and that in the CVS HEAD version, which could have led to a non-working version in CVS.

I always publish a complete diff on the accompanying ENotif bugzilla.

"It does not work": common pitfalls[edit | edit source]

  • Avoid the most common pitfalls from the beginning and read carefully:

Be aware, that

  1. your wiki e-mail system must be working as such - test it by mailing you a temporary password (this is independent from ENotif)
    see provisionally Bug 664 for problems with PHP mail() function and PHP SAFE MODE mode enabled.
  2. you obviously need an e-mail address - check the address field in user preferences
  3. e-mail address must be marked as confirmed (if EConfirm is mandatory on your wiki)
  4. there are never notifications for your own changes. Change a page watched by A as other user B and check, whether an ENotif is sent to watching user A.
  5. only one ENotif is sent for the first page change of a page you are watching or, when a new page is created (if this feature is enabled)
  6. notification is automatically re-enabled when you visit the current version of the page or the difference view to the current version
  7. you also can clear all notification flags at one click (button on your watchlist)
  8. you need to update the text message cache, if you have customized test strings in a LanguageXX.php file

Inside ENotif and EConfirm[edit | edit source]

Download[edit | edit source]

Available versions (see also version history)
always see EnotifWiki file release download section on BerliOS Open Source server
For MediaWiki developers version (CVS HEAD REL1_5) Enotif v.2.x
  • simply checkout or update from MediaWiki CVS, as this is the version included in MediaWiki 1.5
  • be reminded, that this large documentation page you are visiting now describes merely the features of my ENotif/EConfirm v3.x, now called EnotifWiki 3.x with permission of the Wikimedia Foundation. The 3.x version is much more powerful than the 2x, as it adds for example notification for new pages and the difference-to-last-seen-version links and has lean code.

special version EnotifWiki v3.x for CVS REL1_5 beta versions

  • code of is available from a repository on BerliOS Open Source Server
  • be aware, in what subdirectories the code installs and save your directories, if you need it.
  • important: the tgz files comprise CVS markers and tags, so that you easily can make further updates from CVS upon my version. Usually, you can delete these files (further instructions to follow on a different place).
For MediaWiki version 1.4.6
  • code of EnotifWiki versions before 3.47 for MediaWiki versions before 1.5 is available from an archived repository on SourceForge
  • This version uses e-mail authentication, a deprecated method which mails a "temporary password", the regular password not being touched by this)
  • This method has been significantly changed in the other (newer) versions of EnotifWiki, which are strongly recommended; the new method being the same and therefore fully compatible with MediaWiki 1.5 mechanisms.
For older MediaWiki versions See my archive or contact me.

Installation[edit | edit source]

Implementation details and flowcharts[edit | edit source]

Release Notes[edit | edit source]

Configuration[edit | edit source]

ENotif configuration: sysop settings in /includes/DefaultSettings.php[edit | edit source]

  • in LocalSettings.php or DefaultSettings.php
  • (coming soon)

Notification mail (text templates and variables therein)[edit | edit source]

  • In languages/Language.php, amongst other new constants, there are two important text templates with $VARIABLES, which get substituted with values when the ENotif mails are composed. The text templates are shown here for the sake of completeness of the documentation, so that you know in advance, what you can change.
  • Please consult /includes/UserMailer.php if you are curious to learn where the variables such as $PAGEEDITOR get their values from, but you usually don't have to study this file.
  • If you encounter problems with the message cache - e.g. that your changes on LanguageXX.php are not effective and do not work - please consult the pages you get with this search on MetaWiki. It is standard MediaWiki procedure, that you need to run an update program in certain cases !
MediaWiki:email_notification_body[edit | edit source]

This is the text template for the body of the notification mails. It resides in file /languages/Language.php and can be adapted by yourself according to your needs. You can change the text before or after the installation of your EnotifWiki. However, when you changed the text in the file /languages/Language.php after the installation, then it might be necessary to run once the program

run /maintenance/php rebuildMessages.php --rebuild

as explained above. This might take a few seconds. A detailed explanation, why this might be necessary, can be found on here.

Alternatively, you can also change the text live on your wiki by editing the page [[MediaWiki:email_notification_body]], but such a change must be done for every wiki, if you run several wikis.

Dear $WATCHINGUSERNAME,

the {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR,
see {{SERVER}}{{localurl:$PAGETITLE_RAWURL}} for the current version.

$NEWPAGE

Editor\'s summary: $PAGESUMMARY $PAGEMINOREDIT

Contact the editor:

mail {{SERVER}}{{localurl:Special:Emailuser|target=$PAGEEDITOR_RAWURL}}
wiki {{SERVER}}{{localurl:User:$PAGEEDITOR_RAWURL}}

There will be no other notifications in case of further changes unless you visit this page.
You could also reset the notification flags for all your watched pages on your watchlist.

             Your friendly {{SITENAME}} notification system

---
To change your watchlist settings, visit
{{SERVER}}{{localurl:Special:Watchlist|magic=yes}}

Feedback and further assistance:
{{SERVER}}{{localurl:WikiHelpdesk}}'
MediaWiki:email_notification_subject[edit | edit source]

The previous section explains how you can change this text (change file /language/Language.php and run a maintenance program, or edit page [[MediaWiki:email_notification_subject]]).

{{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED by $PAGEEDITOR

Notification mail (sample)[edit | edit source]

  • The subject text comes from language/Language.php MediaWiki:email_notification_subject as described above
  • The body text comes from languages/Language.php MediaWiki:email_notification_body as described above
  • This comprehensive (and therefore heavy) example shows all possibilities. If you wish to shorten the mail, you need to edit the Language.php file(s) or to change the mentioned MediaWiki: pages in your live system.

Example for a typical email notification message

MIME-Version: 1.0
Content-type: text/plain; charset=utf-8
X-Mailer: MediaWiki mailer

    From: WikiAdmin <admin@myserver.com>
Reply-To: reply@not.possible
      To: Albert Einstein <user@userdomain.de>
 Subject: Testwiki page Main Page has been changed by TestUser

Dear Albert Einstein,

the Testwiki page Main_Page has been changed on 21:25:06, 19 Apr 2005 by TestUser,
see http://www.myserver.com/testwiki/index.php/Main_Page for the current version.

See http://www.myserver.com/testwiki/index.php?title=Main_Page&diff=0&oldid=9807 for all changes since your last visit.

Editor's summary: typo correction: I like ENotif 

Contact the editor:
mail http://www.myserver.com/testwiki/index.php?title=Special:Emailuser&target=TestUser
wiki http://www.myserver.com/testwiki/index.php/User:TestUser

There will be no other notifications in case of further changes unless you visit this page.
You could also reset the notification flags for all your watched pages on your watchlist.

             Your friendly Testwiki notification system

---
To change your watchlist settings, visit
http://www.myserver.com/testwiki/index.php?title=Special:Watchlist&magic=yes

Feedback and further assistance:
http://www.myserver.com/testwiki/index.php/WikiHelpdesk

Internationalisation (I18N)[edit | edit source]

Related extensions[edit | edit source]