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());
}
}