README updated
This commit is contained in:
parent
8860392382
commit
95ee63eeb6
42
README.md
42
README.md
|
@ -8,24 +8,58 @@ Imap
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
To install the package via `composer`, use the following:
|
To install the package via `composer`, use the following:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
composer require clivern/imap
|
composer require clivern/imap
|
||||||
```
|
```
|
||||||
|
This command requires you to have Composer installed globally.
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
After adding the package as a dependency, Please read the following steps:
|
After adding the package as a dependency, Please read the following steps:
|
||||||
|
|
||||||
First configure connection class.
|
### Connect and Authenticate
|
||||||
|
|
||||||
```php
|
```php
|
||||||
include_once dirname(__FILE__) . '/vendor/autoload.php';
|
include_once dirname(__FILE__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
|
||||||
$connection = new Clivern\Imap\Core\Connection("imap.gmail.com", "993", "test@clivern.com", "my_password", "/ssl", "INBOX");
|
$connection = new Clivern\Imap\Core\Connection("imap.gmail.com", "993", "test@clivern.com", "my_password", "/ssl", "INBOX");
|
||||||
$connection->connect();
|
$connection->connect();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Connection Options
|
||||||
|
|
||||||
|
```php
|
||||||
|
#~
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Mailboxes
|
||||||
|
|
||||||
|
Retrieve mailboxes (also known as mail folders) from the mail server and iterate over them:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$mailbox = new Clivern\Imap\MailBox($connection);
|
||||||
|
|
||||||
|
$messages = $mailbox->getMessages();
|
||||||
|
|
||||||
|
foreach ($messages as $message) {
|
||||||
|
echo "Subject: " . $message->header()->get('subject');
|
||||||
|
echo "<br/>";
|
||||||
|
echo $message->body()->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Searching
|
||||||
|
|
||||||
To add custom search
|
To add custom search
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$search = new Clivern\Imap\Core\Search();
|
$search = new Clivern\Imap\Core\Search();
|
||||||
$search->addCondition(new Clivern\Imap\Core\Search\Condition\All());
|
$search->addCondition(new Clivern\Imap\Core\Search\Condition\All());
|
||||||
|
@ -71,6 +105,12 @@ foreach ($messages as $message) {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Messages
|
||||||
|
```php
|
||||||
|
#~
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Misc
|
Misc
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue