Extension talk:EmailToWiki

How can i add to an existing Article ?
nice extension and it works. But how can i add the email to an existing article ? The extension creates allways a new one Thank you Regards Dieter

Dear Dieter, extension too works fine for me, but I couldnt figure out either how mails can be added to an existing article, did you find anyting yet ? I believe this function has not yet been propper implemented. Searching the web left me blind, but I made up a simple workaround - I defined a TEMPLATE to use with the Import - you can set it in EmailtoWiki.conf - and then have the article added to the same category. After that you can construct a page that shows all the content of this special category. Hope this helps!? Regards, Chris --46.189.27.118 10:32, 3 December 2013 (UTC)

Hey there ! Found some more Information, but since I do not understand mediawikis script language nor do I speak perl I don't know where to put the code and how to configure it. Any hints ? http://www.mediawiki.org/wiki/User_talk:Nad#Can_you_help_me_some_more.3F Yours, Chris --46.189.27.118 10:32, 3 December 2013 (UTC)

Hi! some news for editing existing articles? What needs to change? Thanks Serena

syntax error in the most recent revision
Hi we tried to install the extension, and noticed there is probably a closing "}" needed after line 181 in the Rev 1187 php script: these two brackets at lines 181 and 182 seem mismatched.

Protected wiki - Registered users
Hi, on the todo list is the 'allow/verify registered MW users' item. Just voting out loud for this option ;-) Specifically when a MW site is only accessible to registered users, or is there another way of doing this?

Tip: I think it is possible to 'force' all inbound mailed-articles to a specific category by:
 * modifying the script by adding the 'sentbymail' directive
 * Adding 'sentbymail:' in front of the subject of the mail

Hfwang

swell aran, thanks! does this require responding to Special:Confirmemail in order to use?

--Wikiexpert 12:32, 14 June 2007 (UTC)

Emails not showing up in wiki
Email to wiki is awesome!

Although, I am having a bit of a tough time getting it to work.

the log file shows that EmailToWiki is getting into email, and is processing email, but none of the pages or updates are actually showing up on the wiki. (I do have SimpleForms installed, too).

My EamilToWiki conf looks like this: $popServer = "mail.xxxxx.com"; $popUser = 'wiki@xxxxx.com'; $popPassword = 'password'; $maxlines = "1000"; $deleteProcessed = "true"; $wikiTemplate = 'Email'; Any help is greatly appreciated! :) --SamRose 20:20, 24 September 2007 (UTC)
 * The first thing to check would be to see whether Simple Forms is able to create and edit articles, try creating the following form to test this,

Newly created article will be shown here... This should make a form into which you can type an article name and some content, when you hit submit it should create that article. --Nad 21:25, 24 September 2007 (UTC)


 * Well, I'm part of the way there...creates form, but not article: http://socialsynergyweb.com/semanticwiki/index.php?title=WikiEmail --SamRose 21:41, 24 September 2007 (UTC)


 * I should have specified a simpler test actually since that one requires Ajax/Mootools which isn't working, but EmailToWiki doesn't need Ajax. I tested a simple-forms create-article request on your wiki which worked successfully, so the wiki side of things is working.


 * I've just noticed that two important configuration settings are missing in the docs! I think I missed them out because I was going to get it to automatically retrieve them from the LocalSettings file but never got round to it - sorry :-/ - You need to set $wgServer and $wgScript in your configuration to the same values as those variables in your wiki. In your case the following,

Thanks so much, Nad. I added those variables, but still having the same issue. Do I need to have a page with a Template on it named in the cofig, too?--SamRose 22:43, 24 September 2007 (UTC)
 * No the config should be fine now - the next thing to try would be to see if you can update/create an article from the shell, try

wget http://socialsynergyweb.com/semanticwiki/index.php?title=test-article&content=test-content and then see if "test-article" has been created with "test-content" in it. --Nad 23:30, 24 September 2007 (UTC)

(PS. Thanks very, very much for help!) --SamRose 23:51, 24 September 2007 (UTC)
 * Hmmmm that wget doesn't work for me either actually... I made a small test script that replicates exactly what the EmailArticle.pl script does and ran it locally from my shell here and it's updated your wiki correctly, so it must be a problem with your server setup, try creating the following test script (from your servers shell), set its permissions to 755 and run it to see if it can update your wiki, I suspect that there may be some perl components missing or something.

