Skip to content

Commit 25a8fb6

Browse files
committed
Attachment documentation added
1 parent 45520dc commit 25a8fb6

File tree

1 file changed

+61
-41
lines changed

1 file changed

+61
-41
lines changed

README.md

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Laravel IMAP is an easy way to integrate the native php imap library into your *
1818
- [Client::class](#clientclass)
1919
- [Message::class](#messageclass)
2020
- [Folder::class](#folderclass)
21+
- [Attachment::class](#attachmentclass)
2122
- [MessageCollection::class](#messagecollectionclass)
23+
- [AttachmentCollection::class](#attachmentcollectionclass)
2224
- [Known issues](#known-issues)
2325
- [Milestones & upcoming features](#milestones--upcoming-features)
2426
- [Security](#security)
@@ -164,7 +166,7 @@ $oClient->connect();
164166
/** @var \Webklex\IMAP\Folder $oFolder */
165167
$oFolder = $oClient->getFolder('INBOX.name');
166168

167-
/** @var \Webklex\IMAP\MessageCollection $aMessage */
169+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
168170
$aMessage = $oFolder->getMessages();
169171

170172
/** @var \Webklex\IMAP\Message $oMessage */
@@ -187,7 +189,7 @@ $oClient->connect();
187189
$oFolder = $oClient->getFolder('INBOX.name');
188190

189191
//Get all messages since march 15 2018
190-
/** @var \Webklex\IMAP\MessageCollection $aMessage */
192+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
191193
$aMessage = $oFolder->searchMessages([['SINCE', Carbon::parse('15.03.2018')->format('d M y')]]);
192194

193195
/** @var \Webklex\IMAP\Message $oMessage */
@@ -210,7 +212,7 @@ $oClient->connect();
210212
$oFolder = $oClient->getFolder('INBOX.name');
211213

212214
//Get all messages since march 15 2018
213-
/** @var \Webklex\IMAP\MessageCollection $aMessage */
215+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
214216
$aMessage = $oFolder->searchMessages([['TEXT', 'hello world']]);
215217

216218
/** @var \Illuminate\Pagination\LengthAwarePaginator $paginator */
@@ -243,7 +245,8 @@ Save message attachments:
243245
``` php
244246
/** @var \Webklex\IMAP\Message $oMessage */
245247
$oMessage->getAttachments()->each(function ($oAttachment) use ($oMessage) {
246-
file_put_contents($oAttachment->name, $oAttachment->content);
248+
/** @var \Webklex\IMAP\Attachment $oAttachment */
249+
file_put_contents($oAttachment->getName(), $oAttachment->getContent());
247250
});
248251
```
249252

@@ -258,10 +261,10 @@ $oClient->connect();
258261
/** @var \Webklex\IMAP\Folder $oFolder */
259262
$oFolder = $oClient->getFolder('INBOX.name');
260263

261-
/** @var \Webklex\IMAP\MessageCollection $aMessage */
264+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
262265
$aMessage = $oFolder->searchMessages([['TEXT', 'Hello world']], null, false);
263266

264-
/** @var \Webklex\IMAP\MessageCollection $aMessage */
267+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
265268
$aMessage = $oFolder->getMessages('ALL', null, false);
266269
```
267270

@@ -296,40 +299,40 @@ $aMessage = $oFolder->getMessages('ALL', null, false);
296299
| checkCurrentMailbox | | object | Check current mailbox |
297300

298301
### [Message::class](src/IMAP/Message.php)
299-
| Method | Arguments | Return | Description |
300-
| --------------- | ----------------------------- | :---------: | -------------------------------------- |
301-
| parseBody | | Message | Parse the Message body |
302-
| delete | | | Delete the current Message |
303-
| restore | | | Restore a deleted Message |
304-
| copy | string $mailbox, int $options | | Copy the current Messages to a mailbox |
305-
| move | string $mailbox, int $options | | Move the current Messages to a mailbox |
306-
| moveToFolder | string $mailbox | | Move the Message into an other Folder |
307-
| setFlag | string or array $flag | boolean | Set one or many flags |
308-
| unsetFlag | string or array $flag | boolean | Unset one or many flags |
309-
| hasTextBody | | | Check if the Message has a text body |
310-
| hasHTMLBody | | | Check if the Message has a html body |
311-
| getTextBody | | string | Get the Message text body |
312-
| getHTMLBody | | string | Get the Message html body |
313-
| getAttachments | | collection | Get all message attachments |
314-
| getClient | | Client | Get the current Client instance |
315-
| getUid | | string | Get the current UID |
316-
| getFetchOptions | | string | Get the current fetch option |
317-
| getMsglist | | integer | Get the current message list |
318-
| getHeaderInfo | | object | Get the current header_info object |
319-
| getHeader | | string | Get the current raw header |
320-
| getMessageId | | integer | Get the current message ID |
321-
| getMessageNo | | integer | Get the current message number |
322-
| getSubject | | string | Get the current subject |
323-
| getDate | | Carbon | Get the current date object |
324-
| getFrom | | array | Get the current from information |
325-
| getTo | | array | Get the current to information |
326-
| getCc | | array | Get the current cc information |
327-
| getBcc | | array | Get the current bcc information |
328-
| getReplyTo | | array | Get the current reply to information |
329-
| getInReplyTo | | string | Get the current In-Reply-To |
330-
| getSender | | array | Get the current sender information |
331-
| getBodies | | mixed | Get the current bodies |
332-
| getRawBody | | mixed | Get the current raw message body |
302+
| Method | Arguments | Return | Description |
303+
| --------------- | ----------------------------- | :------------------: | -------------------------------------- |
304+
| parseBody | | Message | Parse the Message body |
305+
| delete | | | Delete the current Message |
306+
| restore | | | Restore a deleted Message |
307+
| copy | string $mailbox, int $options | | Copy the current Messages to a mailbox |
308+
| move | string $mailbox, int $options | | Move the current Messages to a mailbox |
309+
| moveToFolder | string $mailbox | | Move the Message into an other Folder |
310+
| setFlag | string or array $flag | boolean | Set one or many flags |
311+
| unsetFlag | string or array $flag | boolean | Unset one or many flags |
312+
| hasTextBody | | | Check if the Message has a text body |
313+
| hasHTMLBody | | | Check if the Message has a html body |
314+
| getTextBody | | string | Get the Message text body |
315+
| getHTMLBody | | string | Get the Message html body |
316+
| getAttachments | | AttachmentCollection | Get all message attachments |
317+
| getClient | | Client | Get the current Client instance |
318+
| getUid | | string | Get the current UID |
319+
| getFetchOptions | | string | Get the current fetch option |
320+
| getMsglist | | integer | Get the current message list |
321+
| getHeaderInfo | | object | Get the current header_info object |
322+
| getHeader | | string | Get the current raw header |
323+
| getMessageId | | integer | Get the current message ID |
324+
| getMessageNo | | integer | Get the current message number |
325+
| getSubject | | string | Get the current subject |
326+
| getDate | | Carbon | Get the current date object |
327+
| getFrom | | array | Get the current from information |
328+
| getTo | | array | Get the current to information |
329+
| getCc | | array | Get the current cc information |
330+
| getBcc | | array | Get the current bcc information |
331+
| getReplyTo | | array | Get the current reply to information |
332+
| getInReplyTo | | string | Get the current In-Reply-To |
333+
| getSender | | array | Get the current sender information |
334+
| getBodies | | mixed | Get the current bodies |
335+
| getRawBody | | mixed | Get the current raw message body |
333336

334337
### [Folder::class](src/IMAP/Folder.php)
335338
| Method | Arguments | Return | Description |
@@ -346,7 +349,24 @@ $aMessage = $oFolder->getMessages('ALL', null, false);
346349
| appendMessage | string $message, string $options, string $internal_date | bool | Append a string message to the current mailbox |
347350
| getClient | | Client | Get the current Client instance |
348351

349-
### [MessageCollection::class](src/IMAP/MessageCollection.php)
352+
### [Attachment::class](src/IMAP/Attachment.php)
353+
| Method | Arguments | Return | Description |
354+
| -------------- | ---------- | :------------: | ------------------------------------------------------ |
355+
| getContent | | string or null | Get attachment content |
356+
| getName | | string or null | Get attachment name |
357+
| getType | | string or null | Get attachment type |
358+
| getDisposition | | string or null | Get attachment disposition |
359+
| getContentType | | string or null | Get attachment content type |
360+
| getImgSrc | | string or null | Get attachment image source as base64 encoded data url |
361+
362+
### [MessageCollection::class](src/IMAP/Support/MessageCollection.php)
363+
Extends [Illuminate\Support\Collection::class](https://laravel.com/api/5.4/Illuminate/Support/Collection.html)
364+
365+
| Method | Arguments | Return | Description |
366+
| -------- | --------------------------------------------------- | :------------------: | -------------------------------- |
367+
| paginate | int $perPage = 15, $page = null, $pageName = 'page' | LengthAwarePaginator | Paginate the current collection. |
368+
369+
### [AttachmentCollection::class](src/IMAP/Support/AttachmentCollection.php)
350370
Extends [Illuminate\Support\Collection::class](https://laravel.com/api/5.4/Illuminate/Support/Collection.html)
351371

352372
| Method | Arguments | Return | Description |

0 commit comments

Comments
 (0)