作者 邓超

x

@@ -313,9 +313,11 @@ function folderAliasMap():array { @@ -313,9 +313,11 @@ function folderAliasMap():array {
313 'INBOX' => '收件箱', 313 'INBOX' => '收件箱',
314 // qq的 314 // qq的
315 'Sent Messages' => '发件箱', 315 'Sent Messages' => '发件箱',
  316 + 'Sent' => '发件箱',
316 'Drafts' => '草稿箱', 317 'Drafts' => '草稿箱',
317 'Junk' => '垃圾箱', 318 'Junk' => '垃圾箱',
318 'Deleted Messages' => '回收站', 319 'Deleted Messages' => '回收站',
  320 + 'Trash' => '回收站',
319 321
320 '垃圾邮件' => '垃圾箱', 322 '垃圾邮件' => '垃圾箱',
321 '已删除' => '回收站', 323 '已删除' => '回收站',
@@ -415,6 +415,12 @@ class Imap { @@ -415,6 +415,12 @@ class Imap {
415 foreach ($result[1] as $item){ 415 foreach ($result[1] as $item){
416 // 解析源数据 416 // 解析源数据
417 if(preg_match('/^\* LIST \(([\\a-z\s]{0,})\) "(.*)" "(.*)"/Ui',$item,$m)){ 417 if(preg_match('/^\* LIST \(([\\a-z\s]{0,})\) "(.*)" "(.*)"/Ui',$item,$m)){
  418 + $check = explode(' ',$m[1]);
  419 + $check = array_map(function ($v){
  420 + $v = trim($v);
  421 + $v = trim($v,'\\');
  422 + return $v;
  423 + },$check);
418 $folder[] = [ 424 $folder[] = [
419 'parent' => $m[2], 425 'parent' => $m[2],
420 // 源文件夹名称,在进行 select的时候必须用未解析的文件夹名称 426 // 源文件夹名称,在进行 select的时候必须用未解析的文件夹名称
@@ -423,6 +429,8 @@ class Imap { @@ -423,6 +429,8 @@ class Imap {
423 'parseFolder' => mb_convert_encoding($m[3], 'UTF-8', 'UTF7-IMAP'), 429 'parseFolder' => mb_convert_encoding($m[3], 'UTF-8', 'UTF7-IMAP'),
424 // 是否可选择 430 // 是否可选择
425 'isSelect' => strpos($m[1],'NoSelect')===false, 431 'isSelect' => strpos($m[1],'NoSelect')===false,
  432 + // 这里里面包含了公共的功能文件夹 比如 草稿,发送,有些邮箱没有
  433 + 'check' => $check
426 ]; 434 ];
427 } 435 }
428 } 436 }
@@ -115,9 +115,31 @@ class Mail { @@ -115,9 +115,31 @@ class Mail {
115 115
116 if(!$db->count(folderSql::has(['uuid'=>$uuid]))){ 116 if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
117 try { 117 try {
  118 + $folder_name = '';
  119 + // 已发送
  120 + if(in_array('Send',$folder['check'])){
  121 + $folder_name = folderAlias('Send');
  122 + }
  123 + // 草稿
  124 + elseif(in_array('Drafts',$folder['check'])){
  125 + $folder_name = folderAlias('Drafts');
  126 + }
  127 + // 垃圾
  128 + elseif(in_array('Junk',$folder['check'])){
  129 + $folder_name = folderAlias('Junk');
  130 + }
  131 + // 回收站
  132 + elseif(in_array('Trash',$folder['check'])){
  133 + $folder_name = folderAlias('Trash');
  134 + }
  135 +
  136 + if(!$folder_name){
  137 + $folder_name = folderAlias($folder['parseFolder']);
  138 + }
  139 +
118 $db->insert(folderSql::$table,[ 140 $db->insert(folderSql::$table,[
119 'email_id' => $email_id, 141 'email_id' => $email_id,
120 - 'folder' => folderAlias($folder['parseFolder']), 142 + 'folder' => $folder_name,
121 'origin_folder' => $folder['folder'], 143 'origin_folder' => $folder['folder'],
122 'uuid' => $uuid, 144 'uuid' => $uuid,
123 'pid' => $pid 145 'pid' => $pid