作者 邓超

x

... ... @@ -313,9 +313,11 @@ function folderAliasMap():array {
'INBOX' => '收件箱',
// qq的
'Sent Messages' => '发件箱',
'Sent' => '发件箱',
'Drafts' => '草稿箱',
'Junk' => '垃圾箱',
'Deleted Messages' => '回收站',
'Trash' => '回收站',
'垃圾邮件' => '垃圾箱',
'已删除' => '回收站',
... ...
... ... @@ -415,6 +415,12 @@ class Imap {
foreach ($result[1] as $item){
// 解析源数据
if(preg_match('/^\* LIST \(([\\a-z\s]{0,})\) "(.*)" "(.*)"/Ui',$item,$m)){
$check = explode(' ',$m[1]);
$check = array_map(function ($v){
$v = trim($v);
$v = trim($v,'\\');
return $v;
},$check);
$folder[] = [
'parent' => $m[2],
// 源文件夹名称,在进行 select的时候必须用未解析的文件夹名称
... ... @@ -423,6 +429,8 @@ class Imap {
'parseFolder' => mb_convert_encoding($m[3], 'UTF-8', 'UTF7-IMAP'),
// 是否可选择
'isSelect' => strpos($m[1],'NoSelect')===false,
// 这里里面包含了公共的功能文件夹 比如 草稿,发送,有些邮箱没有
'check' => $check
];
}
}
... ...
... ... @@ -115,9 +115,31 @@ class Mail {
if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
try {
$folder_name = '';
// 已发送
if(in_array('Send',$folder['check'])){
$folder_name = folderAlias('Send');
}
// 草稿
elseif(in_array('Drafts',$folder['check'])){
$folder_name = folderAlias('Drafts');
}
// 垃圾
elseif(in_array('Junk',$folder['check'])){
$folder_name = folderAlias('Junk');
}
// 回收站
elseif(in_array('Trash',$folder['check'])){
$folder_name = folderAlias('Trash');
}
if(!$folder_name){
$folder_name = folderAlias($folder['parseFolder']);
}
$db->insert(folderSql::$table,[
'email_id' => $email_id,
'folder' => folderAlias($folder['parseFolder']),
'folder' => $folder_name,
'origin_folder' => $folder['folder'],
'uuid' => $uuid,
'pid' => $pid
... ...