Closed DevHeaven closed 1 year ago
Same problem here. When I'm just doing a simple:
$client->checkConnection();
$folder = $client->getFolderByPath($path);
$messages = $folder->messages()->all()->get();
return var_dump($messages);
The result is the following:
object(Webklex\PHPIMAP\Support\MessageCollection)#314 (3) {
["items":protected]=>
array(0) {
}
["escapeWhenCastingToString":protected]=>
bool(false)
["total":protected]=>
int(5)
}
The "total" amount is correct, I have 5 mails in this folder. Although I don't get any info regarding the actual messages. I'm on Laravel 9 with the latest laravel-imap from composer, IMAP server is plain 'ol Dovecot, php8.1.
I seem to have the same issue created over at the php-imap repository: https://github.com/Webklex/php-imap/issues/341
Just leaving this here as reference if it gets resolved at one place or the other.
I am reposting my solution from the php-imap repository here as well, maybe it helps:
After diving into the libraries code myself I figured out the issue. In my configuration file, for some reason the sequence
-option was set to \Webklex\PHPIMAP\IMAP::ST_MSGN
instead of \Webklex\PHPIMAP\IMAP::ST_UID
. After changing it, the MessageCollection
contained the items as expected.
Thanks for figuring it out, @manraf ! I'm not sure though if I will continue using this library. As you can see for yourself, the support is underwhelming - for two months we haven't got a single response in this issue from a maintainer and there are only like 10 open issues.
I am reposting my solution from the php-imap repository here as well, maybe it helps:
After diving into the libraries code myself I figured out the issue. In my configuration file, for some reason the
sequence
-option was set to\Webklex\PHPIMAP\IMAP::ST_MSGN
instead of\Webklex\PHPIMAP\IMAP::ST_UID
. After changing it, theMessageCollection
contained the items as expected.
Really big thanks! I had the same issue and it helped!
Big thanks @manraf. You really saved my day!
Hello
No matter what I try , I always get a zero message count. I've tried the standard sample. I've tried $folder->query()->all()->count() , I've tried $folder->query()->all()->get()->first() I've tried with getSubject() in foreach .... nothing seems to work.
When I foreach trough folders and echo $folder->name , I get "INBOX" as result
ANy starter advise to get this going ? Much appreciated !!