Skip to content

Commit d9cb382

Browse files
committed
Documentation for Client::getFolder added
1 parent 0593812 commit d9cb382

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,30 @@ $oClient = Webklex\IMAP\Facades\Client::account('default');
117117
$oClient->connect();
118118
```
119119

120+
There is an experimental function available to get a Folder instance by name.
121+
For an easier access please take a look at the new config option `imap.options.delimiter` however the `getFolder`
122+
method takes three options: the required (string) $folder_name and two optional variables. An integer $attributes which
123+
seems to be sometimes 32 or 64 (I honestly have no clue what this number does, so feel free to enlighten me and anyone
124+
else) and a delimiter which if it isn't set will use the default option configured inside the [config](src/config/imap.php) file.
125+
``` php
126+
use Webklex\IMAP\Facades\Client;
127+
128+
/** @var \Webklex\IMAP\Client $oClient */
129+
$oClient = Client::account('default');
130+
$oClient->connect();
131+
132+
/** @var \Webklex\IMAP\Folder $oFolder */
133+
$oFolder = $oClient->getFolder('INBOX.name');
134+
135+
//Get all Messages
136+
/** @var \Webklex\IMAP\Message $oMessage */
137+
foreach($oFolder->getMessages() as $oMessage){
138+
echo $oMessage->subject.'<br />';
139+
echo 'Attachments: '.$oMessage->getAttachments()->count().'<br />';
140+
echo $oMessage->getHTMLBody(true);
141+
}
142+
```
143+
120144
You can define your accounts inside the [config/imap.php](src/config/imap.php) file:
121145
```
122146
'accounts' => [

0 commit comments

Comments
 (0)