Webklex / php-imap

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well.
https://www.php-imap.com
MIT License
315 stars 151 forks source link

What is the fastest way to get one message? #508

Open ziggurad opened 3 months ago

ziggurad commented 3 months ago

My code:

return $folder->query()->all()->limit(1)->get()->last();

I am currently processing emails from a mailbox with about 9 thousand messages. Connection via oAuth, The above code executes in about 1.6 seconds. Is it possible to download one message faster? It does not matter to me whether it will be the first, last or random message from the mailbox.