作者 邓超

xxx

... ... @@ -773,6 +773,14 @@ class Imap {
// 取得body
$result = $this->fetch($data,'body',$is_uid);
foreach ($result as $key=>$item){
// 兼容 有的邮箱 不支持 RFC822.TEXT
if (empty($item['RFC822.TEXT']) && !empty($item['RFC822'])){
$item['RFC822.TEXT'] = $item['RFC822'];
$item['RFC822.TEXT'] = explode("\r\n\r\n",$item['RFC822.TEXT']);
unset($item['RFC822.TEXT'][0]);
$item['RFC822.TEXT'] = implode("\r\n\r\n",$item['RFC822.TEXT']);
}
if (!empty($item['RFC822.TEXT'])){
$header = $this->fetchHeader($item['UID'],1);
$header = array_values($header);
... ... @@ -934,6 +942,21 @@ class Imap {
}
break;
}
// 这个是整体 包含了邮件头 RFC822.HEADER 和 RFC822.TEXT body内容
case 'RFC822':{
array_shift($header);
$result['RFC822'] = trim(implode(' ',$header));
$header = [];
// 微软的邮箱有毛病
$endLine = explode("\n",$result['RFC822']);
$endLine = trim(end($endLine));
if(preg_match("/^UID\s\d+\sFLAGS\s\(.*\)$/iU",$endLine)){
$arr = $this->parseFetch($endLine);
$result = array_merge($result,$arr);
$result['RFC822'] = mb_substr($result['RFC822'],0,-mb_strlen($endLine));
}
break;
}
case 'RFC822.HEADER':{
array_shift($header);
$result['RFC822.HEADER'] = implode(' ',$header);
... ...