Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/acucchieri/php-imap


https://github.com/acucchieri/php-imap

Last synced: 11 days ago
JSON representation

Awesome Lists containing this project

README

        

php-imap
========

An object oriented PHP IMAP library.

PHP >= 8.1 is required for version 2.x. For PHP 7 or earlier, use version 1.x.

Installation
------------

```
composer require acucchieri/php-imap
```

Usage
-----

``` php
'imap-server.domain.tld', // Hostname. Required
'port' => 143, // Host port. Default : 143
'folder' => 'INBOX', // Mailbox name. Default : 'INBOX'
'user' => 'user-login', // Login. Required
'password' => 'user-password', // Password. Required
'flags' => [], // Connection flags. Optionnal
'lazy' => false, // Lazy mode. Default : false
]);

/** @var \AC\Imap\Collection\MessageCollection $result */
$result = $imap->search('FROM "[email protected]"');

foreach ($result as $message) {
/** @var \AC\Imap\Message $message */
var_dump($message->getSubject());
}
```

Tests
-----

Create phpunit.xml file based on phpunit.xml.dist and populate environment variables.

```
./vendor/bin/phpunit
```