ddeboer / imap

Object-oriented, fully tested PHP IMAP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Returns all emails on filter

nhCoder opened this issue · comments

$today = new DateTimeImmutable();
$timeDel = $today->sub(new DateInterval('PT8M'));


$messages = $mailbox->getMessages(new Ddeboer\Imap\Search\Date\Before($timeDel));

I m trying to get emails received before 8 minutes ago but it returns all messages in INBOX.
Is this a bug or am I doing something wrong?
Any help will be appreciated .

You should use the After filter

do you have an example

please have a look I have updated the whole question..

Does it support time based search.
i looked here and they say it doesn't support time based search https://stackoverflow.com/a/26791550

i looked here and they say it doesn't support time based search https://stackoverflow.com/a/26791550

That may be true indeed.

I would suggest you to try one or a mix of there flags:

  • \Ddeboer\Imap\Search\Flag\Recent
  • \Ddeboer\Imap\Search\Flag\Unseen
  • \Ddeboer\Imap\Search\State\NewMessage