imap
imap copied to clipboard
Is there any support IMAP IDLE?
Actually, the question in the title is whether it is possible to receive mail in real time using IMAP IDLE?
As far as I know, PHP doesn't provide any idle functionality, does it?
Oh, really?
require 'vendor/autoload.php';
$imap = new \Noi\Util\Mail\ImapIdleClient('your.imap.host', 993);
$imap->login('username', 'password');
$imap->selectMailbox('INBOX');
while (!$imap->idle(300) instanceof \PEAR_Error) {
$mails = $imap->search('UNSEEN');
foreach ($imap->getMessages($mails) as $mail) {
echo '==== New Message ====', "\n";
echo $mail, "\n";
}
}
I found this in another package, but I wonder if you have it :)
That sounds like a sleep call, easy to implement by yourself
Oh, really?
require 'vendor/autoload.php'; $imap = new \Noi\Util\Mail\ImapIdleClient('your.imap.host', 993); $imap->login('username', 'password'); $imap->selectMailbox('INBOX'); while (!$imap->idle(300) instanceof \PEAR_Error) { $mails = $imap->search('UNSEEN'); foreach ($imap->getMessages($mails) as $mail) { echo '==== New Message ====', "\n"; echo $mail, "\n"; } }I found this in another package, but I wonder if you have it :)
hello you can use the search method from 163 email?