2013-04-26 123 views
0

我想使用Zend_Mail_Storage_Imap从imap获取电子邮件。当我得到内容时,我看不到波兰语字符。 邮件:Zend Mail存储编码波兰语字符

COS潭COS潭

内容使用Zend_Mail_Message:

CO = B6 TAM CO = B6担

我的代码:

foreach($imap as $messageNum=>$message) 
{ 
    if($message->isMultipart()) 
    { 
     $con = array(
      'content_type' => null, 
      'encoding' => null, 
      'text' => null, 
     ); 

     foreach (new RecursiveIteratorIterator($message) as $part) 
     { 
      $con['encoding'] = $part->getHeaderField('content-type', 'charset'); 

      $content_type = strtok($part->contentType, ';'); 
      if(!$con['content_type']) 
      { 
       $con['content_type'] = $content_type; 
       $con['text'] = $part->getContent(); 
      } 
      else 
      { 
       if($content_type == 'text/html') 
       { 
        $con['content_type'] = $content_type; 
        $con['text'] = $part->getContent(); 
       } 
      } 
     } 
     $content = $con['text']; 
     if(strtolower($con['encoding']) != 'utf-8') 
      $content = iconv($con['encoding'], 'utf-8', $con['text']); 
    } 
    else 
    { 
     var_dump($message->getContent()); 
    } 
} 

回答

0

quoted_printable_decode($string)