Nameless One
Nameless One

Reputation: 1646

IMAP MIME boundary life

Between the RFC for IMAP, the RFC for MIME Format of Internet Message Bodies and the RFC for MIME Media Types I can not see anything explicitly said about the life of MIME boundaries. Does a MIME boundary for a part of a message have to stay unchanged for as long as that message exists?

I have looked at how Clever Internet Suite implemented their IMAP server, and it seems that the boundary is generated (and re-generated) on the fly, i.e. separate commands executed against the same mailbox will get different boundaries for the same parts of the same message. Meaning that if you request the boundary as part of the BODYSTRUCTURE and retrieve the body parts later then you may receive those body parts with different boundaries than indicated in the BODYSTRUCTURE request.

Upvotes: 2

Views: 542

Answers (1)

jstedfast
jstedfast

Reputation: 38643

Does a MIME boundary for a part of a message have to stay unchanged for as long as that message exists?

Yes.

and it seems that the boundary is generated (and re-generated) on the fly, i.e. separate commands executed against the same mailbox will get different boundaries for the same parts of the same message.

That is horribly broken.

Part of the BODYSTRUCTURE response are the Content-Type parameter values of which the boundary is one of them. It cannot go changing between sessions, never mind between commands.

One of the reasons that the boundary cannot simply be regenerated on the fly is that for multipart/signed parts, in order to verify the digital signature, you need to serialize the child tree byte-for-byte exactly the way it was when it got signed originally or, obviously, it will fail to verify.

Upvotes: 3

Related Questions