getName() . '@' . $wgSMTP['IDHost'] . '>'; $headers['X-Mailer'] = 'MediaWiki interuser e-mailer'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('smtp', $wgSMTP); $mailResult =& $mail_object->send($to, $headers, $body); # Based on the result return an error string, if ($mailResult === true) return ''; else if (is_object($mailResult)) return $mailResult->getMessage(); else return 'Mail object return unknown error.'; } else { $headers = "MIME-Version: 1.0\n" . "Content-type: text/plain; charset={$wgOutputEncoding}\n" . "Content-transfer-encoding: 8bit\n" . "From: {$from}\n" . "X-Mailer: MediaWiki interuser e-mailer"; $wgErrorString = ''; set_error_handler( 'mailErrorHandler' ); mail( $to, $subject, $body, $headers ); restore_error_handler(); return $wgErrorString; } } /** * */ function mailErrorHandler( $code, $string ) { global $wgErrorString; $wgErrorString = preg_replace( "/^mail\(\): /", "", $string ); } ?>