Reputation: 31
When I try to get emails from server (it's mail.ru) with imap_search, criterion SUBJECT does not work. I still have no success. Criteria like OLD, BEFORE, UNSEEN, UNANSWERED work fine. Email server is mail.ru PHP 8.2 I double-checked the subject text, it is correct. I tried as well to specify subject in English, still no success. I have same issue with FROM criterion.
Perhaps it's because the subject is in Cyrillic, but even if I do this:
imap_search(
imap: $inbox,
criteria: 'SUBJECT "Тест"',
charset: 'UTF-8'
);
This query returns false, even though there is an email with "Тест" subject in the inbox.
Upvotes: 1
Views: 328
Reputation: 10985
Anecdotally, mail.ru
is an incomplete implementation of IMAP and appears not to support text-based searches (though flag based searches work)
That query should work fine on other servers that conform to IMAP. Otherwise you'd need to fetch all the subjects and search them yourself, client-side. With caching, this could be reasonably performant.
Upvotes: 1