MIME Multipart Messages

Created: 2021-01-23T20:46:58-06:00

Return to the Index

Allows you to stuff more than one payload in to a block of text.

Each payload is noted by a special boundary marker and a new header allowing each payload to have its own meta-data.

I looked this up while thinking of ways to store meta-data for outlines while still being a plain text file.

Example

Header includes these:

MIME-Version: 1.0
Content-type: multipart/mixed; boundary="simple boundary"

Message then looks like this:

preamble, to be ignored but can have text for clients that do not support mime properly


a content chunk

Content-type: application/x-shitpost

another content chunk but with metadata

note the boundary ends with two dashes. postamble, same as preamble

Grammar for boundaries

boundary := 0*69<bchars> bcharsnospace

bchars := bcharsnospace / " "

bcharsnospace :=    DIGIT / ALPHA / "'" / "(" / ")" / "+"  /
"_"
/ "," / "-" / "." / "/" / ":" / "=" / "?"

References

rfc1341 snippet

O'Reilly snippet