作者 邓超

1

... ... @@ -233,7 +233,7 @@ class Mail {
'folder_id' => $folder_id,
'email_id' => $email_id,
'uuid' => md5($email_id.$folder_id.$result['UID']),
'is_file' => MailFun::isFile($file_header[$key]['BODYSTRUCTURE']??[]) //是否附件
'is_file' => MailFun::isFile($file_header[$key]['BODYSTRUCTURE']??'') //是否附件
];
}catch (\Throwable $e){
logs(
... ...
... ... @@ -35,7 +35,7 @@ class MailFun {
*/
public static function decodeMimeStr($string, $charset = 'utf-8') {
$newString = '';
$elements = imap_mime_header_decode($string);
$elements = \imap_mime_header_decode($string);
// print_r($elements);
for($i = 0; $i < count($elements); $i++) {
if($elements[$i]->charset == 'default') {
... ... @@ -60,19 +60,19 @@ class MailFun {
/**
* 验证是否有附件 BODYSTRUCTURE值
* @param array $BODYSTRUCTURE
* @param $BODYSTRUCTURE
* @return int
* @author:dc
* @time 2022/11/1 10:57
*/
public static function isFile(array $BODYSTRUCTURE):int {
public static function isFile($BODYSTRUCTURE):int {
// foreach ($BODYSTRUCTURE as $item){
// if($item[0] === 'APPLICATION'){
// return 1;
// }
// }
// return 0;
$json = json_encode($BODYSTRUCTURE);
$json = is_array($BODYSTRUCTURE) ? json_encode($BODYSTRUCTURE) : $BODYSTRUCTURE;
return strpos($json,'"attachment"')!==false;
}
... ...