A
A
Ainur Shakirov2016-11-30 18:02:18
PHP
Ainur Shakirov, 2016-11-30 18:02:18

The imap_search function often fails to find messages, what am I doing wrong?

The code:

$this->mbox = @imap_open("{imap.yandex.ru:993/imap/ssl}INBOX", $login, $pwd);
$arr = imap_search($this->mbox,'UNSEEN FROM "' . $imap_search . '"  SUBJECT "'.$th.'"',SE_FREE,'UTF-8');
 var_dump($arr); // $arr= false

That is, I need unread messages from a specific sender and with a specific subject.
And I can’t understand what the problem is, because if you just specify UNSEENit, then it finds them.
If UNSEEN FROM ""then it's 50/50, sometimes it finds them, and sometimes it's false.
But if UNSEEN FROM "" SUBJECT ""here most often it sends false.
Maybe the Yandex server is buggy, or am I making requests in the wrong way? ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmitriy, 2016-11-30
@dmitriylanets

On Yandex, most likely a cache on the search, which is not updated so often, so it does not start seeing letters immediately. Sometimes it finds it, sometimes it doesn't. Therefore, I generally abandoned the imap_search function and search locally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question