Send unencoded UTF8 in subject/body text when SMTPUTF8 allows that.
This commit is contained in:
parent
2f0af94d33
commit
e588719eec
|
|
@ -2926,7 +2926,9 @@ class PHPMailer
|
|||
$bodyEncoding = $this->Encoding;
|
||||
$bodyCharSet = $this->CharSet;
|
||||
//Can we do a 7-bit downgrade?
|
||||
if (static::ENCODING_8BIT === $bodyEncoding && !$this->has8bitChars($this->Body)) {
|
||||
if ($this->UseSMTPUTF8) {
|
||||
$bodyEncoding = static::ENCODING_8BIT;
|
||||
} else if (static::ENCODING_8BIT === $bodyEncoding && !$this->has8bitChars($this->Body)) {
|
||||
$bodyEncoding = static::ENCODING_7BIT;
|
||||
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
|
||||
$bodyCharSet = static::CHARSET_ASCII;
|
||||
|
|
@ -3572,6 +3574,11 @@ class PHPMailer
|
|||
*/
|
||||
public function encodeHeader($str, $position = 'text')
|
||||
{
|
||||
$position = strtolower($position);
|
||||
if($this->UseSMTPUTF8 && !("comment" === $position)) {
|
||||
return trim(static::normalizeBreaks($str));
|
||||
}
|
||||
|
||||
$matchcount = 0;
|
||||
switch (strtolower($position)) {
|
||||
case 'phrase':
|
||||
|
|
|
|||
|
|
@ -1254,6 +1254,17 @@ EOT;
|
|||
$this->Mail->addAddress('spın̈altap@spın̈altap.invalid', '');
|
||||
$this->Mail->preSend();
|
||||
self::assertStringContainsString("spın̈altap@spın̈altap.invalid", $this->Mail->createHeader());
|
||||
|
||||
//Sending unencoded UTF8 is legal when SMTPUTF8 is used,
|
||||
//except that body parts have to be encoded if they
|
||||
//accidentally contain any lines that match the MIME boundary
|
||||
//lines. It also looks good, so let's do it.
|
||||
|
||||
$this->Mail->Subject = 'Spın̈al Tap';
|
||||
self::assertStringContainsString("Spın̈al", $this->Mail->createHeader());
|
||||
$this->Mail->Body = 'Spın̈al Tap';
|
||||
$this->Mail->preSend();
|
||||
self::assertStringContainsString("Spın̈al", $this->Mail->createBody());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue