Extension talk:EmailPage/Archive

Cron Jobs
can anyone show an example on how to send an email via cron job? So far i can send the email via the browser using link http://url.com/wiki/index.php?title=Special:EmailPage&ea-title=Page%20Title&ea-list=mail@host.com&ea-subject=Email%20subject&ea-send=Send! My problem is that the user needs to be logged in as admin (on the wiki) to do this, no? Should I use wget? Thanks for the help. --207.96.208.130 22:23, 4 June 2009 (UTC)

Blocked users
Is it possible when selecting the group USERs that people which are blocked not be listed. thanks! --207.96.208.130 21:07, 2 June 2009 (UTC)
 * i came up with a fix, but not sure it is the most efficient replace

?$db->select( 'user', 'user_email', 'user_email != \'\'', __METHOD__ )
 * by

?$db->select( 'user', 'user_email', array ('user_email != \'\'', 'user_id NOT IN (SELECT ipb_user FROM ipblocks WHERE ipb_user <> 0)'), __METHOD__ )
 * --207.96.208.130 17:30, 3 June 2009 (UTC)

Multibytes characters in email
thanks for this extension. I am using it on our laboratory wiki after some simplification.

It works well except that we cannot send japanese character which is a stopover because mainly the wiki is used in japanese. I saw that it is already in the known bugs and I would like to know if there is a workaround (like specifying the encoding of the email??). I could send some well encoding character emails but I cannot reproduce it, I am investigating it now.

Also I am working on the translation of th i18n in japanese, should I post it here?

Thanks for your help. Sylvain 9:05, 3 March 2009 (UTC)


 * It seems that the mails are send in UTF-8 but it is not detected. Perhaps should add it in the header... I will check if it is possible.


 * Found a fix just need to line 50 in class.phpmailer.php to
 * public $CharSet = 'UTF-8';
 * Sylvain 9:05, 8 December 2009 (UTC)


 * That's great! I had the same problem, but now everything looks beautyful. --kgh 00:13, 9 December 2009 (UTC)

Image link mistake and Force that the article link is given a the beginning of the mail
Issue relative to article that I receive thanks to "EmailArticle" extension and which have images (downloaded thanks "upload file").


 * In fact when I receive the mail, the image is missing and the link at place of the image is:
 * http://wiki..../index.php/Image:image_file.jpg
 * Has somebody a solution to has this image visible.
 * It seems that email don't like the link "Image:image"

and

The other question concerns the possibility to have the link to the article appearing at the beginning of the email.
 * So people can directly access to the article

Thanks

CKL 13:44, 16 July 2008 (UTC)

Finally As nobody gave an answer, I found the solution myself!!

It Is very strange that these kind of issue has never been evoked !

Finally Thank you myself

Arround line 270, I added:

$message = preg_replace("/.*edit<\/a>]<\/span>/im", "", $message); $message = str_replace("src=\"/images/", "src=\"http://wiki.ts-alcatel.net/images/", $message); $tmp_access_article = " ".$title." "; $message = " Link to article: ".$tmp_access_article."\n ".$message;


 * OR you can put the full path of the picture on your page (you need to allow it in LocalSetting.php also)--207.96.208.130 22:42, 4 June 2009 (UTC)

fatal error getID
I installed the extension but when I use it I get
 * Fatal error: Call to a member function getID on a non-object in /home/kickmysi/public_html/techwiki/includes/SkinTemplate.php on line 408


 * To be able to give any advice I need more info such as your EmailArticle configuration settings and MediaWiki version. --Nad 21:21, 27 June 2007 (UTC)


 * I have installed it successfully on MW 1.10.0 without problems. My file structure was:


 * --Zven 21:25, 1 July 2007 (UTC)

Media Wiki Version MediaWiki: 1.10.0 include ("$IP/extensions/EmailArticle/EmailArticle.php"); $wgEmailArticleGroup = "**"; $wgEmailArticleContactsCat = ""; $wgEmailArticleCss = "EmailArticle.css"; $wgEmailArticleAllowRemoteAddr = ""; $wgEmailArticleAllowAllUsers = "false"; $wgEmailArticleToolboxLink = "Send to email"; $wgEmailArticleActionLink = "email"; $wgPhpMailerClass = "";

