protected function parseMailHeader($stream, $uid)
    {
        $header = imap_headerinfo($stream, imap_msgno($stream, $uid));

        return [
            'msgNo' => (int) $header->Msgno,
            'subject' => $this->parseSubject($header->subject),
            'date' => $header->udate,
            'to' => isset($header->to)
                ? $this->parseAddress($header->to) : null,
            'cc' => isset($header->cc)
                ? $this->parseAddress($header->cc) : null,
            'bcc' => isset($header->bcc)
                ? $this->parseAddress($header->bcc) : null,
            'sender' => isset($header->sender)
                ? $this->parseAddress($header->sender) : null,
            'from' => isset($header->from)
                ? $this->parseAddress($header->from) : null,
            'replyTo' => isset($header->reply_to)
                ? $this->parseAddress($header->reply_to) : null,
            'recent' => $this->parseFlag('R', $header->Recent),
            'unseen' => $this->parseFlag('U', $header->Unseen),
            'flagged' => $this->parseFlag('F', $header->Flagged),
            'answered' => $this->parseFlag('A', $header->Answered),
            'deleted' => $this->parseFlag('D', $header->Deleted),
            'draft' => $this->parseFlag('X', $header->Draft)
        ];
    }