Mail: Add a unit test to make sure `wp_mail()` does not duplicate the `MIME-Version` header added automatically by PHPMailer.

See #43542.

git-svn-id: https://develop.svn.wordpress.org/trunk@46118 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-14 21:34:51 +00:00
parent 3ac6f6a8f8
commit 7b8c666b72
1 changed files with 16 additions and 0 deletions

View File

@ -273,6 +273,22 @@ class Tests_Mail extends WP_UnitTestCase {
$this->assertTrue( strpos( $mailer->get_sent()->header, $expected ) > 0 );
}
/**
* @ticket 43542
*/
public function test_wp_mail_does_not_duplicate_mime_version_header() {
$to = 'user@example.com';
$subject = 'Test email with a MIME-Version header';
$message = 'The MIME-Version header should not be duplicated.';
$headers = 'MIME-Version: 1.0';
$expected = 'MIME-Version: 1.0';
wp_mail( $to, $subject, $message, $headers );
$mailer = tests_retrieve_phpmailer_instance();
$this->assertEquals( 1, substr_count( $mailer->get_sent()->header, $expected ) );
}
function wp_mail_quoted_printable( $mailer ) {
$mailer->Encoding = 'quoted-printable';
}