作者 邓超

x

@@ -294,33 +294,37 @@ class Mail { @@ -294,33 +294,37 @@ class Mail {
294 } 294 }
295 try { 295 try {
296 296
  297 + foreach ($header as $k=>$item){
  298 + $header[strtolower($k)] = $item;
  299 + }
  300 +
297 // 没有收件人 301 // 没有收件人
298 - $header['To'] = MailFun::toOrFrom($header['To']??($header['TO']??'')); 302 + $header['to'] = MailFun::toOrFrom($header['to']??'');
299 303
300 304
301 - $header['From'] = MailFun::toOrFrom($header['From']??($header['FROM']??'')); 305 + $header['from'] = MailFun::toOrFrom($header['from']);
302 // 抄送 ,密送 306 // 抄送 ,密送
303 $cc = []; 307 $cc = [];
304 $bcc = []; 308 $bcc = [];
305 - if($header['Cc']??''){  
306 - $cc = MailFun::toOrFrom($header['Cc']); 309 + if($header['cc']??''){
  310 + $cc = MailFun::toOrFrom($header['cc']);
307 } 311 }
308 - if($header['Bcc']??''){  
309 - $bcc = MailFun::toOrFrom($header['Bcc']); 312 + if($header['bcc']??''){
  313 + $bcc = MailFun::toOrFrom($header['bcc']);
310 } 314 }
311 315
312 316
313 $data = [ 317 $data = [
314 'uid' => $result['UID'], 318 'uid' => $result['UID'],
315 - 'subject' => $header['Subject']??'', 319 + 'subject' => $header['subject'],
316 'cc' => $cc, 320 'cc' => $cc,
317 'bcc' => $bcc, 321 'bcc' => $bcc,
318 - 'from' => $header['From'][0]['email']??'',  
319 - 'from_name' => $header['From'][0]['name']??'',  
320 - 'to' => $header['To']?implode(',',array_column($header['To'],'email')):'',  
321 - 'to_name' => json_encode($header['To']),  
322 - 'date' => strtotime(is_array($header['Date']??'') ? $header['Date'][0] : $header['Date']??''),  
323 - 'message_id' => $header['Message-ID']??'', 322 + 'from' => $header['from'][0]['email']??'',
  323 + 'from_name' => $header['from'][0]['name']??'',
  324 + 'to' => $header['to']?implode(',',array_column($header['to'],'email')):'',
  325 + 'to_name' => json_encode($header['to']),
  326 + 'date' => strtotime(is_array($header['date']??'') ? $header['date'][0] : $header['date']??''),
  327 + 'message_id' => $header['message-id']??'',
324 'udate' => strtotime($result['INTERNALDATE']), 328 'udate' => strtotime($result['INTERNALDATE']),
325 'size' => $result['RFC822.SIZE']??0, 329 'size' => $result['RFC822.SIZE']??0,
326 'recent' => in_array('recent',$result['FLAGS']) ? 1 : 0, 330 'recent' => in_array('recent',$result['FLAGS']) ? 1 : 0,