Jump to content

Extension:SendmailToWiki

From mediawiki.org
Revision as of 22:42, 13 August 2012 by KrenairBot (talk | contribs) (This extension appears to be in SVN, not Git.)
MediaWiki extensions manual
SendmailToWiki
Release status: beta
Implementation User interface, Special page
Description Posting (and editing) content on wiki through e-mail messages
Author(s) Jure Kajzer (Freakolowskytalk)
Latest version 0.1.0 (26.11.2009)
MediaWiki 1.16.
License GPL
Download Template:WikimediaDownload/svn
$sendmailtowikiPrefix
Translate the SendmailToWiki extension if it is available at translatewiki.net

What can this extension do?

This extension allows user to insert, update or just view a wiki page with an e-mail client.

Usage

User can set a 5-digit PIN number in his user preferences page. He can then use the displayed e-mail address in form of <mail_prefix>+<user_id>.<PIN>@domain.com to post content. If the pin number is not present for a user, that user can not use this extension. For a successful action the sender address must match the e-mail address in user's profile.

The subject of the incoming e-mail is translated into page title and e-mail content into page content. To prevent misinterpretations the extension denies every action if the e-mail is not sent in plain text format.

The default action performed with this extensions is to insert or update a page identified by the title supplied in the subject using e-mail body as page content and reply only if there was an error, however you can prepend the title with one of the following options to change this behaviour:

  • [quiet] - do not reply in any case even if there was an error
  • [source] - do not change anything, just reply with page content (if found) in wikitext format; email body is ignored
  • [view] - do not change anything, just reply with page content (if found) in HTML format; email body is ignored
  • [reply] - after a successful action reply with new page content in HTML format
  • [createonly] - reply with error if page already exists
  • [nocreate] - reply with error if page does not exist

These options are stripped from title when performing the desired action.

Download

You can download the code via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SendmailToWiki/. From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SendmailToWiki/

To view the code online, including version history for each file, you can go here.


Installation of MW code

  • Copy or move the checked out directory to the main MediaWiki 'extensions' directory.
  • Add the following code into your 'LocalSettings.php' in the main MediaWiki directory:
include_once("$IP/extensions/SendmailToWiki/SendmailToWiki.php");

Installation of sendmail redirection

  • Check that you have [[1]] PHP libraries present in php configuration.
  • Check that you have [[2]] functions enabled and configured in PHP configuration.
  • Check that the script provided in extension's scripts subdirectory har the right permissions to be run as sendmail's Delivery Agent
  • Add the following aliases to your sendmail [database] and afterwards rebuild the aliases table (with newaliases). Replace the wiki url with your own and e-mail prefix if you changed the setting of $sendmailtowikiPrefix in your LocalSettings.php (the default is "wikipost"):
wikipost+*:     wikipost
wikipost:       "|/path-to-wiki/extensions/SendmailToWiki/scripts/post_to_wiki.sh http://www.host.com/wiki-scriptpath"


Configuration parameters

  • $sendmailtowikiPrefix - the prefix of e-mail addresses (default: wikipost). If you change this variable, make sure you change your sendmail aliases file accordingly.