Index: src/wp-includes/pluggable.php
===================================================================
--- src/wp-includes/pluggable.php (revision 39915)
+++ src/wp-includes/pluggable.php (working copy)
@@ -365,10 +365,6 @@
return false;
}
- // Set mail's subject and body
- $phpmailer->Subject = $subject;
- $phpmailer->Body = $message;
-
// Set destination addresses, using appropriate methods for handling addresses
$address_headers = compact( 'to', 'cc', 'bcc', 'reply_to' );
@@ -414,8 +410,9 @@
// Set Content-Type and charset
// If we don't have a content-type from the input headers
- if ( !isset( $content_type ) )
+ if ( ! isset( $content_type ) ) {
$content_type = 'text/plain';
+ }
/**
* Filters the wp_mail() content type.
@@ -429,15 +426,21 @@
$phpmailer->ContentType = $content_type;
// Set whether it's plaintext, depending on $content_type
- if ( 'text/html' == $content_type )
+ if ( 'text/html' == $content_type ) {
$phpmailer->IsHTML( true );
+ if ( false !== strpos( $message, "\r\n" ) && false === strpos( $message, '
/', '$1', $message );
+ }
+
// If we don't have a charset from the input headers
- if ( !isset( $charset ) )
+ if ( ! isset( $charset ) ) {
$charset = get_bloginfo( 'charset' );
+ }
- // Set the content-type and charset
-
/**
* Filters the default wp_mail() charset.
*
@@ -447,6 +450,10 @@
*/
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
+ // Set mail's subject and body
+ $phpmailer->Subject = $subject;
+ $phpmailer->Body = $message;
+
// Set custom headers
if ( !empty( $headers ) ) {
foreach ( (array) $headers as $name => $content ) {