You are right. I am missing Net::POP3 Perl module. Thanks again for your help. I'll move this to a server that allows me to install these modules... --SamRose 02:31, 25 September 2007 (UTC)
 * If you have shell access to your server you should be able to install any additional perl modules since their installations are written in perl too - try downloading from CPAN, unpack and run makefile. --Nad 04:59, 25 September 2007 (UTC)

wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/libnet-1.22.tar.gz gzip -dc libnet-1.22.tar.gz | tar -xof - cd libnet-1.22 perl Makefile.PL make install

I don't get the username equaling the article title.
How does the username in the email address equate to the title? Does the script have to have access to any and all possible usernames email accounts?

It seems like a great idea, I guess I am just confused as to how it works with the email server.

Thanks, Pete. --205.172.241.12 16:14, 5 October 2007 (UTC)
 * This extension is for sending content to the wiki using email instead of browser, so the wiki must have its own email domain so that email can be addressed to a specific article. This is not related to wiki users or their email addresses, for sending wiki articles to users, use Extension:EmailArticle --Nad 21:10, 5 October 2007 (UTC)

Email processed but not showing up in wiki
I would love to get this extension running but I can't seem to get the email to show up in my test wiki.

I checked to make sure that I have Net:POP3 installed using (perl -MNet::POP3 -e 'print "Installed", "\n"'). I also tried to run your test .pl script and nothing happened. No errors or article creation.

My log file shows: Tue Oct 23 03:07:59 2007 : There are 1 messages on xxxx.com@xxxx.com Tue Oct 23 03:07:59 2007 : Processing email from xxxx@hotmail.com to somepage@captainwiki.com, subject: Tue Oct 23 03:07:59 2007 : "somepage" updated Tue Oct 23 03:07:59 2007 :  message marked for deletion Tue Oct 23 03:07:59 2007 : POP3 connection to xxxx.com closed and marked items deleted.

It looks to me like SimpleForms isn't processing the file correct. So I created the simple form you suggested above in the Sandbox and it creates an article without any problem.

I'm not sure where else to look. Any idea of what this problem could be? Thanks in advance! --Valkyrie 19:53, 23 October 2007 (UTC)
 * Try the modified version of the test perl script above which now prints the response content. It may help to see what's coming back from the server. --Nad 07:38, 24 October 2007 (UTC)

E-Mail Configuration?
I think I understand the basic requirement for the e-mail setup (any email to *@mywiki.colgate.edu must be routed to a single email address). This used to be done using rewrite rules in sendmail.cnf Is this still the case? Does anyone have a sample configuration to offer? Is this Linux Sys Admin Guide reference - http://www.faqs.org/docs/linux_network/x15291.html - a decent reference?

Wheelerda 14:46, 20 November 2007 (UTC)

Only works with anonymous edit permissions?
Hi. Am I right in thinking that this extension will only work if anonymous user edits are allowed? I have a site where only logged in users can create and edit article and I think this is stopping emailed articles from being inserted. mitchelln 15:49, 22 February 2010 (UTC)

Unable to download
Sorry but I was unable to download the extension from the given location. What is the preferred way getting the code? --Pintman (talk) 20:15, 21 April 2013 (UTC)

Emails didn't appear in wiki
We inslalled extention EmailToWiki. We are beginners. We followed instruction on extention page. But emails didn't appear in wiki.

Сontents of EmailToWiki.conf file are next: $::wiki = "https://192.***.2.7/";
 * 1) Name of the wiki which the emails will populate (must be running on the same host)

$::template = "Email";
 * 1) The wiki template to wrap the email paramaters in

$::emailonly = 1;
 * 1) Extract just the email address portion of the FROM and TO fields

$::fromfilter = 0;
 * 1) Don't import emails into the wiki if the From address isn't registered in the wiki

$::html_only = 0;
 * 1) If there's HTML formatting in the email don't also add sections for non-HTML versions of the content

