Support the ongoing development of Laravel.io →
Mail Packages Laravel

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

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lucakuehne lucakuehne Joined 27 May 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.