diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
index 8b64359..a726f6a 100644
|
|
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() |
223 | 223 | // Explode the headers out, so this function can take both |
224 | 224 | // string headers and an array of headers. |
225 | 225 | $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) ); |
| 226 | |
| 227 | // Line which starts with space is a continuation of previous line, need to keep them as one |
| 228 | for ( $index = 0; $index < count( $tempheaders ); $index ++ ) { |
| 229 | if ( $index > 0 && $tempheaders[$index] && ' ' === $tempheaders[$index][0] ) { |
| 230 | $tempheaders[ $index - 1 ] .= "\n" . $tempheaders[$index]; |
| 231 | array_splice( $tempheaders, $index, 1 ); |
| 232 | $index--; |
| 233 | } |
| 234 | } |
226 | 235 | } else { |
227 | 236 | $tempheaders = $headers; |
228 | 237 | } |
… |
… |
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() |
258 | 267 | $from_name = substr( $content, 0, $bracket_pos - 1 ); |
259 | 268 | $from_name = str_replace( '"', '', $from_name ); |
260 | 269 | $from_name = trim( $from_name ); |
| 270 | if ( function_exists( 'mb_decode_mimeheader' ) ) { |
| 271 | $from_name = mb_decode_mimeheader( $from_name ); |
| 272 | } |
261 | 273 | } |
262 | 274 | |
263 | 275 | $from_email = substr( $content, $bracket_pos + 1 ); |
… |
… |
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() |
268 | 280 | } elseif ( '' !== trim( $content ) ) { |
269 | 281 | $from_email = trim( $content ); |
270 | 282 | } |
| 283 | |
271 | 284 | break; |
272 | 285 | case 'content-type': |
273 | 286 | if ( strpos( $content, ';' ) !== false ) { |
… |
… |
function wp_text_diff( $left_string, $right_string, $args = null ) { |
2459 | 2472 | return $r; |
2460 | 2473 | } |
2461 | 2474 | endif; |
2462 | | |
diff --git tests/phpunit/tests/mail.php tests/phpunit/tests/mail.php
index 5142c72..f541e50 100644
|
|
class Tests_Mail extends WP_UnitTestCase { |
307 | 307 | |
308 | 308 | $this->assertNotContains( 'quoted-printable', $GLOBALS['phpmailer']->mock_sent[0]['header'] ); |
309 | 309 | } |
| 310 | |
| 311 | /** |
| 312 | * |
| 313 | */ |
| 314 | function test_wp_mail_multiline_header() { |
| 315 | $headers = 'From: =?UTF-8?B?0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg?='; |
| 316 | $headers .= "\n =?UTF-8?B?0YLQtdGB0YIg0YLQtdGB0YI=?= <test@example.com>"; |
| 317 | wp_mail( 'test@test.com', 'subject', 'message', $headers ); |
| 318 | |
| 319 | $mailer = tests_retrieve_phpmailer_instance(); |
| 320 | $this->assertEquals( 'test@example.com', $mailer->From ); |
| 321 | $this->assertEquals( |
| 322 | 'тест тест тест тест тест тест тест', |
| 323 | $mailer->FromName |
| 324 | ); |
| 325 | } |
310 | 326 | } |