blank page, no email
I installed extension as well according to all of the instructions outlined and the extension will not send email. It goes to a blank page when I hit submit. Any suggestions email me at drclinks@gmail.com. -Mike


 * Is the normal mediawiki mail functionality is working such as password confirmation or watchlist changes? --Nad 00:29, 6 July 2007 (UTC)


 * peblusto says: this would be a perfect extension ... if i could get it working!  but we also get a blank page when clicking send, and there's no outgoing email, yet other email works from the wiki, including "e-mail user". i also note that this extension only permits building a page send form for users who have confirmed their email address (doh!) otherwise it displays "...permission denied" at the bottom of the form. here's my localsettings.php lines:


 * any clues? has anyone else seen this "blank page, no email send" problem, and resolved it? thanx peblusto 20:25, 19 September 2007 (UTC)


 * There seems to be a bug preventing the pseudo-groups ("*" and "user") from working. I'll try and fix that soon, but in the mean time, you can set the group to "" to allow anyone, or a real group. --Nad 22:13, 19 September 2007 (UTC)
 * Try using getEffectiveGroups instead of getGroups, in EmailArticle_body.php? -Jlerner 21:00, 15 June 2008 (UTC)


 * peblusto says: thanks, but i'm still getting a blank page and no email, even with "$wgEmailArticleGroup = "";" instead of "*".


 * also, not having had success yet, i'm not absolutely sure how to use the form (see, for example, Special:EmailArticle/Main_Page), under "select recipients" do i have to select a "...group" or can i just type in email addresses under "additional..."?
 * Let me look at my apache server error.log:


 * what are you doing here in emailarticle.php?:


 * That line specifies the default location it expects to find the class.phpmailer.php which it can't find as shown in the following error message --Nad 12:49, 25 September 2007 (UTC)
 * should i have a file "phpmailer.php" in any particular directory?

--


 * Yes you need to have it (in this particular case) at c:\www\apache2\htdocs\mediawiki\extensions\EmailArticle\phpmailer\class.phpmailer.php (in other words, under ...\extensions\EmailArticle\phpmailer\...)  --Nad 12:49, 25 September 2007 (UTC) (edited peblusto 12:21, 26 September 2007 (UTC))

--


 * also, i'd love some examples of the effect of the variables, for instance, what does


 * mean? thanx peblusto 13:19, 20 September 2007 (UTC)

--


 * I think it best to get it working before changing any of these other things --Nad 12:49, 25 September 2007 (UTC)


 * peblusto says: Sure, but regardless, support documentation is absolutely critical (and sorely missing throughout mediawiki), and example is the best way i have learned to learn, and seeing examples helps confirm what the tool can do, and help us decide if we want the tool or not at all! thanx.  peblusto 12:21, 26 September 2007 (UTC)

--


 * ps - i can mess it up and get a screen full of this as the send results instead of a blank screen - i guess i'll re-download the extension and try again!

and on and on ...


 * This looks like the class.phpmailer.php script is being sent to output instead of being executed. --Nad 12:49, 25 September 2007 (UTC)


 * peblusto says: ... so ...? i fix this by using the "official' version of phpmailer dropped into the ...\extensions\EmailArticle\phpmailer\... directory, but it still doesn't work.  I'm only moving the error messages around and never actually sending out the page over email.  does anyone have a checklist on how to confirm that proper email function support tools are installed and configured properly?  thanx peblusto 12:21, 26 September 2007 (UTC)

ea_autherror
I installed according to instructions, including the phpmailer class. I get an  when trying to send an email with empty string as $wgEmailArticleGroup. Also, how can I add aditional groups to the system to send email only to those people? Manually added groups work for the permissions but not as recipient. Also, the Article title is empty in the form and email ("" article sent from Elixir Wiki) - Oliver


 * I found some minor bugs which should fix those problems, try the new version at OrganicDesign:Extension:EmailArticle.php --Nad 07:54, 10 July 2007 (UTC) (version 1.0.6 (2007-09-22) peblusto 12:21, 26 September 2007 (UTC))

