Skip to content

Commit

Permalink
#0010136: wrong email charset
Browse files Browse the repository at this point in the history
Mailed upstream
  • Loading branch information
mantis committed Feb 28, 2009
1 parent 2839af4 commit 2f3156b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/phpmailer/class.phpmailer.php
Expand Up @@ -1319,7 +1319,7 @@ public function EncodeHeader ($str, $position = 'text') {
if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
// Use a custom function which correctly encodes and wraps long
// multibyte strings without breaking lines within a character
$encoded = $this->Base64EncodeWrapMB($str);
$encoded = $this->Base64EncodeWrapMB($str, "\n");
} else {
$encoded = base64_encode($str);
$maxlen -= $maxlen % 4;
Expand Down Expand Up @@ -1358,9 +1358,10 @@ public function HasMultiBytes($str) {
* Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
* @access public
* @param string $str multi-byte text to wrap encode
* @param string $linefeed line feed (should be \n for mail headers)
* @return string
*/
public function Base64EncodeWrapMB($str) {
public function Base64EncodeWrapMB($str, $linefeed="\r\n") {
$start = "=?".$this->CharSet."?B?";
$end = "?=";
$encoded = "";
Expand All @@ -1384,11 +1385,11 @@ public function Base64EncodeWrapMB($str) {
}
while (strlen($chunk) > $length);

$encoded .= $chunk . $this->LE;
$encoded .= $chunk . $linefeed;
}

// Chomp the last linefeed
$encoded = substr($encoded, 0, -strlen($this->LE));
$encoded = substr($encoded, 0, -strlen($linefeed));
return $encoded;
}

Expand Down

0 comments on commit 2f3156b

Please sign in to comment.