作者 邓超

星标

@@ -450,6 +450,18 @@ class Home extends Base { @@ -450,6 +450,18 @@ class Home extends Base {
450 $this->setFlags('answered'); 450 $this->setFlags('answered');
451 } 451 }
452 452
  453 + /**
  454 + * 星标
  455 + * @throws \Lib\Err
  456 + * @author:dc
  457 + * @time 2024/6/21 16:35
  458 + */
  459 + public function star_2_unstar(){
  460 + $this->setFlags('flagged');
  461 + }
  462 +
  463 +
  464 +
453 465
454 466
455 /** 467 /**
@@ -680,6 +692,11 @@ class Home extends Base { @@ -680,6 +692,11 @@ class Home extends Base {
680 $mailInstance->answered(array_column($uid,'uid'),$folder['origin_folder'],$fv); 692 $mailInstance->answered(array_column($uid,'uid'),$folder['origin_folder'],$fv);
681 break; 693 break;
682 } 694 }
  695 + // 星标
  696 + case 'flagged':{
  697 + $mailInstance->flagged(array_column($uid,'uid'),$folder['origin_folder'],$fv);
  698 + break;
  699 + }
683 // 回收站,已删 未删,软删 700 // 回收站,已删 未删,软删
684 // case 'deleted':{ 701 // case 'deleted':{
685 // $mailInstance->recycle(array_column($uid,'uid'),$folder['origin_folder'],$fv); 702 // $mailInstance->recycle(array_column($uid,'uid'),$folder['origin_folder'],$fv);
@@ -556,6 +556,23 @@ class Mail { @@ -556,6 +556,23 @@ class Mail {
556 return $this->client->flags($uids,[Imap::FLAGS_ANSWERED],$seen ? '+' : '-',true); 556 return $this->client->flags($uids,[Imap::FLAGS_ANSWERED],$seen ? '+' : '-',true);
557 } 557 }
558 558
  559 + /**
  560 + * 回复标记
  561 + * @param $uids
  562 + * @param $folder
  563 + * @param $flagged
  564 + * @return bool
  565 + * @throws \Exception
  566 + * @author:dc
  567 + * @time 2023/4/6 17:10
  568 + */
  569 + public function flagged($uids,$folder,$flagged):bool{
  570 + // 选择目录
  571 + $status = $this->client->selectFolder($folder);
  572 +
  573 + return $this->client->flags($uids,[Imap::FLAGS_FLAGGED],$flagged ? '+' : '-',true);
  574 + }
  575 +
559 576
560 /** 577 /**
561 * 复制 578 * 复制
@@ -34,6 +34,8 @@ return [ @@ -34,6 +34,8 @@ return [
34 'seen_2_unseen' => [\Controller\Home::class, 'seen_2_unseen'], 34 'seen_2_unseen' => [\Controller\Home::class, 'seen_2_unseen'],
35 // 标记为已回复/未回复 35 // 标记为已回复/未回复
36 'answered_2_unanswered' => [\Controller\Home::class, 'answered_2_unanswered'], 36 'answered_2_unanswered' => [\Controller\Home::class, 'answered_2_unanswered'],
  37 +
  38 + 'star_2_unstar' => [\Controller\Home::class, 'star_2_unstar'],
37 // 邮件移动文件夹 39 // 邮件移动文件夹
38 'move' => [\Controller\Home::class, 'move'], 40 'move' => [\Controller\Home::class, 'move'],
39 // 复制邮件 41 // 复制邮件