Function mail_core::mime::create_structured_random_boundary
source · Expand description
Generate a boundary from a counter, “=_^” and a random sequence of boundary chars.
Usage Note
Be aware that it might be required to quote the boundary.
Implementation Details
The boundary will start with =_^
which is neither valid for base64 nor
quoted-printable encoding followed by a hex repr. of the given count,
a .
and a random sequence of boundary chars.
The boundary will be 66 chars long, this is so that if a boundary parameter is placed on it’s own line it won’t be more then 78 chars. (66 chars boundary,
- 2 chars quotation + 9 chars for ‘boundary=’ + 1 char because of
\r\n<WS>
== 78 chars)
The remaining characters will be picked based one the grammar defined in rfc2046, which relevant part is:
boundary := 0*69<bchars> bcharsnospace
bchars := bcharsnospace / " "
bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
"+" / "_" / "," / "-" / "." /
"/" / ":" / "=" / "?"
Note that ' '
isn’t used for simplicity.