Hi
I have to say that I'm fairly new to Web Developement, PHP and Laravel (Basic HTML etc. is no problem) Now I wrote a Laravel command which should fetch emails trough IMAP. For that I used the following package: https://github.com/barbushin/php-imap This is my code at the moment:
$mailbox = new \PhpImap\Mailbox('{' . $imap_server . '/imap' . $imap_encryption . '}', $imap_user, $imap_password, __DIR__);
$mailsIds = $mailbox->sortMails(SORTDATE, false);
if(!$mailsIds) {
die('Mailbox is empty');
}
foreach($mailsIds as $mailId){
$this->line($mailbox->getMailsInfo($mailsIds)[$mailId]->date);
}
This outputs the maildates of the emails.. If I now change this line:
$mailsIds = $mailbox->sortMails(SORTDATE, false);
to that:
$mailsIds = $mailbox->sortMails(SORTDATE, true);
I get this error:
[ErrorException] Undefined offset: 14588
Changing the boolean at the end jsut says the command, that it should fetch the emails in reverse order...
Has anyone an idea why this error occurs?
Greetings Luca
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community