Extension:EmailToWiki

The EmailToWiki extension allows emails to be sent to the wiki and imported as an article. Any attachments the email has are uploaded into the wiki and linked to in a section at the end of the email and are uploaded with a unique name so that they don't conflict with other attachments of the same name in other email messages. The title of the articles created for imported emails has a configurable format and the content is created as a template followed by the body-text as shown in the example article content in the section below:

Installation

 * Download the following source files from here.
 * Put all files in a directory called EmailToWiki in the wikis extensions directory
 * Create an empty directory in EmailToWiki called EmailToWiki.tmp which is writable by the webserver
 * Create an empty file in EmailToWiki called EmailToWiki.log which is writable by the webserver
 * Create configuration in a file called EmailToWiki.conf based on the EmailToWiki.conf.sample file
 * Ensure the configuration file is readable by the Perl script, but not readable by the web-server
 * Call the script on a regular basis, say every five minutes, from crontab as root or a privileged user
 * Include the PHP script from your LocalSettings.php file like usual:

If using a Windows server you can get Perl from www.activeperl.org and add the execution to you system scheduler from control panel. On Linux you'll already have Perl and you can add the script to your crontab with a line similar to the following which calls the script once every 5 minutes. */5 * * * * root /var/www/wiki/extensions/EmailToWiki/EmailToWiki.pl > /dev/null

Dependencies
The Perl script uses Net::POP3, Net::IMAP::Simple, Net::IMAP::Simple::SSL, Email::MIME (at least v1.9), HTTP::Request and LWP::UserAgent. On Debian-based operating systems these dependencies are satisfied via the libwww-perl, libnet-imap-simple-ssl-perl and libemail-mime-perl packages, but on other systems you'll need to figure out what you need to do to satisfy these dependencies.

Configuration
Following is a description of the configuration directives listed in the sample configuration file.

Example template
The header parameters of the emails that are imported into the wiki are wrapped into a template, the default template is Template:Email, but can be set to something else using the $::template configuration parameter in the *.conf file. Here's an example of what the content of the template might be in the wiki.

Example content
Following is an example of the wikitext generated for imported emails: @undefined Body text of the test message

File attachments

 * 4ECED340.9010600@foo.bar test1.jpg
 * 4ECED340.9010600@foo.bar test2.jpg