From: Brion Vibber Date: Fri, 9 Jun 2006 08:24:47 +0000 (+0000) Subject: * (bug 6243) Fix email for usernames containing dots when using PEAR::Mail X-Git-Tag: 1.31.0-rc.0~56827 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=3b3fe578ef34e912213631e2d37f0d7b93e19650;p=lhc%2Fweb%2Fwiklou.git * (bug 6243) Fix email for usernames containing dots when using PEAR::Mail --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 814f328661..e4caaf459d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -461,6 +461,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5981) Add plural function Slovenian (sl) * (bug 5945) Introduce {{CONTENTLANGUAGE}} magic word * {{PLURAL}} can now take up to five forms +* (bug 6243) Fix email for usernames containing dots when using PEAR::Mail + == Compatibility == diff --git a/includes/SpecialConfirmemail.php b/includes/SpecialConfirmemail.php index e07ed004ca..fd0425a871 100644 --- a/includes/SpecialConfirmemail.php +++ b/includes/SpecialConfirmemail.php @@ -49,7 +49,8 @@ class EmailConfirmation extends SpecialPage { function showRequestForm() { global $wgOut, $wgUser, $wgLang, $wgRequest; if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getText( 'token' ) ) ) { - $message = $wgUser->sendConfirmationMail() ? 'confirmemail_sent' : 'confirmemail_sendfailed'; + $ok = $wgUser->sendConfirmationMail(); + $message = WikiError::isError( $ok ) ? 'confirmemail_sendfailed' : 'confirmemail_sent'; $wgOut->addWikiText( wfMsg( $message ) ); } else { if( $wgUser->isEmailConfirmed() ) { diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 56271464ec..8de39a6452 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -54,7 +54,11 @@ class MailAddress { */ function toString() { if( $this->name != '' ) { - return wfQuotedPrintable( $this->name ) . " <" . $this->address . ">"; + $quoted = wfQuotedPrintable( $this->name ); + if( strpos( $quoted, '.' ) !== false ) { + $quoted = '"' . $quoted . '"'; + } + return "$quoted <{$this->address}>"; } else { return $this->address; } @@ -80,10 +84,10 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { require_once( 'Mail.php' ); $timestamp = time(); - $dest = $to->toString(); + $dest = $to->address; $headers['From'] = $from->toString(); - $headers['To'] = $dest; + $headers['To'] = $to->toString(); if ( $replyto ) { $headers['Reply-To'] = $replyto; } @@ -97,7 +101,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('smtp', $wgSMTP); - wfDebug( "Sending mail via PEAR::Mail to $dest" ); + wfDebug( "Sending mail via PEAR::Mail to $dest\n" ); $mailResult =& $mail_object->send($dest, $headers, $body); # Based on the result return an error string,