$::type = "IMAP"; $::host = "192.***.2.210"; $::user = "mediawiki@navi*****.com"; $::pass = "mwnavis2013";
 * 1) Details of the POP or IMAP server to check for messages

$::remove = 0;
 * 1) Delete messages after processing them

$::limit = 20000000;
 * 1) Maximum amount of message to download

$::format = "Email:\$id (\$subject)";
 * 1) Format of the title for the corresponding article in the wiki

$::owner = "www-data";
 * 1) The user the webserver runs as

1;

We created template Template:Email which contains:

Could anyboby help us?

Error in EmailToWiki.pl
Hi, I am recieving the error No such file or directory at EmailToWiki.pl line 45. when executing the perl script. --Krabina (talk) 14:27, 19 September 2014 (UTC)

Internal Server Error - Plugin seems not to work with Wiki 1.25.1
We tried to implement this Plugin with following code:

LocalSettings: require_once("$IP/extensions/EmailToWiki/EmailToWiki.php"); or include( "$IP/extensions/EmailToWiki/EmailToWiki.php" );

The IIS shows only Error 500 - internal Server Error. Is this plugin not compatible with the latest MediaWiki Version?

greetings Manuel
 * I have experienced the same results Tiggerjay (talk) 22:42, 14 October 2015 (UTC)

MW version 1.27.0 compatibility
Having set up the necessary perl modules to work with EmailToWiki.pl, mail messages are imported in the EmailToWiki.tmp directory when the script is called. However, the script terminates after a fatal error.

This is the complete logfile output:

PERL (Sun Oct 2 17:00:42 2016) : EmailToWiki.pl 2.2.9, 2012-05-16 started PERL (Sun Oct 2 17:00:42 2016) : Processing configuration file "EmailToWiki.conf" PERL (Sun Oct 2 17:00:42 2016) : Logged "XXXXXX" into IMAP server "XXXXXXX" PHP [02 Oct 2016, 17:00:42]: EmailToWiki.php (2.2.9, 2012-05-16) started processing EmailToWiki.tmp PERL (Sun Oct 2 17:00:42 2016) : PHP returned output:

Fatal error: Call to undefined function wfMsg in /wiki/extensions/EmailToWiki/EmailToWiki.php on line 108

Line 108 is the line with  in the following segment of EmailToWiki.php:

// Create article for bodytext $article = new Article( $title ); if( $files ) $content .= "\n== ". wfMsg( 'emailtowiki_attachsection' ). " ==\n$files"; $article->doEdit( $content, wfMsg( 'emailtowiki_articlecomment' ), EDIT_NEW|EDIT_FORCE_BOT ); $nemails++;

