0

`` Excuse the English of translator

I am trying to consult emails in parts since there are more than 4000 to process them, I am working with Laravel and phpimap, I have tried everything, I start programming and I do not understand much of this

I practically just opened the connection, my plan is to use jobs to get those emails in the background but, for now I need to get them since I can't find how
public function index()
    {
    $account= new mailModel();
    $cm = new ClientManager($options = []);
    $messages= new MessageCollection($perPage = 500, $page = 6, $pageName = 'page');
       
       #$message= new Message();
       
        
     
        $client = $cm->make([
            'host'          => 'mail.spamanalizer.ibx.lat',
            'port'          => 993,
            'encryption'    => 'ssl',
            'validate_cert' => true,
            'username'      => '',
            'password'      => '',
            'protocol'      => 'imap'
        ]);

        //Connect to the IMAP Server
        $client->connect();

        $query=new WhereQuery($client);
        $folder = $client->getFolderByName('Recibidos');
        
        $query->all()->chunked(function($messages, $chunk){
            /** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */
            dump("chunk #$chunk");
            $messages->each(function($message){
                /** @var \Webklex\PHPIMAP\Message $message */
                dump($message->uid);
                
        });
        }, $chunk_size = 50, $start_chunk = 1);
    
        echo "<pre>".print_r($messages, true)."</pre>";
    
    
    }

0 Answers0