public function getAllEmailAddresses(array $options = null)
    {
        /* Check Options */
        if(!isset($options['getFolders']['separator'])){
            $options['getFolders']['separator'] = '.';
        };
        if(!isset($options['getFolders']['type'])){
            $options['getFolders']['type'] = 1;
        };
        if(!isset($options['mark'])){
            $options['mark'] = 'SEEN';
        };

        $saveCurrentFolder = $this->folder;
        $emails = array();
        foreach($this->getFolders($options['getFolders']['separator'], $options['getFolders']['type']) as $folder) {
            $this->selectFolder($folder);
            /**
             * @var $message IncomingMessage
             */
            foreach($this->getMessages() as $message) {
                $emails[] = $message->header->from;
                $emails = array_merge($emails, $message->header->to);
                if (isset($message->header->details->cc)) {
                    $emails = array_merge($emails, $message->header->details->cc);
                };
                if(isset($options['mark']) && $options['mark'] == 'UNSEEN'){
                    $this->setUnseenMessage($message->header->msgno);
                };
            }
        }
        $this->selectFolder($saveCurrentFolder);
        return array_unique($emails);
    }
public function getAllEmailAddresses(array $options = null)
    {
        /* Check Options */
        if(!isset($options['getFolders']['separator'])){
            $options['getFolders']['separator'] = '.';
        };
        if(!isset($options['getFolders']['type'])){
            $options['getFolders']['type'] = 1;
        };
        if(!isset($options['mark'])){
            $options['mark'] = 'SEEN';
        };

        $saveCurrentFolder = $this->folder;
        $emails = array();
        foreach($this->getFolders($options['getFolders']['separator'], $options['getFolders']['type']) as $folder) {
            $this->selectFolder($folder);
            /**
             * @var $message IncomingMessage
             */
            foreach($this->getMessages() as $message) {
                $emails[] = $message->header->from;
                $emails = array_merge($emails, $message->header->to);
                if (isset($message->header->details->cc)) {
                    $emails = array_merge($emails, $message->header->details->cc);
                };
                if(isset($options['mark']) && $options['mark'] == 'UNSEEN'){
                    $this->setUnseenMessage($message->header->msgno);
                };
            }
        }
        $this->selectFolder($saveCurrentFolder);
        return array_unique($emails);
    }
public function getAllEmailAddresses ( array $ options = null ) { /* Check Options */ if ( ! isset ( $ options [ 'getFolders' ] [ 'separator' ] ) ) { $ options [ 'getFolders' ] [ 'separator' ] = '.' ; } ; if ( ! isset ( $ options [ 'getFolders' ] [ 'type' ] ) ) { $ options [ 'getFolders' ] [ 'type' ] = 1 ; } ; if ( ! isset ( $ options [ 'mark' ] ) ) { $ options [ 'mark' ] = 'SEEN' ; } ; $ saveCurrentFolder = $ this -> folder ; $ emails = array ( ) ; foreach ( $ this -> getFolders ( $ options [ 'getFolders' ] [ 'separator' ] , $ options [ 'getFolders' ] [ 'type' ] ) as $ folder ) { $ this -> selectFolder ( $ folder ) ; /**
             * @var $message IncomingMessage
             */ foreach ( $ this -> getMessages ( ) as $ message ) { $ emails [ ] = $ message -> header -> from ; $ emails = array_merge ( $ emails , $ message -> header -> to ) ; if ( isset ( $ message -> header -> details -> cc ) ) { $ emails = array_merge ( $ emails , $ message -> header -> details -> cc ) ; } ; if ( isset ( $ options [ 'mark' ] ) && $ options [ 'mark' ] == 'UNSEEN' ) { $ this -> setUnseenMessage ( $ message -> header -> msgno ) ; } ; } } $ this -> selectFolder ( $ saveCurrentFolder ) ; return array_unique ( $ emails ) ; }
Returns all email addresses in all folders

If you have a lot of folders and letters, it can take a long time.
And mark all the letters as read.

@param array|null $options have options:
```php
$options['getFolders']['separator']
$options['getFolders']['type']
$options['mark'] = SEEN and $options['mark'] = UNSEEN
```
@return array with all email addresses or false on error
Returns all email addresses in all folders