Is anyone else here running EmailToWiki in a current or recent MediaWiki version and who knows what the cause of the error may be? TieMichael (talk) 07:48, 26 February 2017 (UTC) --Yellowdog (talk) 17:55, 2 October 2016 (UTC)


 * Having tested a bit further it appears that the use of SimpleForms.php (https://www.mediawiki.org/wiki/Extension:Simple_Forms) is required but that the extension is now obsolete. For example, calling wget or with the browser on some article name, e.g.  as suggested in the thread at https://www.mediawiki.org/wiki/Extension_talk:EmailToWiki#Emails_not_showing_up_in_wiki causes   in current MW 1.27.0


 * A slightly updated SimpleForms was recreated at https://github.com/mediawiki4intranet/SimpleForms but which does not make EmailToWiki work in current MW either. When testing in combination with MW 1.27.0 I found that running EmailToWiki.pl with this slightly newer SimpleForms the line number of the reported error just changed:

Fatal error: Call to undefined function wfMsg in  /wiki/extensions/EmailToWiki/EmailToWiki.php on line 93


 * Presuming the error relates to SimpleForms, is there any way to run EmailToWiki without SimpleForms.php?


 * Or maybe it's a change in PHP since the versions of SimpleForms and/or EmailToWiki was created which causes the error? The PHP version that runs my MW installation is 5.6.17.


 * Many thanks for any advise!
 * --Yellowdog (talk) 20:36, 2 October 2016 (UTC)

Making yet another test by running the #!/usr/bin/perl script posted in the https://www.mediawiki.org/wiki/Extension_talk:EmailToWiki#Emails_not_showing_up_in_wiki thread as well as well as testing with a wget URL to cretae the article, the error relating to SimpleForms is returned:

Fatal error: Call to undefined method Article::insertNewArticle in /wiki/extensions/SimpleForms/SimpleForms.php on line 495

Perhaps the author of EmailToWiki or someone else here can reinvigorate this excellent idea of an extension to work in a current MediaWiki version without the use of the outdated SimpleForms.php procedures?

--Yellowdog (talk) 05:48, 3 October 2016 (UTC)
 * The EmailToWiki errors are due to the use of the obsolete wfMsg function which I've now replaced so that should work. Re SimpleForms, I don't maintain that so you'll need to find who maintains that repo and see if they can replace the insertNewArticle function. --Nad (talk) 10:08, 3 October 2016 (UTC)
 * But note that SImpleForms is obsolete and is not used by the EmailToWIki extension, you may be using a very old version of the extension. --Nad (talk) 19:00, 4 November 2016 (UTC)

Anonymous Editing necessary?
Hi all, We'd like to run this extension on an internal Wiki, but we're going to implementing LDAP in the future, and anonymous editing will be disabled. Is there any way to run this extension with anonymous editing disabled? I'm trying to think of a work around, but nothing springs to mind immediately. Thanks in advance! --J
 * EmailToWIki doesn't use editing, it uses a custom emailtowiki action so there should be no problem with the wiki being locked down. --Nad (talk) 18:55, 4 November 2016 (UTC)
 * Note also that the emailtowiki action can only be called from the same host as the wiki runs on. --Nad (talk) 18:57, 4 November 2016 (UTC)


 * Ah, thank you much. I should be more careful to read how an extension works before I start asking stupid questions.  --JakeR1820 (talk) 19:50, 4 November 2016 (UTC)

Attachment issues
First, let me say thank you for this extension!

I am trying to use it with my private wiki (mediawiki 1.28) and face several issues mainly related to attachments


 * 1) POP with SSL is not working (not a big issue)
 * 2) POP: attachments are not recogized and displayed as 'text' inside the email
 * 3) IMAP: attachments are sometimes recognized and saved, sometimes displayed as 'text' inside the email (maybe depending on email-client)
 * 4) IMAP: recognized attachments are sometimes saved, sometimes although the PERL-script logs 'attachment saved', there is NO attachment (pdf is saved, jpg is missing)
 * 5) Attachments are never uploaded to the wiki ("Finished (1 messages and 0 files imported")  (they should be found in NS_FILE-namespace, besides other uploaded files

As this is a very mature extension, I am sure the problems are with my config, so any help to solve this puzzle is highly appreciated! Thanks!

$::wiki = "http://localhost:89/index.php"; $::template = "Email"; $::emailonly = 0; $::fromfilter = 0; $::html_only = 0; $::type = "IMAP"; $::host = "server.mserver.com:993"; $::user = "wiki\@mserver.com"; $::pass = "*******"; $::remove = 1; $::limit = 200000000; $::format = "Email:\$subject (\$from)"; $::owner = "www-data"; 1;
 * 1) Name of the wiki which the emails will populate (must be running on the same host)
 * 1) The wiki template to wrap the email paramaters in
 * 1) Extract just the email address portion of the FROM and TO fields
 * 1) Don't import emails into the wiki if the From address isn't registered in the wiki
 * 1) If there's HTML formatting in the email don't also add pre sections for non-HTML versions of the content
 * 1) Details of the POP or IMAP server to check for messages
 * $::type = "POP3";
 * $::host = "server.mserver.com:995";
 * 1) Delete messages after processing them
 * 1) Maximum amount of message to download
 * 1) Format of the title for the corresponding article in the wiki
 * 1) The user the webserver runs as
 * The extension's not that mature so it could well be a problem with it, there have been no updates to it for over 5 years. If you could show me the actual log output I may be able to help ("attachment saved" is a little strange as there's no such log output in the script - unless you're using a fork of the code or something...?) --Nad (talk) 13:59, 25 February 2017 (UTC)

--- TieMichael (talk) 07:50, 26 February 2017 (UTC)

Sorry for uploading useless log-file last time which I have deleted earlier...

