src/Imap.php
public function setActiveMailbox($mailbox)
    {
        Argument::i()->test(1, 'string');

        if (!$this->socket) {
            $this->connect();
        }

        $response = $this->call('SELECT', $this->escape($mailbox));
        $result = array_pop($response);

        foreach ($response as $line) {
            if (strpos($line, 'EXISTS') !== false) {
                list($star, $this->total, $type) = explode(' ', $line, 3);
            } else if (strpos($line, 'UIDNEXT') !== false) {
                list($star, $ok, $next, $this->next, $type) = explode(' ', $line, 5);
                $this->next = substr($this->next, 0, -1);
            }

            if ($this->total && $this->next) {
                break;
            }
        }

        if (strpos($result, 'OK') !== false) {
            $this->mailbox = $mailbox;

            return $this;
        }

        return false;
    }
public function setActiveMailbox($mailbox)
    {
        Argument::i()->test(1, 'string');

        if (!$this->socket) {
            $this->connect();
        }

        $response = $this->call('SELECT', $this->escape($mailbox));
        $result = array_pop($response);

        foreach ($response as $line) {
            if (strpos($line, 'EXISTS') !== false) {
                list($star, $this->total, $type) = explode(' ', $line, 3);
            } else if (strpos($line, 'UIDNEXT') !== false) {
                list($star, $ok, $next, $this->next, $type) = explode(' ', $line, 5);
                $this->next = substr($this->next, 0, -1);
            }

            if ($this->total && $this->next) {
                break;
            }
        }

        if (strpos($result, 'OK') !== false) {
            $this->mailbox = $mailbox;

            return $this;
        }

        return false;
    }
public function setActiveMailbox ( $ mailbox ) { Argument :: i ( ) -> test ( 1 , 'string' ) ; if ( ! $ this -> socket ) { $ this -> connect ( ) ; } $ response = $ this -> call ( 'SELECT' , $ this -> escape ( $ mailbox ) ) ; $ result = array_pop ( $ response ) ; foreach ( $ response as $ line ) { if ( strpos ( $ line , 'EXISTS' ) !== false ) { list ( $ star , $ this -> total , $ type ) = explode ( ' ' , $ line , 3 ) ; } else if ( strpos ( $ line , 'UIDNEXT' ) !== false ) { list ( $ star , $ ok , $ next , $ this -> next , $ type ) = explode ( ' ' , $ line , 5 ) ; $ this -> next = substr ( $ this -> next , 0 , - 1 ) ; } if ( $ this -> total && $ this -> next ) { break ; } } if ( strpos ( $ result , 'OK' ) !== false ) { $ this -> mailbox = $ mailbox ; return $ this ; } return false ; }
IMAP requires setting an active mailbox
before getting a list of mails

@param string $mailbox Name of mailbox

@return false|Eden\Mail\Imap
IMAP requires setting an active mailbox before getting a list of mails