Skip to content

Commit

Permalink
Only use 7bit or 8bit as the CTE for multipart MIME parts, fixes PHPM…
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Apr 22, 2014
1 parent 89003b9 commit 9bdda8c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ public function createHeader()
public function getMailMIME()
{
$result = '';
$ismultipart = true;
switch ($this->message_type) {
case 'inline':
$result .= $this->headerLine('Content-Type', 'multipart/related;');
Expand All @@ -1741,11 +1742,20 @@ public function getMailMIME()
default:
// Catches case 'plain': and case '':
$result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
$ismultipart = false;
break;
}
//RFC1341 part 5 says 7bit is assumed if not specified
if ($this->Encoding != '7bit') {
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
//RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
if ($ismultipart) {
if ($this->Encoding == '8bit') {
$result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
}
//The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
} else {
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
}
}

if ($this->Mailer != 'mail') {
Expand Down

0 comments on commit 9bdda8c

Please sign in to comment.