/**
* Send mail using a PEAR mailer
*
- * @param UserMailer $mailer
+ * @param Mail_smtp $mailer
* @param string $dest
* @param string $headers
* @param string $body
*/
public static function send( $to, $from, $subject, $body, $options = [] ) {
global $wgAllowHTMLEmail;
- $contentType = 'text/plain; charset=UTF-8';
+
if ( !is_array( $options ) ) {
// Old calling style
wfDeprecated( __METHOD__ . ' with $replyto as 5th parameter', '1.26' );
$options['contentType'] = func_get_arg( 5 );
}
}
+ if ( !isset( $options['contentType'] ) ) {
+ $options['contentType'] = 'text/plain; charset=UTF-8';
+ }
if ( !is_array( $to ) ) {
$to = [ $to ];
$body = str_replace( "\n", "\r\n", $body );
}
$headers['MIME-Version'] = '1.0';
- $headers['Content-type'] = ( is_null( $contentType ) ?
- 'text/plain; charset=UTF-8' : $contentType );
+ $headers['Content-type'] = $contentType;
$headers['Content-transfer-encoding'] = '8bit';
}
}
$out = "=?$charset?Q?";
$out .= preg_replace_callback( "/([$replace])/",
- [ __CLASS__, 'quotedPrintableCallback' ], $string );
+ function ( $matches ) {
+ return sprintf( "=%02X", ord( $matches[1] ) );
+ },
+ $string
+ );
$out .= '?=';
return $out;
}
-
- protected static function quotedPrintableCallback( $matches ) {
- return sprintf( "=%02X", ord( $matches[1] ) );
- }
}