protected function encode($str, $encoding, $eol = "\r\n", $length = Sabel_Mail::LINELENGTH) { switch (strtolower($encoding)) { case "base64": return rtrim(chunk_split(base64_encode($str), $length, $eol)); case "quoted-printable": return Sabel_Mail_QuotedPrintable::encode($str, $length, $eol); default: return $str; } }
public function encodeHeader($header) { if ($this->isMbstringLoaded) { $enc = $this->headerEncoding === "base64" ? "B" : "Q"; return mb_encode_mimeheader($header, $this->charset, $enc, self::$EOL); } elseif ($this->headerEncoding === "base64") { return "=?{$this->charset}?B?" . base64_encode($header) . "?="; } else { $quoted = Sabel_Mail_QuotedPrintable::encode($header, self::LINELENGTH, self::$EOL); return "=?{$this->charset}?Q?{$quoted}?="; } }