作者 邓超

1

@@ -646,10 +646,10 @@ class Imap { @@ -646,10 +646,10 @@ class Imap {
646 public function fetchBody($data,$saveFilePath=__DIR__,$is_uid = false){ 646 public function fetchBody($data,$saveFilePath=__DIR__,$is_uid = false){
647 // 取得body 647 // 取得body
648 $result = $this->fetch($data,'body',$is_uid); 648 $result = $this->fetch($data,'body',$is_uid);
649 - foreach ($result as &$item){ 649 + foreach ($result as $key=>$item){
650 if (!empty($item['RFC822.TEXT'])){ 650 if (!empty($item['RFC822.TEXT'])){
651 // 解析 651 // 解析
652 - $item['RFC822.TEXT'] = (new Body($item['RFC822.TEXT'],$saveFilePath))->getItem(); 652 + $result[$key]['RFC822.TEXT'] = (new Body($item['RFC822.TEXT'],$saveFilePath))->getItem();
653 } 653 }
654 } 654 }
655 655
@@ -319,13 +319,13 @@ class Mail { @@ -319,13 +319,13 @@ class Mail {
319 if(!empty($body)){ 319 if(!empty($body)){
320 $db->insert(bodySql::$table,[ 320 $db->insert(bodySql::$table,[
321 'lists_id' => $id, 321 'lists_id' => $id,
322 - 'text_html' => $body 322 + 'text_html' => base64_encode(json_encode($body)) // todo::因为邮件会出现多编码问题,会导致数据库写不进去
323 ],false); 323 ],false);
324 324
325 $description = ''; 325 $description = '';
326 foreach ($body as $item){ 326 foreach ($body as $item){
327 if(in_array($item['type'],['text/html','text/plain'])){ 327 if(in_array($item['type'],['text/html','text/plain'])){
328 - $description = mb_substr(strip_tags($item['body']),0,190); 328 + $description = mb_substr(trim(strip_tags($item['body'])),0,190);
329 break; 329 break;
330 } 330 }
331 } 331 }