作者 邓超

1

@@ -260,7 +260,7 @@ function sync($email_id,$worker_id){ @@ -260,7 +260,7 @@ function sync($email_id,$worker_id){
260 } 260 }
261 } 261 }
262 262
263 - }catch (Throwable $e){ 263 + }catch (\Throwable $e){
264 logs( 264 logs(
265 $e->getMessage().$e->getTraceAsString(), 265 $e->getMessage().$e->getTraceAsString(),
266 LOG_PATH.'/imap/'.$email['email'].'.error.log' 266 LOG_PATH.'/imap/'.$email['email'].'.error.log'
@@ -232,7 +232,7 @@ class Mail { @@ -232,7 +232,7 @@ class Mail {
232 'from_name' => $header['From'][0]['name']??'', 232 'from_name' => $header['From'][0]['name']??'',
233 'to' => $header['To']?implode(',',array_column($header['To'],'email')):'', 233 'to' => $header['To']?implode(',',array_column($header['To'],'email')):'',
234 'to_name' => json_encode($header['To']), 234 'to_name' => json_encode($header['To']),
235 - 'date' => isset($header['Date'])&&$header['Date'] ? strtotime(is_array($header['Date']) ? $header['Date'][0] : $header['Date']) : strtotime($result['INTERNALDATE']), 235 + 'date' => strtotime(is_array($header['Date']??'') ? $header['Date'][0] : $header['Date']??''),
236 'message_id' => $header['Message-ID']??'', 236 'message_id' => $header['Message-ID']??'',
237 'udate' => strtotime($result['INTERNALDATE']), 237 'udate' => strtotime($result['INTERNALDATE']),
238 'size' => $result['RFC822.SIZE']??0, 238 'size' => $result['RFC822.SIZE']??0,
@@ -246,6 +246,7 @@ class Mail { @@ -246,6 +246,7 @@ class Mail {
246 'uuid' => md5($email_id.$folder_id.$result['UID']), 246 'uuid' => md5($email_id.$folder_id.$result['UID']),
247 'is_file' => MailFun::isFile($result['BODYSTRUCTURE']??'') //是否附件 247 'is_file' => MailFun::isFile($result['BODYSTRUCTURE']??'') //是否附件
248 ]; 248 ];
  249 + $data['date'] = $data['date'] ? : 0;
249 }catch (\Throwable $e){ 250 }catch (\Throwable $e){
250 logs( 251 logs(
251 '邮件解析失败:'.PHP_EOL.$e->getMessage().PHP_EOL.print_r($result,true), 252 '邮件解析失败:'.PHP_EOL.$e->getMessage().PHP_EOL.print_r($result,true),