Skip to content

Commit 8039ca7

Browse files
committed
refactor: clear PHPMailer encoding to prevent stale state between wp_mail() calls
1 parent 3ce550a commit 8039ca7

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/wp-includes/pluggable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
358358
$phpmailer->clearReplyTos();
359359
$phpmailer->Body = '';
360360
$phpmailer->AltBody = '';
361-
$phpmailer->Encoding = PHPMailer\PHPMailer\PHPMailer::ENCODING_8BIT;
361+
$phpmailer->Encoding = '';
362362

363363
// Set "From" name and email.
364364

tests/phpunit/includes/mock-mailer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class MockPHPMailer extends WP_PHPMailer {
2020
public $mock_sent = array();
2121

2222
public function preSend() {
23-
$this->Encoding = '8bit';
2423
return parent::preSend();
2524
}
2625

tests/phpunit/tests/pluggable/wpMail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,9 @@ public function test_wp_mail_encoding_does_not_bleed() {
567567
$mailer = tests_retrieve_phpmailer_instance();
568568
$this->assertEquals( 'quoted-printable', $mailer->Encoding );
569569

570-
wp_mail( WP_TESTS_EMAIL, 'A follow up short email', 'Short email' );
570+
wp_mail( WP_TESTS_EMAIL, 'A follow up short email', 'Short email' );
571571

572572
$mailer = tests_retrieve_phpmailer_instance();
573-
$this->assertEquals( '8bit', $mailer->Encoding );
573+
$this->assertEquals( '', $mailer->Encoding );
574574
}
575575
}

0 commit comments

Comments
 (0)