作者 邓超

x

... ... @@ -294,33 +294,37 @@ class Mail {
}
try {
foreach ($header as $k=>$item){
$header[strtolower($k)] = $item;
}
// 没有收件人
$header['To'] = MailFun::toOrFrom($header['To']??($header['TO']??''));
$header['to'] = MailFun::toOrFrom($header['to']??'');
$header['From'] = MailFun::toOrFrom($header['From']??($header['FROM']??''));
$header['from'] = MailFun::toOrFrom($header['from']);
// 抄送 ,密送
$cc = [];
$bcc = [];
if($header['Cc']??''){
$cc = MailFun::toOrFrom($header['Cc']);
if($header['cc']??''){
$cc = MailFun::toOrFrom($header['cc']);
}
if($header['Bcc']??''){
$bcc = MailFun::toOrFrom($header['Bcc']);
if($header['bcc']??''){
$bcc = MailFun::toOrFrom($header['bcc']);
}
$data = [
'uid' => $result['UID'],
'subject' => $header['Subject']??'',
'subject' => $header['subject'],
'cc' => $cc,
'bcc' => $bcc,
'from' => $header['From'][0]['email']??'',
'from_name' => $header['From'][0]['name']??'',
'to' => $header['To']?implode(',',array_column($header['To'],'email')):'',
'to_name' => json_encode($header['To']),
'date' => strtotime(is_array($header['Date']??'') ? $header['Date'][0] : $header['Date']??''),
'message_id' => $header['Message-ID']??'',
'from' => $header['from'][0]['email']??'',
'from_name' => $header['from'][0]['name']??'',
'to' => $header['to']?implode(',',array_column($header['to'],'email')):'',
'to_name' => json_encode($header['to']),
'date' => strtotime(is_array($header['date']??'') ? $header['date'][0] : $header['date']??''),
'message_id' => $header['message-id']??'',
'udate' => strtotime($result['INTERNALDATE']),
'size' => $result['RFC822.SIZE']??0,
'recent' => in_array('recent',$result['FLAGS']) ? 1 : 0,
... ...