Skip to content

Commit 59663fd

Browse files
committed
Don't set overall encoding just because we're changing a sub-part - quoted-printable and base64 are not valid encodings for a multipart container anyway.
1 parent 7b9fd07 commit 59663fd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

class.phpmailer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,12 +2130,12 @@ public function createBody()
21302130
//Can we do a 7-bit downgrade?
21312131
if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
21322132
$bodyEncoding = '7bit';
2133+
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
21332134
$bodyCharSet = 'us-ascii';
21342135
}
21352136
//If lines are too long, and we're not already using an encoding that will shorten them,
2136-
//change to quoted-printable transfer encoding
2137+
//change to quoted-printable transfer encoding for the body part only
21372138
if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
2138-
$this->Encoding = 'quoted-printable';
21392139
$bodyEncoding = 'quoted-printable';
21402140
}
21412141

@@ -2144,10 +2144,11 @@ public function createBody()
21442144
//Can we do a 7-bit downgrade?
21452145
if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
21462146
$altBodyEncoding = '7bit';
2147+
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
21472148
$altBodyCharSet = 'us-ascii';
21482149
}
21492150
//If lines are too long, and we're not already using an encoding that will shorten them,
2150-
//change to quoted-printable transfer encoding
2151+
//change to quoted-printable transfer encoding for the alt body part only
21512152
if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
21522153
$altBodyEncoding = 'quoted-printable';
21532154
}

0 commit comments

Comments
 (0)