Last modified: 2010-05-15 15:59:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11567 - bogus email error message when creating an account ($wgSMTP only)
bogus email error message when creating an account ($wgSMTP only)
Product: MediaWiki
Classification: Unclassified
Email (Other open bugs)
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: 13094 13276 13411 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-10-05 06:56 UTC by steve l
Modified: 2010-05-15 15:59 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Proposed patch to fix mailer problem (2.02 KB, patch)
2008-02-07 18:55 UTC, Mark Anderson
svn diff (2.04 KB, patch)
2008-02-07 19:09 UTC, Mark Anderson

Description steve l 2007-10-05 06:56:09 UTC
Email is sent by wiki when registering a new user, but registering user gets message on wiki page after registering stating that the wiki failed to send confirmation email for reason "1".  In fact the confirmation email was sent.

wiki configured using wgSMTP, which is documented as:

$wgSMTP = array(
 'host'     => "localhost",
 'IDHost'   => "domain for MessageID",
 'port'     => 25,
 'auth'     => false,
 'username' => "my_user_name",
 'password' => "my_password"

The error essage is caused by this code in SpecialUserlogin.php

			$error = $u->sendConfirmationMail();
			if( WikiError::isError( $error ) ) {
				$wgOut->addWikiText( wfMsg( 'confirmemail_sendfailed', $error->getMessage() ) );
			} else {
				$wgOut->addWikiText( wfMsg( 'confirmemail_oncreate' ) );

WikiError::isError( $error ) is evaluating as true and
$error->getMessage() is returning "1".

In the $wgSMTP case, the called functions are:

    return (sendMail())

        $error = userMailer( $to, $sender, $subject, $body );

		if( $error == '' ) {
			return true;
		} else {
			return new WikiError( $error );

                $mail_object =& Mail::factory('smtp', $wgSMTP); 
		if (is_array($dest)) {
			$chunks = array_chunk($dest, $wgEnotifMaxRecips);
			foreach ($chunks as $chunk) {
				$e = send_mail($mail_object, $chunk, $headers, $body);
				if ($e != '')
					return $e;
		} else
			return $mail_object->send($dest, $headers, $body);

single destination (recipient), so $dest is not an array.

Mail::factory->send() returns true on success.

So on successful email, I think this is happening:

  send() returns true
  userMailer() returns true
  sendMail returns new WikiError(true);

I don't know much about php.  My guess is that true does not equal ''.
Comment 1 Mark Anderson 2008-02-07 18:55:12 UTC
Created attachment 4629 [details]
Proposed patch to fix mailer problem
Comment 2 Mark Anderson 2008-02-07 19:09:07 UTC
Created attachment 4630 [details]
 svn diff 

I haven't found a coding styles guideline, so I hope I didn't commit any horrible errors.
Comment 3 Mark Anderson 2008-02-07 19:16:30 UTC
There's definitely a little quirkiness on how the error result is handled. The
send_mail function does better by checking if it's an object, but according to
the pear mail docs, the Pear::isError function is recommended. 

I don't know whether the original choice was deliberate, based on superior knowledge of the system, or just a bug.
Comment 4 Brion Vibber 2008-02-13 05:08:48 UTC
I've normalized the calling checks in r30896...

* When sending to a single recipient, the PEAR return value now goes through the proper checks
^^ this would have been the direct cause of this bug; returning bogus success messages on failure and bogus error messages on success.

* Using PEAR::isError() explicitly
* UserMailer::send() / userMailer() now returns true-or-WikiError, matching the calling convention of User::sendMail(). This convention is apparently expected by many of its callers anyway. :P
Comment 5 Brion Vibber 2008-02-26 23:33:27 UTC
*** Bug 13094 has been marked as a duplicate of this bug. ***
Comment 6 Brion Vibber 2008-03-06 21:03:57 UTC
*** Bug 13276 has been marked as a duplicate of this bug. ***
Comment 7 Brion Vibber 2008-03-18 18:27:45 UTC
*** Bug 13411 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.