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();
/**
* Converts a string into quoted-printable format
+ * @since 1.17
*/
public static function quotedPrintable( $string, $charset = '' ) {
# Probably incomplete; see RFC 2045
/**@{
* Backwards compatibility functions
*
- * @deprecated Use UserMailer methods; will be removed in 1.19
+ * @deprecated Use UserMailer method deprecated in 1.18, remove in 1.19.
*/
function wfRFC822Phrase( $s ) {
wfDeprecated( __FUNCTION__ );
return UserMailer::rfc822Phrase( $s );
}
+/**
+ * @deprecated Use UserMailer method deprecated in 1.18, remove in 1.19.
+ */
function userMailer( $to, $from, $subject, $body, $replyto = null ) {
wfDeprecated( __FUNCTION__ );
return UserMailer::send( $to, $from, $subject, $body, $replyto );
}
-function wfQuotedPrintable( $string, $charset = '' ) {
- wfDeprecated( __FUNCTION__ );
- return UserMailer::quotedPrintable( $string, $charset );
-}
/**@}*/