User and * Groups
Hi - this extension doesn't work for me unless I set $wgEmailArticleGroup to ' ' ; - when I try 'user' or even '*' it says permission denied, though I am logged in as a bureaucrat and sysop. Gary Kirk 14:37, 24 August 2007 (UTC)


 * The "user" and "*" groups are virtual groups and aren't allowed as special-page permissions. The "user" group is allowed to be used for selecting recipients though and will send the article to all registered users. --Nad 11:58, 27 August 2007 (UTC)


 * Changing getGroups to getEffectiveGroups, in EmailArticle_body.php, function send</tt>, seems to make $wgEmailArticleGroup</tt> work more as expected. -Jlerner 20:57, 15 June 2008 (UTC)

MySQL errors in 1.11
Having upgraded to MW 1.11 I tried this extension (which worked fine in 1.10).

I went to: http://mywiki.local/index.php?title=Special:EmailArticle&ea_title=Main%20Page (and other articles as well) and each time was greated with these two error messages:

Warning: mysql_fetch_row: supplied argument is not a valid MySQL result resource in /var/www/mywiki/extensions/EmailArticle/EmailArticle.php on line 120 Warning: mysql_fetch_row: supplied argument is not a valid MySQL result resource in /var/www/mywiki/extensions/EmailArticle/EmailArticle.php on line 159

I echo'd out the select statements that were being sent and saw that it was as follows:

SELECT cl_from FROM `categorylinks` WHERE cl_to = 'Contacts' ORDER BY cl_sortkey SELECT page_id FROM `page` WHERE page_title REGEXP('\.css$') ORDER BY page_title

My PHP version hasn't changed (5.2.0-8), neither has MySQL (5.0.41).

Email sending still works, however.


 * I'm about to do the upgrade to 1.11 on mine too so I'll be able to look in to that soon. --Nad 21:49, 12 September 2007 (UTC)


 * Working fine in MW1.11 now ;-) --Nad 12:14, 14 September 2007 (UTC)

Suggestions
Can this extension be given the option of stripping out the [edit] links that appear in the emails? Unfortunately this makes the extension a little useless for our environment.


 * You can add to the text message part of the form, or you could remove them from the CSS you use --Nad 21:47, 12 September 2007 (UTC)

Error sending (page name): Language string failed to load: instantiate
peblusto says: huh? i'm having fun crashing this and should be a master at it by the time i get it working. i just downloaded the entire big phpmailer suite from http://phpmailer.sourceforge.net/ and replaced the version from http://www.organicdesign.co.nz/Class.phpmailer.php in my C:\www\apache2\htdocs\mediawiki\extensions\EmailArticle\*.* directory (by the way, where should it go and how would i know?).

my apache error.log now says:

so i open EmailArticle.php in free http://www.htmlkit.com/ and read down to the numbered line 256 which says:

i've tried adding these lines into my php.ini:

but now i see there are two php.ini files, one in C:\www\apache2\ and one in C:\www\php5\ ... which one matters? how should i coordinate them to best support mediawiki and this extension, if it matters? I added the "include_path..." and "$mail..." lines the end of both php.ini files, reloaded to send a new page and still get "Language string failed to load: instantiate". here are the two lines in apache error.log when trying to send a page:

maybe i need remedial details on exactly what resources need to be where in the system. thanx peblusto 17:43, 20 September 2007 (UTC)

--


 * Sorry, the instructions regarding the phpmailer file were incorrect and have been updated, I've added the specific info about this in the following section as well --Nad 04:18, 21 September 2007 (UTC)

--

peblusto says: so, is this what we should have in our localsetting.php:

if so, maybe we should put that twin line entry on the front article / extension page.

please help me audit - here's my inventory:


 * files:
 * c:\www\apache2\htdocs\mediawiki\extensions\emailarticle\emailarticle.php
 * c:\www\apache2\htdocs\mediawiki\extensions\emailarticle\phpmailer\class.phpmailer.php
 * This is correct and matches the default setting for $wgPhpMailerClass
 * localsetting.php (in C:\www\apache2\htdocs\mediawiki\localsetting.php) contains:
 * include ("$IP/extensions/emailarticle/emailarticle.php");
 * $wgEmailArticleGroup = "";
 * $wgEmailArticleAllowAllUsers = true;
 * $wgEmailArticleToolboxLink = "Email current page";
 * $wgPhpMailerClass = "$IP/extensions/emailarticle/phpmailer/class.phpmailer.php";
 * You don't need to set this since the default should be fine, but if you were to set it you should use $IP not $wgScriptPath
 * special:version says:
 * Version
 * MediaWiki: 1.10.0
 * PHP: 5.2.2 (apache2handler)
 * MySQL: 5.0.41-community-nt
 * Special pages
 * Special:EmailArticle (version 1.0.6, 2007-09-22)	Send rendered article to an email address or list of addresses	User:Nad
 * Extension functions
 * ... wfSetupEmailArticle ...
 * Hook name -- Subscribed by
 * MonoBookTemplateToolboxEnd -- wfEmailArticleToolboxLink
 * SkinTemplateTabs -- wfEmailArticleActionLink
 * MonoBookTemplateToolboxEnd -- wfEmailArticleToolboxLink
 * SkinTemplateTabs -- wfEmailArticleActionLink
 * SkinTemplateTabs -- wfEmailArticleActionLink

