Answer the question
In order to leave comments, you need to log in
Why can't I receive mail via imap with the NEW flag?
The essence of the problem is that I can't get a list of letters by the SUBJECT + NEW filter I need. In the case of a bare SUBJECT, imap_search returns all messages except the last one. At what both filters SUBJECT + NEW and SUBJECT + UNSEEN do not work.
$mbox = imap_open("{imap.yandex.ru:993/imap/ssl}INBOX", "[email protected]", "password");
$mails = imap_search($mbox, 'ALL UNSEEN FROM [email protected] SUBJECT "Zdes kusok temy latinicei i s probelami"');
/*Здесь код обработки полученного mails*/
imap_close($mbox);
Answer the question
In order to leave comments, you need to log in
1. try to get emails with a simple request SINCE 20-12-2015 FROM "[email protected]"
further expand if successful
2. if $mails == false print imap_last_error()
3. if the error occurs only when working via cron then log important parts of the code
if(!$mbox = imap_open("{imap.yandex.ru:993/imap/ssl}INBOX", "[email protected]", "password")){
$log->add(' error connection'.imap_last_error());
}
if(!$mails = imap_search($mbox, 'ALL UNSEEN FROM [email protected] SUBJECT "Zdes kusok temy latinicei is problami"')){
$log->add('error'. imap_last_error());
}
$log->add('success:'.count($mails));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question