From: Brion Vibber Date: Wed, 4 Oct 2006 23:35:29 +0000 (+0000) Subject: Handle failure of Mail::factory() gracefully X-Git-Tag: 1.31.0-rc.0~55620 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=b31d2a51cf930e18b2f6c4f9f9e5d96e4a76cee0;p=lhc%2Fweb%2Fwiklou.git Handle failure of Mail::factory() gracefully --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 892bf6540a..78a8be91ef 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -104,6 +104,11 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('smtp', $wgSMTP); + if( PEAR::isError( $mail_object ) ) { + wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() . "\n" ); + return $mail_object->getMessage(); + } + wfDebug( "Sending mail via PEAR::Mail to $dest\n" ); $mailResult =& $mail_object->send($dest, $headers, $body);