From: Tim Starling Date: Thu, 1 Apr 2004 13:05:20 +0000 (+0000) Subject: error message returned even for non-PEAR function X-Git-Tag: 1.3.0beta1~652 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=1212c94eac29aa64f8064f1e606a5a07e9652df7;p=lhc%2Fweb%2Fwiklou.git error message returned even for non-PEAR function --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 155677b890..f6097afcf8 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -6,7 +6,7 @@ # Otherwise it just uses the standard PHP 'mail' function. function userMailer( $to, $from, $subject, $body ) { - global $wgUser, $wgSMTP, $wgOutputEncoding; + global $wgUser, $wgSMTP, $wgOutputEncoding, $wgErrorString; $qto = wfQuotedPrintable( $to ); @@ -49,10 +49,19 @@ function userMailer( $to, $from, $subject, $body ) "Reply-To: {$from}\r\n" . "To: {$qto}\r\n" . "X-Mailer: MediaWiki interuser e-mailer"; + + $wgErrorString = ""; + set_error_handler( "mailErrorHandler" ); mail( $to, $subject, $body, $headers ); - - return ""; + restore_error_handler(); + + return $wgErrorString; } } -?> \ No newline at end of file +function mailErrorHandler( $code, $string ) { + global $wgErrorString; + $wgErrorString = preg_replace( "/^mail\(\): /", "", $string ); +} + +?>