however, i have the same problems.

with your version of class.phpmailer.php (30 kb) from http://www.organicdesign.co.nz/Class.phpmailer.php I get a page full of code gibberish as in Extension_talk:EmailArticle above.

with class.phpmailer.php (46 kb) from http://phpmailer.sourceforge.net/ I still get Error sending (page name): Language string failed to load: instantiate.


 * error.log from C:\www\apache2\logs, final lines:
 * [Fri Sep 21 15:50:37 2007] [error] [client 10.112.102.9]
 * (20024)The given path misformatted or contained invalid characters: Cannot map GET
 * /mediawiki/index.php/Special:Search?search=special%3Aversion&go=Go
 * HTTP/1.1 to file, referer:
 * http://...ourwikiserver.../mediawiki/index.php?title=Special:EmailArticle&action=submit
 * [Fri Sep 21 15:50:37 2007] [error] [client 10.112.102.9]
 * (20024)The given path misformatted or contained invalid characters: Cannot map GET
 * /mediawiki/index.php/Special:Version HTTP/1.1 to file, referer:
 * http://...ourwikiserver.../mediawiki/index.php?title=Special:EmailArticle&action=submit

so i ask myself, i say, "self, where the heck is language instantiate coming from?" (and i ask myself who uses words like "instantiate" in the first place, anyway? see below *)
 * class.phpmailer.php line 445 (of 1499):
 * $this->SetError($this->Lang("instantiate"));

i also notice many directory references inside class.phpmailer.php that do not match the directory structure of my system - does that matter? here's the language line:
 * class.phpmailer.php line 596 (of 1499):
 * function SetLanguage($lang_type, $lang_path = "language/")...