Here is some updates and further findings: [Bug56269] Exception thrown with an uncommited database transaction: [8657fe2b2d188022de032a99] /index.php?action=emailtowiki&prefix=EmailToWiki  MWException from line 53 of /var/www/html/mediawiki/includes/content/TextContent.php: TextContent expects a string in the constructor. [exception] [8657fe2b2d188022de032a99] /index.php?action=emailtowiki&prefix=EmailToWiki  MWException from line 53 of /var/www/html/mediawiki/includes/content/TextContent.php: TextContent expects a string in the constructor. Here the related EmailToWiki.log PERL (Tue Mar 7 13:35:02 2017) : EmailToWiki.pl 2.2.9, 2012-05-16 started PERL (Tue Mar 7 13:35:02 2017) : Processing configuration file "EmailToWiki.conf" PERL (Tue Mar 7 13:35:02 2017) : Logged "wiki@myserver.com" into IMAP server "server.myserver.com:993" PERL (Tue Mar 7 13:35:02 2017) : Extracting attachment /var/www/html/w/extensions/EmailToWiki/EmailToWiki.tmp/Email:Message with  3 attachments ("Michael" (1234567@gmail.com))/__006201d29704$84c6cc50$8e5464f0$@gmail.com_test.xlsx PERL (Tue Mar 7 13:35:02 2017) : Extracting attachment /var/www/html/w/extensions/EmailToWiki/EmailToWiki.tmp/Email:Message with  3 attachments ("Michael" (1234567@gmail.com))/__006201d29704$84c6cc50$8e5464f0$@gmail.com_test.csv PERL (Tue Mar 7 13:35:02 2017) : Extracting attachment /var/www/html/w/extensions/EmailToWiki/EmailToWiki.tmp/Email:Message with  3 attachments ("Michael" (1234567@gmail.com))/__006201d29704$84c6cc50$8e5464f0$@gmail.com_Zking.jpg PHP [07 Mar 2017, 13:35:02]: EmailToWiki.php (2.2.10, 2016-10-03) started processing EmailToWiki.tmp
 * 1) it seems not all attachments are recognized and saved under 'mediawiki/extensions/EmailToWiki.tmp/xxx/'
 * 2) attachments are uploaded to the MW-image folder (.e.g. 'mediawiki/images/0/0b/' one by 1 (1 attachment whenever EmailtoWiki.pl is run) but NOT registered with the wiki database
 * 3) the uploaded email-messages don't show reference to attachments and include the message 'This is a multipart message in MIME format.'
 * 4) the issue seems to be related to this exception shown in the mediawiki-log:
 * 1) 0 /var/www/html/mediawiki/includes/content/WikitextContent.php(37): TextContent->__construct(Message, string)
 * 2) 1 /var/www/html/mediawiki/includes/content/TextContentHandler.php(121): WikitextContent->__construct(Message)
 * 3) 2 /var/www/html/mediawiki/includes/content/ContentHandler.php(176): TextContentHandler->unserializeContent(Message, NULL)
 * 4) 3 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(1449): ContentHandler::makeContent(Message, Title)
 * 5) 4 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(1212): LocalFile->recordUpload2(string, string, Message, array, string, User, array)
 * 6) 5 /var/www/html/mediawiki/includes/upload/UploadBase.php(765): LocalFile->upload(string, string, Message, integer, array, boolean, User, array)
 * 7) 6 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(140): UploadBase->performUpload(Message, Message, boolean, User)
 * 8) 7 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(102): EmailToWiki->upload(string, string, Message, Message)
 * 9) 8 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(62): EmailToWiki->processEmails(string)
 * 10) 9 /var/www/html/mediawiki/includes/Hooks.php(195): EmailToWiki->onUnknownAction(string, Article)
 * 11) 10 /var/www/html/mediawiki/includes/MediaWiki.php(499): Hooks::run(string, array)
 * 12) 11 /var/www/html/mediawiki/includes/MediaWiki.php(289): MediaWiki->performAction(Article, Title)
 * 13) 12 /var/www/html/mediawiki/includes/MediaWiki.php(851): MediaWiki->performRequest
 * 14) 13 /var/www/html/mediawiki/includes/MediaWiki.php(512): MediaWiki->main
 * 15) 14 /var/www/html/mediawiki/index.php(43): MediaWiki->run
 * 16) 15 {main}
 * 1) 0 /var/www/html/mediawiki/includes/content/WikitextContent.php(37): TextContent->__construct(Message, string)
 * 2) 1 /var/www/html/mediawiki/includes/content/TextContentHandler.php(121): WikitextContent->__construct(Message)
 * 3) 2 /var/www/html/mediawiki/includes/content/ContentHandler.php(176): TextContentHandler->unserializeContent(Message, NULL)
 * 4) 3 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(1449): ContentHandler::makeContent(Message, Title)
 * 5) 4 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(1212): LocalFile->recordUpload2(string, string, Message, array, string, User, array)
 * 6) 5 /var/www/html/mediawiki/includes/upload/UploadBase.php(765): LocalFile->upload(string, string, Message, integer, array, boolean, User, array)
 * 7) 6 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(140): UploadBase->performUpload(Message, Message, boolean, User)
 * 8) 7 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(102): EmailToWiki->upload(string, string, Message, Message)
 * 9) 8 /var/www/html/mediawiki/extensions/EmailToWiki/EmailToWiki.php(62): EmailToWiki->processEmails(string)
 * 10) 9 /var/www/html/mediawiki/includes/Hooks.php(195): EmailToWiki->onUnknownAction(string, Article)
 * 11) 10 /var/www/html/mediawiki/includes/MediaWiki.php(499): Hooks::run(string, array)
 * 12) 11 /var/www/html/mediawiki/includes/MediaWiki.php(289): MediaWiki->performAction(Article, Title)
 * 13) 12 /var/www/html/mediawiki/includes/MediaWiki.php(851): MediaWiki->performRequest
 * 14) 13 /var/www/html/mediawiki/includes/MediaWiki.php(512): MediaWiki->main
 * 15) 14 /var/www/html/mediawiki/index.php(43): MediaWiki->run
 * 16) 15 {main}

