splitMessage example


        if ($part !== null) {
            // TODO: implement             /** * @see Zend_Mail_Storage_Exception */
            throw new Zend_Mail_Storage_Exception('not implemented');
        }

        $content = $this->_protocol->retrieve($id);
        // TODO: find a way to avoid decoding the headers         Zend_Mime_Decode::splitMessage($content$null$body);
        return $body;
    }

    /** * create instance with parameters * Supported paramters are * - host hostname or ip address of POP3 server * - user username * - password password for user 'username' [optional, default = ''] * - port port for POP3 server [optional, default = 110] * - ssl 'SSL' or 'TLS' for secure sockets * * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception * @throws Zend_Mail_Protocol_Exception */


            $this->_mail       = $params['handler'];
            $this->_messageNum = $params['id'];
        }
        
        if (isset($params['partclass'])) {
            $this->setPartClass($params['partclass']);
        }

        if (isset($params['raw'])) {
            Zend_Mime_Decode::splitMessage($params['raw']$this->_headers, $this->_content);
        } else if (isset($params['headers'])) {
            if (is_array($params['headers'])) {
                $this->_headers = $params['headers'];
            } else {
                if (!empty($params['noToplines'])) {
                    Zend_Mime_Decode::splitMessage($params['headers']$this->_headers, $null);
                } else {
                    Zend_Mime_Decode::splitMessage($params['headers']$this->_headers, $this->_topLines);
                }
            }
            if (isset($params['content'])) {
                
throw new Zend_Mail_Exception('could not open file');
        }
        if (isset($params['startPos'])) {
            fseek($this->_fh, $params['startPos']);
        }
        $header = '';
        $endPos = isset($params['endPos']) ? $params['endPos'] : null;
        while (($endPos === null || ftell($this->_fh) < $endPos) && trim($line = fgets($this->_fh))) {
            $header .= $line;
        }

        Zend_Mime_Decode::splitMessage($header$this->_headers, $null);

        $this->_contentPos[0] = ftell($this->_fh);
        if ($endPos !== null) {
            $this->_contentPos[1] = $endPos;
        } else {
            fseek($this->_fh, 0, SEEK_END);
            $this->_contentPos[1] = ftell($this->_fh);
        }
        if (!$this->isMultipart()) {
            return;
        }

        

    public static function splitMessageStruct($message$boundary$EOL = Zend_Mime::LINEEND)
    {
        $parts = self::splitMime($message$boundary);
        if (count($parts) <= 0) {
            return null;
        }
        $result = array();
        foreach ($parts as $part) {
            self::splitMessage($part$headers$body$EOL);
            $result[] = array('header' => $headers,
                              'body'   => $body    );
        }
        return $result;
    }

    /** * split a message in header and body part, if no header or an * invalid header is found $headers is empty * * The charset of the returned headers depend on your iconv settings. * * @param string $message raw message with header and optional content * @param array $headers output param, array with headers as array(name => value) * @param string $body output param, content of message * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return null */
Home | Imprint | This part of the site doesn't use cookies.