src/MailMap/ConnectionFactory.php
public function mailboxes($mailboxSearch = '*', $withConnection = false)
    {
        $connectionString = $this->connectionString();
        $stream = imap_open($connectionString, $this->user, $this->password);
        $mailboxes = imap_list($stream, $connectionString, $mailboxSearch);

        if ($withConnection) {
            return $mailboxes;
        }

        return array_map(function ($mailbox) use ($connectionString) {
            return str_replace($connectionString, '', $mailbox);
        }, $mailboxes);
    }
public function mailboxes($mailboxSearch = '*', $withConnection = false)
    {
        $connectionString = $this->connectionString();
        $stream = imap_open($connectionString, $this->user, $this->password);
        $mailboxes = imap_list($stream, $connectionString, $mailboxSearch);

        if ($withConnection) {
            return $mailboxes;
        }

        return array_map(function ($mailbox) use ($connectionString) {
            return str_replace($connectionString, '', $mailbox);
        }, $mailboxes);
    }
public function mailboxes ( $ mailboxSearch = '*' , $ withConnection = false ) { $ connectionString = $ this -> connectionString ( ) ; $ stream = imap_open ( $ connectionString , $ this -> user , $ this -> password ) ; $ mailboxes = imap_list ( $ stream , $ connectionString , $ mailboxSearch ) ; if ( $ withConnection ) { return $ mailboxes ; } return array_map ( function ( $ mailbox ) use ( $ connectionString ) { return str_replace ( $ connectionString , '' , $ mailbox ) ; } , $ mailboxes ) ; }
Get a list of mailboxes on the mail server.

@param  string $mailboxSearch Pattern from http://php.net/manual/en/function.imap-list.php
@param  bool $withConnection Will strip off connection string from mailboxes by default
@return array List of mailboxes
Get a list of mailboxes on the mail server .