me at wrote:
>I wonder do they always end ------_=_ ?
>Not as easy for me to figure out.
No. You have to extract the boundary from the MIME header and search for
that, in the specified usage. Or you can cheat.
For example, in one particular MIME mail in my mailbox I see the header
Content-Type: multipart/alternative;
boundary="b1_20eb16834381951dd528290ba6c2fd76"
The usage of this boundary I see just before the headers of a new
section as
--b1_20eb16834381951dd528290ba6c2fd76
(which as I said, you can use to cheat)
and after the last section as
--b1_20eb16834381951dd528290ba6c2fd76--
The "=" is just a very popular character in delimiters because its usage
is restricted in base64 encoding, so the risk of clashes with data is
very low to non-existent, especially in combination with "_".
See the MIME RFCs (RFC2045 and RFC 2046) for the details, in particular,
section 5.1 (Multipart Media Type) in RFC 2046.
http://tools.ietf.org/html/rfc2045
http://tools.ietf.org/html/rfc2046
Some extracts:
The Content-Type field for multipart entities requires one
parameter, "boundary". The boundary delimiter line is then
defined as a line consisting entirely of two hyphen characters
("-", decimal value 45) followed by the boundary parameter
value from the Content-Type header field, optional linear
whitespace, and a terminating CRLF.
The body must then contain one or more body parts, each preceded
by a boundary delimiter line, and the last one followed by a
closing boundary delimiter line.
The boundary delimiter line following the last body part is a
distinguished delimiter that indicates that no further body
parts will follow. Such a delimiter line is identical to the
previous delimiter lines, with the addition of two more hyphens
after the boundary parameter value.
--
Bart.