_messageClass example


    public function getMessage($id)
    {
        $data = $this->_protocol->fetch(array('FLAGS', 'RFC822.HEADER')$id);
        $header = $data['RFC822.HEADER'];

        $flags = array();
        foreach ($data['FLAGS'] as $flag) {
            $flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag;
        }

        return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $header, 'flags' => $flags));
    }

    /* * Get raw header of message or part * * @param int $id number of message * @param null|array|string $part path to part or null for messsage header * @param int $topLines include this many lines with header (after an empty line) * @param int $topLines include this many lines with header (after an empty line) * @return string raw header * @throws Zend_Mail_Protocol_Exception * @throws Zend_Mail_Storage_Exception */

    public function getMessage($id)
    {
        $bodyLines = 0;
        $message = $this->_protocol->top($id$bodyLines, true);

        return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message,
                                              'noToplines' => $bodyLines < 1));
    }

    /* * Get raw header of message or part * * @param int $id number of message * @param null|array|string $part path to part or null for messsage header * @param int $topLines include this many lines with header (after an empty line) * @return string raw header * @throws Zend_Mail_Protocol_Exception * @throws Zend_Mail_Storage_Exception */

    public function getMessage($id)
    {
        // TODO that's ugly, would be better to let the message class decide         if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) {
            // TODO top/body lines             $messagePos = $this->_getPos($id);
            return new $this->_messageClass(array('file' => $this->_fh, 'startPos' => $messagePos['start'],
                                                  'endPos' => $messagePos['end']));
        }

        $bodyLines = 0; // TODO: need a way to change that
        $message = $this->getRawHeader($id);
        // file pointer is after headers now         if ($bodyLines) {
            $message .= "\n";
            while ($bodyLines-- && ftell($this->_fh) < $this->_positions[$id - 1]['end']) {
                $message .= fgets($this->_fh);
            }
/** * Fetch a message * * @param int $id number of message * @return Zend_Mail_Message_File * @throws Zend_Mail_Storage_Exception */
    public function getMessage($id)
    {
        // TODO that's ugly, would be better to let the message class decide         if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) {
            return new $this->_messageClass(array('file'  => $this->_getFileData($id, 'filename'),
                                                  'flags' => $this->_getFileData($id, 'flags')));
        }

        return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id),
                                              'flags'   => $this->_getFileData($id, 'flags')));
    }

    /* * Get raw header of message or part * * @param int $id number of message * @param null|array|string $part path to part or null for messsage header * @param int $topLines include this many lines with header (after an empty line) * @return string raw header * @throws Zend_Mail_Storage_Exception */
Home | Imprint | This part of the site doesn't use cookies.