empty_subject_check.php
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* 检查邮件同步时出现的空数据,很奇怪
* 定时任务,每1小时执行一次
*/
require_once "../vendor/autoload.php";
$id = redis()->get('empty_subject_check',185163874);
while($id){
$list = db()->first(\Model\listsSql::first('`id` > '.$id.' and `subject` = ""','`id`,`email_id`,`folder_id`,`uid`'));
if(!$list){
break;
}
$id = $list['id']??0;
echo $id."\n";
$email = db()->first(\Model\emailSql::first($list['email_id']));
$folder = db()->first(\Model\folderSql::first($list['folder_id']));
if(!$folder){continue;}
$config = (new \Lib\Imap\ImapConfig())
// ->debug()
->setEmail($email['email'])
->setPassword(base64_decode($email['password']))
->setHost($email['imap']);
$imap = \Lib\Imap\ImapPool::get($config);
//$imap->debug();
$login = $imap->login();
if($login->isOk()){
(new \Service\SyncMail($email,$imap))->mail($folder['origin_folder'],[$list['uid']]);
}
}
redis()->set('empty_subject_check',$id);
exit;