public static function getRawPartText($text, $type, $id)
    {
        /* Mini-hack to get a blank Horde_Mime part so we can call
         * replaceEOL(). From an API perspective, getRawPartText() should be
         * static since it is not working on MIME part data. */
        $part = new Horde_Mime_Part();
        $rawtext = $part->replaceEOL($text, self::RFC_EOL);

        /* We need to carry around the trailing "\n" because this is needed
         * to correctly find the boundary string. */
        $hdr_pos = self::_findHeader($rawtext, self::RFC_EOL);
        $curr_pos = $hdr_pos + 3;

        if ($id == 0) {
            switch ($type) {
            case 'body':
                return substr($rawtext, $curr_pos + 1);

            case 'header':
                return trim(substr($rawtext, 0, $hdr_pos));
            }
        }

        $hdr_ob = Horde_Mime_Headers::parseHeaders(trim(substr($rawtext, 0, $hdr_pos)));

        /* If this is a message/rfc822, pass the body into the next loop.
         * Don't decrement the ID here. */
        if (($ct = $hdr_ob['Content-Type']) && ($ct == 'message/rfc822')) {
            return self::getRawPartText(
                substr($rawtext, $curr_pos + 1),
                $type,
                $id
            );
        }

        $base_pos = strpos($id, '.');
        $orig_id = $id;

        if ($base_pos !== false) {
            $id = substr($id, $base_pos + 1);
            $base_pos = substr($orig_id, 0, $base_pos);
        } else {
            $base_pos = $id;
            $id = 0;
        }

        if ($ct && !isset($ct->params['boundary'])) {
            if ($orig_id == '1') {
                return substr($rawtext, $curr_pos + 1);
            }

            throw new Horde_Mime_Exception('Could not find MIME part.');
        }

        $b_find = self::_findBoundary(
            $rawtext,
            $curr_pos,
            $ct->params['boundary'],
            $base_pos
        );

        if (!isset($b_find[$base_pos])) {
            throw new Horde_Mime_Exception('Could not find MIME part.');
        }

        return self::getRawPartText(
            substr(
                $rawtext,
                $b_find[$base_pos]['start'],
                $b_find[$base_pos]['length'] - 1
            ),
            $type,
            $id
        );
    }