Entire message fetched when opening an IMAP message
From MozillaZine Knowledge Base
(Redirected from Entire message fetched when opening a IMAP message)
Normally, if you open an IMAP message with an attachment and read just the message, Thunderbird only fetches the headers and message body. This is due to the "MIME Parts On Demand" preferences. However, there are some exceptions that can cause it to fetch most or all of the message.
mail.imap.mime_parts_on_demand defaults to true. It specifies that Thunderbird should analyze the messages headers if the message size is larger than mail.imap.mime_parts_on_demand_threshold , and fetch only the pieces of the message that will be displayed online. It defaults to 30000 (30KB). If View -> Display Attachments Inline is not checked, and Thunderbird fetches an attachment when you open a message then you probably need to tweak the threshold. You want to set it as low as possible, but larger than the size of most message bodies. Keep in mind that you may get a message that has both a plain text and a HTML version of the message body (it would have a Content-Type: multipart/alternative header). If you mainly get small plain text messages 8000 (8KB) works well.
mail.imap.mime_parts_on_demand_max_depth controls how complicated the message structure (how many levels of nested attachments for example) has to be before it reverts to fetching the while message. Normally this setting is a not an issue.
mail.imap.fetch_by_chunks controls whether Thunderbird tries to fetch a message body (or any other MIME body part) in chunks. mail.imap.chunk_size controls the size of the chunk. It currently defaults to 10240 bytes. If you set the chunk size too big, it defeats any attempt to fetch just the message body. One problem with enabling fetching by chunks is it breaks the optimizations built into the TCP/IP protocols, and adds extra overhead as each chunk has to be acknowledged. If tweaking the "MIME Parts On Demand" preferences doesn't help, or if it works but you get poor performance, try disabling fetching by chunks.
You can enable IMAP logging and look in the log file to see exactly what Thunderbird fetches from the IMAP server, and when. That might help you understand which setting is causing it to fetch the attachment.
One bug report reports that some users found mail.imap.mime_parts_on_demand was ignored, but setting mail.server.default.mime_parts_on_demand changed the behavior. If none of this helps enter mime_parts and mail.imap in the filter for the Config editor and see if you can find another preference that might have some effect.
Server specific problems
Gmail's IMAP implementation  originally did not support the IMAP Body Structure message attribute. If it's missing, Thunderbird downloads the entire message. The latest IMAP spec. (RFC 3501) doesn't require that an IMAP server support that feature, but most IMAP servers do. Gmail fixed that problem 25 Jan 2008. You can verify that your email provider supports that feature by enabling IMAP logging and searching for (BODYSTRUCTURE).
Another possibility would be if you were using a Courier IMAP server that defaults to 4 TCP-IP connections per IP address, and you didn't lower the maximum number of server connections to cache accordingly in Thunderbird. See this article for more information.
Message body not downloaded
If you get "This body part will be downloaded on demand." instead of the message body when you open a message Thunderbird for some reason decided it was an attachment, and deferred loading it. Try rebuilding the index (right click on the remote folder, select properties, and press the Rebuild Index button) 
You should only get this message if you have a message with multiple parts. Look at the message source by selecting the message and then pressing Control-U. Find the Content-Type: header near the subject. Look at the first word after Content-Type:. It should start with "multipart" such as Content-Type: multipart/mixed; , Content-Type: multipart/related; or Content-Type: multipart/alternative; and you should find something like This is a multi-part message in MIME format. right after the headers.
Otherwise there is only one MIME section (one body part) so there is nothing to delay downloading. If you see that text and the message has only one body part then you've probably either discovered a bug or the message is corrupt.