@@ -29,8 +29,9 @@ Laravel IMAP is an easy way to integrate the native php imap library into your *
29
29
- [ Attachments] ( #attachments )
30
30
- [ Advanced fetching] ( #advanced-fetching )
31
31
- [ Masking] ( #masking )
32
- - [ Specials ] ( #specials )
32
+ - [ Idle ] ( #idle )
33
33
- [ Events] ( #events )
34
+ - [ Specials] ( #specials )
34
35
- [ Support] ( #support )
35
36
- [ Documentation] ( #documentation )
36
37
- [ Client::class] ( #clientclass )
@@ -552,23 +553,35 @@ Additional examples can be found here:
552
553
- [ Custom attachment mask] ( https://github.com/Webklex/laravel-imap/blob/master/examples/custom_attachment_mask.php )
553
554
554
555
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.
557
559
``` 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);
559
566
```
560
567
561
568
#### Events
562
569
The following events are available:
563
570
- ` Webklex\IMAP\Events\MessageDeletedEvent($message) ` &mdash ; triggered by ` Message::delete `
564
571
- ` Webklex\IMAP\Events\MessageRestoredEvent($message) ` &mdash ; triggered by ` Message::restore `
565
572
- ` 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() `
567
574
568
575
Additional integration information:
569
576
- https://laravel.com/docs/7.x/events#event-subscribers
570
577
- https://laravel.com/docs/5.2/events#event-subscribers
571
578
579
+ #### Specials
580
+ Find the folder containing a message:
581
+ ``` php
582
+ $oFolder = $aMessage->getContainingFolder();
583
+ ```
584
+
572
585
## Support
573
586
If 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 ) .
574
587
However please be aware that it might take some time to get an answer.
@@ -676,6 +689,7 @@ if you're just wishing a feature ;)
676
689
| getSender | | array | Get the current sender information |
677
690
| getBodies | | mixed | Get the current bodies |
678
691
| getRawBody | | mixed | Get the current raw message body |
692
+ | getToken | | string | Get a base64 encoded message token |
679
693
| getFlags | | FlagCollection | Get the current message flags |
680
694
| is | | boolean | Does this message match another one? |
681
695
| getStructure | | object | The raw message structure |
@@ -741,6 +755,7 @@ if you're just wishing a feature ;)
741
755
| bcc | string $value | WhereQuery | Select messages matching a given receiver (BCC:) |
742
756
| count | | integer | Count all available messages matching the current search criteria |
743
757
| 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" |
744
759
| limit | integer $limit, integer $page = 1 | WhereQuery | Limit the amount of messages being fetched |
745
760
| setFetchOptions | boolean $fetch_options | WhereQuery | Set the fetch options |
746
761
| setFetchBody | boolean $fetch_body | WhereQuery | Set the fetch body option |
0 commit comments