Skip to content

Commit dda69ef

Browse files
author
Mikhail Sazanov
committed
update README.md
1 parent 7fd2fce commit dda69ef

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,48 @@ $paginator = new \Sazanof\PhpImapSockets\Models\Paginator($uids, $mailbox, 1, 6)
9393
$messagesPaginated = $p->messages();
9494
```
9595

96+
### Attachments
97+
98+
```php
99+
/** @var \Sazanof\PhpImapSockets\Models\Message $message **/
100+
$attachmentsParts = $message->getBodyStructure()->getAttachmentParts();
101+
foreach ($attachmentsParts as $attachmentsPart) {
102+
if (!$attachmentsPart->isInline()) {
103+
// set attachment content to $attachmentsPart
104+
$attachmentsPart->setContent(
105+
$message->getAttachment($attachmentsPart->getSection()) // or save locally
106+
);
107+
}
108+
}
109+
```
110+
111+
### Text content of message
112+
113+
```php
114+
/** @var \Sazanof\PhpImapSockets\Models\Message $message **/
115+
//get text parts (plain,html) with inline images
116+
$message->getBodyStructure()->getTextParts();
117+
```
118+
119+
### Flags management
120+
121+
```php
122+
use \Sazanof\PhpImapSockets\Models\Message;
123+
124+
//$message
125+
$message->setImportant()->markAsDeleted();
126+
//or
127+
$message->addFlags(['one','two'])
128+
//or
129+
$message->replaceFlags(['one','two'])
130+
//or
131+
$message->clearFlags()
132+
//or
133+
$message->deleteFlags('one');
134+
//trigger save
135+
$message->saveFlags();
136+
```
137+
96138
## Authors
97139

98140
- [@sazanof](https://www.github.com/sazanof)

0 commit comments

Comments
 (0)