global $wgEnotifMaxRecips, $wgAdditionalMailParams;
if ( is_array( $to ) ) {
+ $emails = '';
// This wouldn't be necessary if implode() worked on arrays of
// objects using __toString(). http://bugs.php.net/bug.php?id=36612
foreach ( $to as $t ) {
if ( is_array( $wgSMTP ) ) {
$found = false;
- $pathArray = explode( PATH_SEPARATOR, get_include_path() );
- foreach ( $pathArray as $path ) {
- if ( file_exists( $path . DIRECTORY_SEPARATOR . 'Mail.php' ) ) {
- $found = true;
- break;
- }
+ if ( function_exists( 'stream_resolve_include_path' ) ) {
+ $found = stream_resolve_include_path( 'Mail.php' );
+ } else {
+ $found = Fallback::stream_resolve_include_path( 'Mail.php' );
}
if ( !$found ) {
throw new MWException( 'PEAR mail package is not installed' );
ini_set( 'html_errors', '0' );
set_error_handler( array( 'UserMailer', 'errorHandler' ) );
- if ( is_array( $to ) ) {
- foreach ( $to as $recip ) {
+ // We need to check for safe_mode, because mail() throws an E_NOTICE
+ // on the 5th parameter when it's turned on
+ $sm = wfIniGetBool( 'safe_mode' );
+
+ if ( !is_array( $to ) ) {
+ $to = array( $to );
+ }
+ foreach ( $to as $recip ) {
+ if( $sm ) {
+ $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers );
+ } else {
$sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
}
- } else {
- $sent = mail( $to->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
}
restore_error_handler();