is it me? (i look at http://www.organicdesign.co.nz/wiki/index.php/Special:Version and i'm jealous - can i hire you!?!) peblusto 20:36, 21 September 2007 (UTC)

--


 * * ps: from http://www.onelook.com/?w=instantiate&ls=a
 * instantiate quick definitions
 * verb:  find an instance of (a word or particular usage of a word) (Example: "The linguists could not instantiate this sense of the noun that he claimed existed in a certain dialect")
 * verb:  represent by an instance (Example: "This word instantiates the usage that the linguists claimed to be typical for a certain dialect")

--

peblusto says: same problem Tuesday, September 25, 2007  7:14:07 am trying on another wiki (built off same database and php installation) - either i get a screen page full of gibberish using your version of phpmailer or i get "Error sending Main Page: Language string failed to load: instantiate" when using the "class.phpmailer.php" from sorceforge.

apache error.log last line:


 * [Tue Sep 25 07:12:31 2007] [error] [client 10.112.102.9]
 * PHP Fatal error: Class 'PHPMailer' not found in
 * C:\\www\\apache2\\htdocs\\...ourwiki2...\\extensions\\EmailArticle\\EmailArticle.php
 * on line 257, referer:
 * http://...ourwikihost.../...outwiki2.../index.php?title=Special:EmailArticle&action=submit

thanks for exploring this. peblusto 11:28, 25 September 2007 (UTC)

--


 * peblusto says: my mwdiawiki does email the registration confirmation, so email settings appear to work elsewhere. any clues as to the cause and resolution of


 * Error sending Special:Version: Language string failed to load: instantiate


 * error when clicking [Send!]? thanx peblusto peblusto 10:30, 4 October 2007 (UTC)


 * That looks like you're trying to send a special page - you can only send normal articles not special pages. --Nad 11:08, 4 October 2007 (UTC)


 * I am trying to run EmailPage from the latest version available (as of August 4th) and I am running into the same error for any page I am trying to send out. I also had to replace many instance of 'Emailpages' instead of 'EmailPage' in the code. Is the latest version even stable ?


 * Update from above - the solution to my problem with this error was simple : Edit phpmailer class to set the mail method to something that works for you (in my case, smtp with a working server). I am now sending emails as advertised.

PHP Mailer class
The only file this extension needs from phpmailer is the one named class.phpmailer.php, by default this extension expects it to be found in a directory called phpmailer which should be located in the same directory as the EmailArticle.php script is located. If you want to put it in some other location, then specify its full path name in the $wgPhpMailerClass variable in your localsettings after the EmailArticle include statement. There's no need to adjust anything to do with PHP or Apache. --Nad 04:18, 21 September 2007 (UTC)

Email Address Validation is Overly Strict
The regex used for email address validation, /[a-z0-9_.-]+@[a-z0-9_.-]+/i, fails to match valid email addresses. There are some regexes out there that will better match the RFC 2822 standard. The lack of a plus sign was the one I noticed first, but there are additional special characters that should be allowed.

How does the contact list work?
How exactly does $wgEmailArticleContactsCat</tt> work? It looks to me like if I create an article "Foo" with contents:

foo@foo.com

... then I should be given a list where I can select foo@foo.com as a recipient. Am I understanding that correctly? I don't think I am, because that doesn't seem to work for me. --64.236.208.27 14:55, 21 September 2007 (UTC)
 * Oops, I'd forgotten that I hadn't written the explanation for any of the recipient-selection methods! I've added those to the docs now, so hopefully that will make a bit more sense now ;-) --Nad 20:14, 21 September 2007 (UTC)
 * Thanks for the clarification. I still had some problems... I think there are bugs:
 * The category names used won't work if they have spaces in them. You need to convert those spaces to underscores before you use them in your DB queries.
 * There's a bug in the addRecipient function. E-mails from categories don't currently get added to the $recipients[] array because they never hit the part of the function that tests for validity.  Here's what I did to fix that:


 * Thanks again for a great extension. Hope this comment makes it even better. --64.236.208.28 14:08, 27 September 2007 (UTC)
 * Thanks, I've updated it to 1.0.7 with that patch --Nad 20:44, 27 September 2007 (UTC)


 * Categorys with spaces still do not work. Thus I have added a note to safe administrators some time utilising this method. I think it should be ok with most wikis to have categories without spaces. Cheers --kgh 22:56, 18 November 2009 (UTC)

A little tweak for setting the From: name more nicely
Sorry, not a proper patch. But you can see where this goes. There's probably a better way to extract the real name, too... I'm not really a programmer. :)

--Oeuftete88 17:44, 27 September 2007 (UTC)
 * thanks, that looks better, I've added that patch as 1.0.8 --Nad 20:53, 27 September 2007 (UTC)

Error sending Help:Contents: Could not instantiate mail function.
I tried to send various pages on my wiki and I get the following error message: Error sending Help:Contents: Could not instantiate mail function. Any clue on how to fix that? --PurplePopple 22:43, 28 December 2007 (UTC)
 * If you are running on IIS, this can likely be resolved by modifying the /phpMailer_v2.1.0beta2/class.phpmailer.php file as follows:

/**   * Formats an address correctly. * @access private * @return string */   function AddrFormat($addr) { if(empty($addr[1])) $formatted = $addr[0]; else {   $formatted = $this->EncodeHeader($addr[1], ‘phrase’). ” <” .   $addr[0]. “>”;   }
 * Change this section:

return $formatted; }    /**    * Formats an address correctly. * @access private * @return string */   function AddrFormat($addr) {
 * To this:

$formatted = $addr[0];

return $formatted; } The problem is caused because the symbols added to the email address are not handled correctly by PHP mailer running on IIS. Thorncrag 02:12, 6 January 2010 (UTC)

Getting extra text above the ea_header in the email
This extension works great!

<P>One small issue I am running into is some extra text that is prepended prior to the ea_header section in the email.

<P>At the very top of the email it reads something similar to:

