...
|
...
|
@@ -321,29 +321,34 @@ class SyncMail { |
|
|
*/
|
|
|
protected function saveMail(int $folder_id, array $lists, bool $isBody=false){
|
|
|
foreach ($lists as $item){
|
|
|
|
|
|
$data = [
|
|
|
'uid' => $item->uid,
|
|
|
'subject' => mb_substr($item->header->getSubject(),0,1000),// 控制下,有的蛋疼,整tm多长
|
|
|
'cc' => $item->header->getCc(true),
|
|
|
'bcc' => $item->header->getBcc(true),
|
|
|
'from' => $item->header->getFrom()->email,
|
|
|
'from_name' => $item->header->getFrom()->name,
|
|
|
'to' => implode(',',array_column($item->header->getTo(true),'email')),
|
|
|
'to_name' => $item->header->getTo(true),
|
|
|
// 这个是 邮件的时间 就是header里面带的 一般情况就是发件时间
|
|
|
try {
|
|
|
$data = [
|
|
|
'uid' => $item->uid,
|
|
|
'subject' => mb_substr($item->header->getSubject(),0,1000),// 控制下,有的蛋疼,整tm多长
|
|
|
'cc' => $item->header->getCc(true),
|
|
|
'bcc' => $item->header->getBcc(true),
|
|
|
'from' => $item->header->getFrom()->email,
|
|
|
'from_name' => $item->header->getFrom()->name,
|
|
|
'to' => implode(',',array_column($item->header->getTo(true),'email')),
|
|
|
'to_name' => $item->header->getTo(true),
|
|
|
// 这个是 邮件的时间 就是header里面带的 一般情况就是发件时间
|
|
|
// 'date' => strtotime($item->header->getDate()),
|
|
|
'udate' => strtotime($item->date), // 有这个时间就够了,内部时间,就是收到邮件的时间
|
|
|
'size' => $item->size,
|
|
|
'recent' => $item->isRecent() ? 1 : 0,
|
|
|
'seen' => $item->isSeen() ? 1 : 0,
|
|
|
'draft' => $item->isDraft() ? 1 : 0,
|
|
|
'flagged' => $item->isFlagged() ? 1 : 0,
|
|
|
'answered' => $item->isAnswered() ? 1 : 0,
|
|
|
'folder_id' => $folder_id,
|
|
|
'email_id' => $this->emailId(),
|
|
|
'is_file' => $item->isAttachment() ? 1: 0 //是否附件
|
|
|
];
|
|
|
'udate' => strtotime($item->date), // 有这个时间就够了,内部时间,就是收到邮件的时间
|
|
|
'size' => $item->size,
|
|
|
'recent' => $item->isRecent() ? 1 : 0,
|
|
|
'seen' => $item->isSeen() ? 1 : 0,
|
|
|
'draft' => $item->isDraft() ? 1 : 0,
|
|
|
'flagged' => $item->isFlagged() ? 1 : 0,
|
|
|
'answered' => $item->isAnswered() ? 1 : 0,
|
|
|
'folder_id' => $folder_id,
|
|
|
'email_id' => $this->emailId(),
|
|
|
'is_file' => $item->isAttachment() ? 1: 0 //是否附件
|
|
|
];
|
|
|
}catch (\Throwable $e){
|
|
|
logs([$e->getMessage(),$folder_id,$this->emailId(),$item->uid]);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
$data['from'] = mb_substr($data['from'],0,120);
|
|
|
|
...
|
...
|
|