@@ -29,8 +29,9 @@ Laravel IMAP is an easy way to integrate the native php imap library into your *
2929 - [ Attachments] ( #attachments )
3030 - [ Advanced fetching] ( #advanced-fetching )
3131 - [ Masking] ( #masking )
32- - [ Specials ] ( #specials )
32+ - [ Idle ] ( #idle )
3333 - [ Events] ( #events )
34+ - [ Specials] ( #specials )
3435- [ Support] ( #support )
3536- [ Documentation] ( #documentation )
3637 - [ Client::class] ( #clientclass )
@@ -552,23 +553,35 @@ Additional examples can be found here:
552553- [ Custom attachment mask] ( https://github.com/Webklex/laravel-imap/blob/master/examples/custom_attachment_mask.php )
553554
554555
555- #### Specials
556- Find the folder containing a message:
556+ #### Idle
557+ Use the ` Query::idle() ` function to have an instance running which behaves like an idle imap connection.
558+ The callback and ` Webklex\IMAP\Events\MessageNewEvent($message) ` event get fired by every new incoming email.
557559``` php
558- $oFolder = $aMessage->getContainingFolder();
560+ $timeout = 10;
561+ /** @var \Webklex\IMAP\Folder $folder */
562+ $folder->query()->subject('test')->idle(function($message){
563+ /** @var \Webklex\IMAP\Message $message */
564+ dump("new message", $message->subject);
565+ }, $timeout);
559566```
560567
561568#### Events
562569The following events are available:
563570- ` Webklex\IMAP\Events\MessageDeletedEvent($message) ` &mdash ; triggered by ` Message::delete `
564571- ` Webklex\IMAP\Events\MessageRestoredEvent($message) ` &mdash ; triggered by ` Message::restore `
565572- ` Webklex\IMAP\Events\MessageMovedEvent($old_message, $new_message) ` &mdash ; triggered by ` Message::move `
566- - ` Webklex\IMAP\Events\MessageNewEvent($message) ` &mdash ; not triggered
573+ - ` Webklex\IMAP\Events\MessageNewEvent($message) ` &mdash ; can get triggered by ` Query::idle() `
567574
568575Additional integration information:
569576- https://laravel.com/docs/7.x/events#event-subscribers
570577- https://laravel.com/docs/5.2/events#event-subscribers
571578
579+ #### Specials
580+ Find the folder containing a message:
581+ ``` php
582+ $oFolder = $aMessage->getContainingFolder();
583+ ```
584+
572585## Support
573586If you encounter any problems or if you find a bug, please don't hesitate to create a new [ issue] ( https://github.com/Webklex/laravel-imap/issues ) .
574587However please be aware that it might take some time to get an answer.
@@ -676,6 +689,7 @@ if you're just wishing a feature ;)
676689| getSender | | array | Get the current sender information |
677690| getBodies | | mixed | Get the current bodies |
678691| getRawBody | | mixed | Get the current raw message body |
692+ | getToken | | string | Get a base64 encoded message token |
679693| getFlags | | FlagCollection | Get the current message flags |
680694| is | | boolean | Does this message match another one? |
681695| getStructure | | object | The raw message structure |
@@ -741,6 +755,7 @@ if you're just wishing a feature ;)
741755| bcc | string $value | WhereQuery | Select messages matching a given receiver (BCC:) |
742756| count | | integer | Count all available messages matching the current search criteria |
743757| get | | MessageCollection | Fetch messages with the current query |
758+ | idle | mixed $callback($message), int $timeout = 10 | | Simulate an idle connection to receive new messages "live" |
744759| limit | integer $limit, integer $page = 1 | WhereQuery | Limit the amount of messages being fetched |
745760| setFetchOptions | boolean $fetch_options | WhereQuery | Set the fetch options |
746761| setFetchBody | boolean $fetch_body | WhereQuery | Set the fetch body option |
0 commit comments