Skip to content

Commit b4738e3

Browse files
committed
tests: add test for PHPMailer encoding bleeding between wp_mail() calls
1 parent a39e155 commit b4738e3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/phpunit/tests/pluggable/wpMail.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,4 +554,22 @@ public function test_wp_mail_resets_properties() {
554554
$phpmailer = $GLOBALS['phpmailer'];
555555
$this->assertNotSame( 'user1', $phpmailer->AltBody );
556556
}
557+
558+
/**
559+
* Test that the encoding of the email does not bleed between long and short emails.
560+
*
561+
* @ticket 33972
562+
*/
563+
function test_wp_mail_encoding_does_not_bleed() {
564+
$content = str_repeat( 'A', 1000 );
565+
wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content );
566+
567+
$mailer = tests_retrieve_phpmailer_instance();
568+
$this->assertEquals( 'quoted-printable', $mailer->Encoding );
569+
570+
wp_mail( WP_TESTS_EMAIL, 'A follow up short email', 'Short email –' );
571+
572+
$mailer = tests_retrieve_phpmailer_instance();
573+
$this->assertEquals( '8bit', $mailer->Encoding );
574+
}
557575
}

0 commit comments

Comments
 (0)