Since having problems with the new phpmailers EncodeQP function and its Char and Line/WordWrap Handling, I reintroduce the functionality of the old

class.
This commit is contained in:
Klaus Leithoff 2008-07-08 08:38:56 +00:00
parent 2e28640d9e
commit 9dfa6f6d4c

View File

@ -1415,6 +1415,24 @@ class PHPMailer {
* @return string
*/
public function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
//old behavior
if ($line_max==76 && $space_conv === false) {
$encoded = $this->FixEOL($input);
if (substr($encoded, -(strlen($this->LE))) != $this->LE)
$encoded .= $this->LE;
// Replace every high ascii, control and = characters
$encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
"'='.sprintf('%02X', ord('\\1'))", $encoded);
// Replace every spaces and tabs when it's the last character on a line
$encoded = preg_replace("/([\011\040])".$this->LE."/e",
"'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
// Maximum line length of 76 characters before CRLF (74 + space + '=')
$encoded = $this->WrapText($encoded, $line_max-2, true);
return $encoded;
} else {
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
$lines = preg_split('/(?:\r\n|\r|\n)/', $input);
$eol = "\r\n";
@ -1454,6 +1472,7 @@ class PHPMailer {
} // end of while
return trim($output);
}
}
/**
* Encode string to q encoding.