title: Obtain partial IMAP text part
body: <p>I have an email interface client, and I am using IMAP for my requests. I want to be able to show, in real-time, basic email data, for a list view.</p>
  
  <p>As in, for example, the GMail list  view. For that, I need to do an IMAP request to obtain the subject of all emails, the date of all emails, etc. This works so far.</p>
  
  <p>The problem is, I want to also show the first characters of the body text. If I use the <code>BODYSTRUCTURE</code> call to obtain the index of the <code>text/HTML</code> part it takes too long (for emails with thousands of characters it might take well over a second per email, while using only the subject/date/etc calls takes about 0.02 seconds max.</p>
  
  <p>I tried using the <code>BODY[INDEX]&lt;0.XYZ&gt;</code> bytes where <code>XYZ</code> is the number of the first bytes we want to obtain, but to my dismay, it takes as long as using the <code>BODY[INDEX]</code> call. Sometimes even more.</p>
  
  <p>Is there another way to obtain the first text characters, but in a quick manner? If I want to list 300 emails on my interface I cannot afford to spend 1 second per email just to obtain the first text characters.</p>
  
  <p>I'm using Python with imaplib for this, even though probably not relevant.</p>