Example #1
0
 private static function decodeMessageBody($header, $body, $charset)
 {
     $encoding = strtolower($header->GetHeader('CONTENT-TRANSFER-ENCODING'));
     if ($encoding == 'base64') {
         $body = base64_decode($body);
     } elseif ($encoding == 'quoted-printable') {
         $body = quoted_printable_decode($body);
     } elseif ($encoding == 'x-uue') {
         $body = CMailUtil::uue_decode($body);
     }
     $content_type = strtolower($header->content_type);
     if (preg_match('/plain|html|text/', $content_type) && strpos($content_type, 'x-vcard') === false && strpos($content_type, 'csv') === false) {
         $body = CMailUtil::convertCharset($body, $header->charset, $charset);
     }
     return array('CONTENT-TYPE' => $content_type, 'CONTENT-ID' => $header->content_id, 'BODY' => $body, 'FILENAME' => $header->filename);
 }