php-imap
php-imap copied to clipboard
Very slow message loading its about 2 to 3 min for getting 10 messages using pagination on GMAIL INBOX folder.
Describe the bug Folder listing is very fast but as soon as it starts to fetch messages it is very slow.
Code to Reproduce
$cm = new ClientManager($options = []);
$emailClient = $cm->make([
'host' => $emailSetting->incoming_server_host,
'port' => $emailSetting->incoming_server_port,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => $emailSetting->username, /// THIS IS GMAIL ACCOUNT
'password' => $emailSetting->password,
'protocol' => $emailSetting->protocol,
]);
$emailClient->connect();
$emailClient->getFolders(); // THIS IS SUPER QUICK
// THIS IS SUPER SLOW
$messages = $emailFolder->query()
->setFetchBody(false)
->all()
->fetchOrderDesc()
->paginate($per_page = 10, $page = 1, $page_name = 'imap_page');
@Webklex - Anything here?
Hi @cms007 , many thanks for your report. I personally can't replicate this behavior. Do you experience the same if you are using a different account and / or provider? Is it the same, if you fetch messages from a different folder / inbox? How does it behave if you perform the same calls as above but from a different host?
Best regards,
Hi @cms007 ,
please give the current master a try. Also make sure you've enabled options.debug. This might help to figure out which part in the communication takes so long.
Best regards,