作者 邓超

1

@@ -233,7 +233,7 @@ class Mail { @@ -233,7 +233,7 @@ class Mail {
233 'folder_id' => $folder_id, 233 'folder_id' => $folder_id,
234 'email_id' => $email_id, 234 'email_id' => $email_id,
235 'uuid' => md5($email_id.$folder_id.$result['UID']), 235 'uuid' => md5($email_id.$folder_id.$result['UID']),
236 - 'is_file' => MailFun::isFile($file_header[$key]['BODYSTRUCTURE']??[]) //是否附件 236 + 'is_file' => MailFun::isFile($file_header[$key]['BODYSTRUCTURE']??'') //是否附件
237 ]; 237 ];
238 }catch (\Throwable $e){ 238 }catch (\Throwable $e){
239 logs( 239 logs(
@@ -35,7 +35,7 @@ class MailFun { @@ -35,7 +35,7 @@ class MailFun {
35 */ 35 */
36 public static function decodeMimeStr($string, $charset = 'utf-8') { 36 public static function decodeMimeStr($string, $charset = 'utf-8') {
37 $newString = ''; 37 $newString = '';
38 - $elements = imap_mime_header_decode($string); 38 + $elements = \imap_mime_header_decode($string);
39 // print_r($elements); 39 // print_r($elements);
40 for($i = 0; $i < count($elements); $i++) { 40 for($i = 0; $i < count($elements); $i++) {
41 if($elements[$i]->charset == 'default') { 41 if($elements[$i]->charset == 'default') {
@@ -60,19 +60,19 @@ class MailFun { @@ -60,19 +60,19 @@ class MailFun {
60 60
61 /** 61 /**
62 * 验证是否有附件 BODYSTRUCTURE值 62 * 验证是否有附件 BODYSTRUCTURE值
63 - * @param array $BODYSTRUCTURE 63 + * @param $BODYSTRUCTURE
64 * @return int 64 * @return int
65 * @author:dc 65 * @author:dc
66 * @time 2022/11/1 10:57 66 * @time 2022/11/1 10:57
67 */ 67 */
68 - public static function isFile(array $BODYSTRUCTURE):int { 68 + public static function isFile($BODYSTRUCTURE):int {
69 // foreach ($BODYSTRUCTURE as $item){ 69 // foreach ($BODYSTRUCTURE as $item){
70 // if($item[0] === 'APPLICATION'){ 70 // if($item[0] === 'APPLICATION'){
71 // return 1; 71 // return 1;
72 // } 72 // }
73 // } 73 // }
74 // return 0; 74 // return 0;
75 - $json = json_encode($BODYSTRUCTURE); 75 + $json = is_array($BODYSTRUCTURE) ? json_encode($BODYSTRUCTURE) : $BODYSTRUCTURE;
76 return strpos($json,'"attachment"')!==false; 76 return strpos($json,'"attachment"')!==false;
77 } 77 }
78 78