What rules apply to MIME boundary?

The syntax of a boundary is:

 boundary := 0*69<bchars> bcharsnospace
 bchars := bcharsnospace / " "
 bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
                  "+" / "_" / "," / "-" / "." /
                  "/" / ":" / "=" / "?"

And the body of a multipart entity has the syntax (only the important parts):

 multipart-body := [preamble CRLF]
                   dash-boundary transport-padding CRLF
                   body-part *encapsulation
                   close-delimiter transport-padding
                   [CRLF epilogue]
 dash-boundary := "--" boundary
 encapsulation := delimiter transport-padding
                  CRLF body-part
 delimiter := CRLF dash-boundary
 close-delimiter := delimiter "--"

The preceeding -- is mandatory for every boundary used in the message and the trailing -- is mandatory for the closing boundary (close-delimiter). So a multipart body with three body-parts with boundary as boundary can look like this:

--boundary
1. body-part
--boundary
2. body-part
--boundary
3. body-part
--boundary--

Leave a Comment