Skip to content

Commit

Permalink
More examples added
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Jul 26, 2018
1 parent 2d8e488 commit 881c742
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ $oClient = new Client([
'validate_cert' => true,
'username' => 'username',
'password' => 'password',
'protocol' => 'imap'
]);
/* Alternative by using the Facade
$oClient = Webklex\IMAP\Facades\Client::account('default');
Expand All @@ -163,7 +164,7 @@ foreach($aFolder as $oFolder){

/** @var \Webklex\IMAP\Message $oMessage */
foreach($aMessage as $oMessage){
echo $oMessage->subject.'<br />';
echo $oMessage->getSubject().'<br />';
echo 'Attachments: '.$oMessage->getAttachments()->count().'<br />';
echo $oMessage->getHTMLBody(true);

Expand Down Expand Up @@ -200,6 +201,15 @@ else) and a delimiter which if it isn't set will use the default option configur
$oFolder = $oClient->getFolder('INBOX.name');
```

List all available folders:
``` php
/** @var \Webklex\IMAP\Client $oClient */

/** @var \Webklex\IMAP\Support\FolderCollection $aFolder */
$aFolder = $oClient->getFolders();
```


#### Search for messages
Search for specific emails:
``` php
Expand All @@ -220,6 +230,8 @@ $aMessage = $oFolder->query()->since('15.03.2018')->get();
//Get all messages within the last 5 days
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
$aMessage = $oFolder->query()->since(now()->subDays(5))->get();
//Or for older laravel versions..
$aMessage = $oFolder->query()->since(\Carbon::now()->subDays(5))->get();

//Get all messages containing "hello world"
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
Expand All @@ -229,7 +241,8 @@ $aMessage = $oFolder->query()->text('hello world')->get();
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
$aMessage = $oFolder->query()->unseen()->text('hello world')->get();

//Extended custom search query for all messages containing "hello world" and have been received since march 15 2018
//Extended custom search query for all messages containing "hello world"
//and have been received since march 15 2018
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
$aMessage = $oFolder->query()->text('hello world')->since('15.03.2018')->get();
$aMessage = $oFolder->query()->Text('hello world')->Since('15.03.2018')->get();
Expand Down

0 comments on commit 881c742

Please sign in to comment.