Index: trunk/extensions/ConfirmAccount/RequestAccount_body.php |
— | — | @@ -504,13 +504,18 @@ |
505 | 505 | # Send confirmation email to prospective user |
506 | 506 | $this->confirmEmail( $name ); |
507 | 507 | # Send mail to admin after e-mail has been confirmed |
508 | | - if ( $wgConfirmAccountContact ) { |
509 | | - $u = User::newFromName( $name, 'creatable' ); |
510 | | - $u->setEmail( $wgConfirmAccountContact ); |
511 | | - $title = Title::makeTitle( NS_SPECIAL, 'ConfirmAccounts' ); |
512 | | - $url = $title->getFullUrl(); |
513 | | - $u->sendMail( wfMsg( 'requestaccount-email-subj-admin' ), |
514 | | - wfMsg( 'requestaccount-email-body-admin', $name, $url ) ); |
| 508 | + global $wgConfirmAccountContact, $wgPasswordSender; |
| 509 | + if ( $wgConfirmAccountContact != '' ) { |
| 510 | + $target = new MailAddress( $wgConfirmAccountContact ); |
| 511 | + $source = new MailAddress( $wgPasswordSender ); |
| 512 | + $title = SpecialPage::getTitleFor( 'ConfirmAccounts' ); |
| 513 | + $subject = wfMsg( 'requestaccount-email-subj-admin' ); |
| 514 | + $body = wfMsg( 'requestaccount-email-body-admin', $name, $title->getFullUrl() ); |
| 515 | + # Actually send the email... |
| 516 | + $result = UserMailer::send( $target, $source, $subject, $body ); |
| 517 | + if ( WikiError::isError( $result ) ) { |
| 518 | + wfDebug( "Could not sent email to admin at $target\n" ); |
| 519 | + } |
515 | 520 | } |
516 | 521 | $wgOut->addWikiText( wfMsgHtml( 'request-account-econf' ) ); |
517 | 522 | $wgOut->returnToMain(); |