Extension:EmailArticle

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
EmailArticle

Release status: stable

Implementation Special page
Description Send rendered HTML article to an email address or list of addresses using phpmailer
Author(s) User:Nad
Version 1.0.9 (2008-01-19)
MediaWiki 1.8.0+
Download SVN

Contents

[edit] Installation

Create a EmailArticle folder in your extensions directory. Download the main extension script from SVN into the new folder and include it in your LocalSettings.php file as in the following example.

include("$IP/extensions/EmailArticle/EmailArticle.php");

The EmailArticle on SVN also contains the phpmailer HTML emailing component (tested and working with version 2.0.0), but you may want to check source from phpmailer.sourceforge.net in case a later version is available.

Ensure that all the files you've downloaded and saved are accessible by the webserver.

[edit] Usage

The extension adds a specialpage called Special:EmailArticle which requires a parameter of the article title you wish to send. It also adds links to the actions and toolbox using the link names specified in $wgEmailArticleToolboxLink and $wgEmailArticleActionLink. Either one can be set to "" (empty) to remove the link.

The specialpage form has two main sections, one for selecting the recipients of the emailed article, the other to specify the specifics of the subject line, prepended message and CSS stylesheet.

[edit] Selecting recipients

There are three different ways of specifying recipients for the article to be sent to, which are described below. All three can be used together in composing an overall selection of recipients.

From group

All the available MediaWiki groups are listed in a drop-down list. If one of these is selected then all the members of that group which have an email address will be added to the recipient list.

From contacts category

If a category name is specified in $wgEmailArticleContactsCat then its sub-categories will be listed in a drop-down list in the email article form. each of these sub-categories should contain articles which each represent a single contact. The first email address out of each contact article will be added to the list of recipients.

Directly from a list

A textarea is supplied in the for for adding additional recipients directly. These recipients can be entered directly as email addresses on each line, or separated by comma's, semicolons or asterisks (bullet list). If an item is not an email address, it will be treated as a contact article title which from which the first email address will be extracted. This textarea is treated as wikitext and will have templates expanded before extracting the email addresses which means that it can contain a DPL query which could result in a list of email addresses or contact articles.

[edit] Configuration settings

Here are some global variables which affect the operation of the extension. These should be set in your LocalSettings file after the include of the EmailArticle.php script.

Variable Default value Meaning
$wgEmailArticleGroup sysop Users must belong to this group to send emails (empty string means anyone can send)
$wgEmailArticleContactsCat empty This specifies the name of a category containing categories of contact articles. If this value is not empty, a dropdown list will be included in the form which contains the sub-categories.
$wgEmailArticleCss EmailArticle.css The name of a minimal CSS article to embed in the email (eg. monobook/main.css without portlets, actions etc).
$wgEmailArticleAllowRemoteAddr server-IP, 127.0.0.1 Trusted addresses for which anonymous sending is allowed. This allows local scripts and cron-jobs on the server to send email directly from and HTTP request.
$wgEmailArticleAllowAllUsers false Whether to allow sending to all users (the "user" group)
$wgEmailArticleToolboxLink Send to email Link title for toolbox link (set to "" to not have any link in toolbox)
$wgEmailArticleActionLink email Link title for action link (set to "" to not have any action link)
$wgPhpMailerClass script-dir/phpmailer/class.phpmailer.php The fullname of the file containing the phpmailer class

[edit] CSS Stylesheets

By default the CSS used is called EmailArticle.css which is intended to be a cut down compact css based on the stylesheet for you wiki but with all the portlet, actions and other skin related styles removed.

The EmailArticle form also has a dropdown list containing all the other CSS articles found in the wiki (all articles with titles ending in .css).

[edit] MediaWiki versions

  • Works on 1.9.x and 1.10
  • Has a fatal error in 1.6.x

[edit] Todo & bugs

  • Usage documentation !!
  • Multibyte characters not rendering in emails properly
  • Add toolbox link automatically
  • ea_autherror message not working
  • PLURAL's not working
  • Title not showing in subject's default message anymore
  • Should log sends to an MW log
  • Allow setting FROM field, default to users email address

[edit] Change log

Version 1.0.9 (2008-01-19)

Don't rely on REGEXP for SQL queries, not supported by some database types

Version 1.0.5 (2007-09-14)

Fixed warning messages in MW1.11

Version 1.0.4 (2007-08-27)

Needs $this->setHeaders() in execute()

Version 1.0.3 (2007-07-10)

Fixed blank article title in subject line, and fixed problem when using empty $wgEmailArticleGroup

Version 1.0.1 (2007-06-08)

Added $wgEmailArticleToolboxLink and $wgEmailArticleActionLink globals for adding toolbox and action links

[edit] See also

Personal tools