Maybe this info helps. Thank you TieMichael (talk) 06:19, 7 March 2017 (UTC)

Hi, I have done some changes in EmailToWiki.php which seem to fix most of the issues I had. Maybe you can have a look, and if ok, include them in a future update. extensions/EmailToWiki>> diff EmailToWiki.php-orig EmailToWiki.php 99,100c99,100 < 						$comment = wfMessage( 'emailtowiki_uploadcomment', $msg ); < 						$text = wfMessage( 'emailtowiki_uploadtext', $msg ); --- > 						$comment = wfMessage( 'emailtowiki_uploadcomment', $msg ) ->text ; > 						$text = wfMessage( 'emailtowiki_uploadtext', $msg ) ->text ; 114c114,116 < 					$article->doEdit( $content, wfMessage( 'emailtowiki_articlecomment' ), EDIT_NEW|EDIT_FORCE_BOT ); --- > 					$article->doEditContent(ContentHandler::makeContent( $content, $title ), wfMessage( 'emailtowiki_articlecomment' ), EDIT_NEW|EDIT_FORCE_BOT ); 121c123,125 < 			exec( "rm -rf \"$dir\"" ); --- >                      exec('rm -rf '.escapeshellarg($dir)); 138a143 >                $watch_t = 'false'; 140c145,146 < 			$status = $upload->performUpload( $comment, $text, false, $user ); --- > 			$status = $upload->performUpload( $comment, $text, $watch_t, $user );

TieMichael (talk) 13:06, 9 March 2017 (UTC)

Article->doEdit deprecated in MediaWiki 1.30.1 have to use WikiPage->
I upgraded to Mediawiki 1.30.0 and EmailToWiki extension stopped working. Isolated the problem to the deprecation of $article->doEdit in EmailToWiki.php. I got it working with $wikipage = new WikiPage($title); $content = new WikitextContent( $content ); $edit_summary = "Article created by EmailToWiki Mediawiki extension"; $wikipage->doEditContent( $content, $edit_summary, $flags ); I don't use attachments and given this whole change was driven by the different type contents you may have to do more to deal with attachments? Johnny Wunder