*
* @return string
*/
- static function arrayToHeaderString( $headers, $endl = "\n" ) {
+ static function arrayToHeaderString( $headers, $endl = PHP_EOL ) {
$strings = array();
foreach ( $headers as $name => $value ) {
// Prevent header injection by stripping newlines from value
*/
public static function send( $to, $from, $subject, $body, $options = array() ) {
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 = array( $to );
// Line endings need to be different on Unix and Windows due to
// the bug described at http://trac.wordpress.org/ticket/2603
- if ( wfIsWindows() ) {
- $endl = "\r\n";
- } else {
- $endl = "\n";
- }
+ $endl = PHP_EOL;
if ( is_array( $body ) ) {
// we are sending a multipart message
$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';
}