@@ -159,7 +159,7 @@ foreach($aFolder as $oFolder){
159159
160160 //Get all Messages of the current Mailbox $oFolder
161161 /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
162- $aMessage = $oFolder->getMessages ();
162+ $aMessage = $oFolder->messages()->all()->get ();
163163
164164 /** @var \Webklex\IMAP\Message $oMessage */
165165 foreach($aMessage as $oMessage){
@@ -205,10 +205,22 @@ Search for specific emails:
205205``` php
206206/** @var \Webklex\IMAP\Folder $oFolder */
207207
208+ //Get all messages
209+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
210+ $aMessage = $oFolder->query()->all()->get();
211+
212+ //Get all messages from
[email protected] 213+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
214+ $aMessage = $oFolder->query()->from('
[email protected] ')->get();
215+
208216//Get all messages since march 15 2018
209217/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
210218$aMessage = $oFolder->query()->since('15.03.2018')->get();
211219
220+ //Get all messages within the last 5 days
221+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
222+ $aMessage = $oFolder->query()->since(now()->subDays(5))->get();
223+
212224//Get all messages containing "hello world"
213225/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
214226$aMessage = $oFolder->query()->text('hello world')->get();
@@ -220,12 +232,24 @@ $aMessage = $oFolder->query()->unseen()->text('hello world')->get();
220232//Extended custom search query for all messages containing "hello world" and have been received since march 15 2018
221233/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
222234$aMessage = $oFolder->query()->text('hello world')->since('15.03.2018')->get();
223- $aMessage = $oFolder->search()->text('hello world')->since('15.03.2018')->get();
224- $aMessage = $oFolder->messages()->text('hello world')->since('15.03.2018')->get();
225235
226236$aMessage = $oFolder->query()->Text('hello world')->Since('15.03.2018')->get();
237+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
227238$aMessage = $oFolder->query()->whereText('hello world')->whereSince('15.03.2018')->get();
239+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
228240$aMessage = $oFolder->query()->where([['TEXT', 'Hello world'], ['SINCE', \Carbon::parse('15.03.2018')]])->get();
241+ ```
242+
243+ Available search aliases for a better code reading:
244+ ``` php
245+ // Folder::search() is just an alias for Folder::query()
246+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
247+ $aMessage = $oFolder->search()->text('hello world')->since('15.03.2018')->get();
248+
249+ // Folder::messages() is just an alias for Folder::query()
250+ /** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
251+ $aMessage = $oFolder->messages()->text('hello world')->since('15.03.2018')->get();
252+
229253```
230254All available query / search methods can be found here: [ Query::class] ( src/IMAP/WhereQuery.php )
231255
@@ -338,15 +362,23 @@ $aMessage = $oFolder->query()->whereText('Hello world')->setFetchBody(false)->ge
338362$aMessage = $oFolder->query()->whereAll()->setFetchBody(false)->setFetchAttachment();
339363```
340364
341- Fetch messages without body and attachment fetching (decrease load):
365+ Fetch messages without body, flag and attachment fetching (decrease load):
342366``` php
343367/** @var \Webklex\IMAP\Folder $oFolder */
344368
345369/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
346- $aMessage = $oFolder->query()->whereText('Hello world')->setFetchBody(false)->setFetchAttachment(false)->get();
370+ $aMessage = $oFolder->query()->whereText('Hello world')
371+ ->setFetchFlags(false)
372+ ->setFetchBody(false)
373+ ->setFetchAttachment(false)
374+ ->get();
347375
348376/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
349- $aMessage = $oFolder->query()->whereAll()->setFetchBody(false)->setFetchAttachment(false)->get();
377+ $aMessage = $oFolder->query()->whereAll()
378+ ->setFetchFlags(false)
379+ ->setFetchBody(false)
380+ ->setFetchAttachment(false)
381+ ->get();
350382```
351383
352384#### Specials
@@ -423,7 +455,7 @@ if you're just wishing a feature ;)
423455| restore | | | Restore a deleted Message |
424456| copy | string $mailbox, int $options | | Copy the current Messages to a mailbox |
425457| move | string $mailbox, int $options | | Move the current Messages to a mailbox |
426- | getContainingFolder | Folder or null $folder | null | Folder | Get the folder containing the message |
458+ | getContainingFolder | Folder or null $folder | Folder or null | Get the folder containing the message |
427459| moveToFolder | string $mailbox, int $options | | Move the Message into an other Folder |
428460| setFlag | string or array $flag | boolean | Set one or many flags |
429461| unsetFlag | string or array $flag | boolean | Unset one or many flags |
0 commit comments