Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sazanov committed Aug 11, 2023
1 parent 7fd2fce commit dda69ef
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,48 @@ $paginator = new \Sazanof\PhpImapSockets\Models\Paginator($uids, $mailbox, 1, 6)
$messagesPaginated = $p->messages();
```

### Attachments

```php
/** @var \Sazanof\PhpImapSockets\Models\Message $message **/
$attachmentsParts = $message->getBodyStructure()->getAttachmentParts();
foreach ($attachmentsParts as $attachmentsPart) {
if (!$attachmentsPart->isInline()) {
// set attachment content to $attachmentsPart
$attachmentsPart->setContent(
$message->getAttachment($attachmentsPart->getSection()) // or save locally
);
}
}
```

### Text content of message

```php
/** @var \Sazanof\PhpImapSockets\Models\Message $message **/
//get text parts (plain,html) with inline images
$message->getBodyStructure()->getTextParts();
```

### Flags management

```php
use \Sazanof\PhpImapSockets\Models\Message;

//$message
$message->setImportant()->markAsDeleted();
//or
$message->addFlags(['one','two'])
//or
$message->replaceFlags(['one','two'])
//or
$message->clearFlags()
//or
$message->deleteFlags('one');
//trigger save
$message->saveFlags();
```

## Authors

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

0 comments on commit dda69ef

Please sign in to comment.