public function readMailbox()
    {
        $msg_cnt = imap_num_msg($this->conn);

        $messages = [];
        for ($i = 1; $i <= $msg_cnt; $i++) {
            $header = imap_headerinfo($this->conn, $i);
            $messages[] = [
                'index'     => trim($header->Msgno),
                'header'    => $header,
                'structure' => imap_fetchstructure($this->conn, $i)
            ];
        }
        $this->messages = $messages;
        return $this->messages;
    }
public function readMailbox()
    {
        $msg_cnt = imap_num_msg($this->conn);

        $messages = [];
        for ($i = 1; $i <= $msg_cnt; $i++) {
            $header = imap_headerinfo($this->conn, $i);
            $messages[] = [
                'index'     => trim($header->Msgno),
                'header'    => $header,
                'structure' => imap_fetchstructure($this->conn, $i)
            ];
        }
        $this->messages = $messages;
        return $this->messages;
    }
public function readMailbox ( ) { $ msg_cnt = imap_num_msg ( $ this -> conn ) ; $ messages = [ ] ; for ( $ i = 1 ; $ i <= $ msg_cnt ; $ i ++ ) { $ header = imap_headerinfo ( $ this -> conn , $ i ) ; $ messages [ ] = [ 'index' => trim ( $ header -> Msgno ) , 'header' => $ header , 'structure' => imap_fetchstructure ( $ this -> conn , $ i ) ] ; } $ this -> messages = $ messages ; return $ this -> messages ; }
Retrieve a list of message in the mailbox.

@return array
Retrieve a list of message in the mailbox .