There is currently no text in this page, you can search for this page title in other pages or  [http:// /wiki/index.php?title= &action=edit edit this page]. This is a sample ea_header line ...

... which to me looks like a "failed' search although the document does render as expected in the email after the ea_header above.

<P>Any ideas?

Error loading class
Get this error:

PHP Fatal error: Cannot redeclare class SpecialEmailArticle in /var/www/bp-aux/extensions/EmailArticle/EmailArticle_body.php on line 4

in my httpd logs.

Version MediaWiki 1.12.0


 * extensions/EmailArticle/
 * extensions/EmailArticle/EmailArticle.php, EmailArticle_body.php, EmailArticle.i18n.php
 * extensions/EmailArticle/phpmailer

Any ideas?

Thx WSpivak 15:39, 18 May 2008 (UTC)


 * Are you declaring the class twice somewhere in your LocalSettings.php file? Can you download the latest svn revision and see if the issue still exists, the extension has been split into three files recently since your post and bugs ironed out --Zven 23:34, 19 May 2008 (UTC)

Patch: Don't show "email article" link if user doesn't have permission to send email
In function wfEmailArticleToolboxLink</tt>: $ diff EmailArticle.php* 56c56,58 < 	global $wgEmailArticleToolboxLink,$wgTitle; --- > 	global $wgEmailArticleToolboxLink, $wgTitle, $wgUser, $wgEmailArticleGroup; > 	if ( !in_array($wgEmailArticleGroup, $wgUser->getEffectiveGroups ) ) > 	   return false; -Jlerner 21:21, 15 June 2008 (UTC)
 * Sorry did notice this post for ages :-/ I've added that functionality now --Nad 03:36, 17 July 2008 (UTC)

Bug in Code
I have to issues to report.

Setup Issue
I had to comment out the following line of code, otherwise this addon totally broke my Wiki. The parameter, 'SERVER_ADDR', was causing the problem; but I have not had time to investigate it. I think that it is supposed to be passed from LocalSettings, but it is not listed in the instructions as a required parameter.


 * 1) $wgEmailPageAllowRemoteAddr = array($_SERVER['SERVER_ADDR'],'127.0.0.1');
 * SERVER_ADDR should be available on most PHP installations, but I've made it conditional so it doesn't fail if it's not there. --Nad 23:29, 16 August 2008 (UTC)

Submit Issue
I think that you have a bug in your current code that causes the submit function to fail.

In the EmailPage_body.php file, I had to make this change under "render form" in order for it to work:

$special = Title::makeTitle(NS_SPECIAL, 'EmailPage'); ## Old code was forwarding to EmailPage instead of Pages

$special = Title::makeTitle(NS_SPECIAL, 'EmailPages'); ## Working code

I hope this helps people getting an invalid special page error when sending.
 * Thanks for the info, I'm not sure why the name was being changed to "EmailPages", but I've reverted it for now since it had broken it. --Nad 23:32, 16 August 2008 (UTC)

Email link in tool box
Email link is not showing in toolbox for skins other than monobook skin. Why? Annything should be added extra to show in toolbox?
 * Hi, I can confirm your observation. The Tab to send an e-mail and the link in the toolbox do only show up in “monobook”. Additionally “modern” and “vector” should be supported since these are the skins officially supported by MediaWiki. It would be great to see this become reality. :-) Cheers --kgh 00:13, 2 February 2010 (UTC)

$wgEmailPageGroup
Hi Nad, if you specify more than on group, e. g.  you get the following warning: “WARNING: Illegal offset type in isset or empty in .../includes/SpecialPage.php on line 720”. I only get it when looking at “Special:SpecialPages”... ...I just realized after testing, that the extension works only with on designated usergroup. It might be a nice option to be able granting permission to more than one usergroup. However, it is a great extension. Cheers --kgh 21:24, 18 November 2009 (UTC)
 * Thanks a lot for the translations, I've added them to svn :-) I'll look in to the other problem when I get some more time soon. --Nad 19:51, 29 January 2010 (UTC)

Localisation “de” and “de-formal”
done. Hi Nad! Thank you! --kgh 00:17, 2 February 2010 (UTC)

PHPMailer_v5.1
Hi Nad, I have installed and used the latest version 5.1 of PHPMailer (2009-11-11). So far it seems to work beautifully. I think it is ok to provide this version with the snapshots too. Cheers --kgh 14:26, 11 April 2010 (UTC)