| 
...
 | 
...
 | 
@@ -13,9 +13,11 @@ use Model\listsSql; | 
| 
 | 
 | 
  * @package Controller
 | 
| 
 | 
 | 
  */
 | 
| 
 | 
 | 
 class Test {
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
  public function home(){
 | 
| 
 | 
 | 
      return 404;
 | 
| 
 | 
 | 
  }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     public function a(){
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 return 404;
 | 
| 
 | 
 | 
 
 | 
| 
...
 | 
...
 | 
@@ -67,19 +69,20 @@ return 404; | 
| 
 | 
 | 
 //            app()->e(404,404);
 | 
| 
 | 
 | 
 //        }
 | 
| 
 | 
 | 
 //
 | 
| 
 | 
 | 
 ////        $email = db()->first(emailSql::first(app()->request('mid')));
 | 
| 
 | 
 | 
         $email = db()->first(emailSql::first(app()->request('mid')));
 | 
| 
 | 
 | 
 //
 | 
| 
 | 
 | 
 //        $config = (new \Lib\Imap\ImapConfig())
 | 
| 
 | 
 | 
 //            ->setEmail('CService001@spicay-meart.com')
 | 
| 
 | 
 | 
 //            ->setPassword('5YmS77JBb7JJwuaD')
 | 
| 
 | 
 | 
 //            ->setHost('imap.exmail.qq.com');
 | 
| 
 | 
 | 
         $config = (new \Lib\Imap\ImapConfig())
 | 
| 
 | 
 | 
             ->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()) {
 | 
| 
 | 
 | 
             $msgno = (int) app()->request('msgno');
 | 
| 
 | 
 | 
             $uid = (int) app()->request('uid');
 | 
| 
 | 
 | 
              $page = (int) app()->request('page',1);
 | 
| 
 | 
 | 
 //            foreach ($imap->getFolders()->all() as $a){
 | 
| 
 | 
 | 
 //                echo $a->folder;
 | 
| 
 | 
 | 
 //                echo '=>';
 | 
| 
...
 | 
...
 | 
@@ -87,18 +90,27 @@ return 404; | 
| 
 | 
 | 
 //                echo '|';
 | 
| 
 | 
 | 
 //            };
 | 
| 
 | 
 | 
             $folder = $imap->folder('INBOX');
 | 
| 
 | 
 | 
             
 | 
| 
 | 
 | 
             if($uid){
 | 
| 
 | 
 | 
                 $msg = $folder->msg()->uid([$uid])->get()->first();
 | 
| 
 | 
 | 
                 
 | 
| 
 | 
 | 
                 return $msg->body->getHtml();
 | 
| 
 | 
 | 
             }
 | 
| 
 | 
 | 
             
 | 
| 
 | 
 | 
             
 | 
| 
 | 
 | 
             echo '总共有:';
 | 
| 
 | 
 | 
             echo $folder->getTotal();
 | 
| 
 | 
 | 
             echo "<br>";
 | 
| 
 | 
 | 
             echo "<br>";
 | 
| 
 | 
 | 
             echo '<a href="?msgno='.($msgno+1).'">下一个</a>';
 | 
| 
 | 
 | 
             echo '<a href="?mid='.$email['id'].'&page='.($page+1).'">下一页</a>';
 | 
| 
 | 
 | 
             echo "<br>";
 | 
| 
 | 
 | 
             echo "<hr>";
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
             $msgs = $folder->msg()->forPage(449)->get();
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
             $msgs = $folder->msg()->forPage($page)->get();
 | 
| 
 | 
 | 
             if ($msgs) {
 | 
| 
 | 
 | 
                 $msgs->each(function ($msg){
 | 
| 
 | 
 | 
                     echo '<p>'.$msg->uid.'==>'.$msg->header->getSubject().' =====> '.date('Y-m-d H:i:s',strtotime($msg->date)).'</p>';
 | 
| 
 | 
 | 
                 $msgs->each(function ($msg) use($email){
 | 
| 
 | 
 | 
                     echo '<p><a href="?mid='.$email['id'].'&uid='.$msg->uid.'">'.$msg->uid.'==>'.$msg->header->getSubject().' =====> '.date('Y-m-d H:i:s',strtotime($msg->date)).'</a></p>';
 | 
| 
 | 
 | 
                 });
 | 
| 
 | 
 | 
 //                echo $msg->header->getSubject();
 | 
| 
 | 
 | 
 //                echo '<br>-------------------------------------------------<br>';
 | 
...
 | 
...
 | 
 |