Search code examples
phpimapmimemime-mail

How many values can IMAP MIME BODYSTRUCTURE format string be nested?


Is there any way a MIME format string would be nested more than 3 decimal points when retrieving individual parts from an IMAP server? For example, RFC3501 section 6.4.5, pg56, when describing how to parse rfc822 messages from the server, if I want to get the plaintext version of an email from the IMAP server, it's possible (and common when dealing w/rfc822 messages w/attachments) to issue

tag FETCH uid BODY[4.2.2.1]

as rfc822 messages can be nested deeply. So there are 3 decimal points in that format string. My question is, is there any reason, any type of MIME message could look like this?

tag FETCH uid BODY[1.2.3.4.5]

Or is 3 decimal points the maximum amount of nesting possible? I've yet to find so on my tests but before I implement this in my parser I need to know for sure as RFC3501 is not specific about this. If more than 3 decimal points in a MIME format string are possible, what would the BODYSTRUCTURE of said message look like?

Thank you for your time, I look forward to your reply.


Solution

  • I found my answer, while there are no limits in rfc204x nor rfc3501, every mail server I have tried imposes it's own limits as exaggerated MIME nesting seems to be a common way to get around various filters like spam, .exe blocking, etc. "MIME nesting exceeds safety limit" appears to be the popular message to return when sending 15+ levels of decimals.