Skip to content Skip to sidebar Skip to footer

Obtain Partial Imap Text Part

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. As in, for example, the GMail lis

Solution 1:

there exists a raw fetch command defined in IMAP RFC.

FETCH 2 (BODY[]<0.size>)

for example if you want to fetch first 100 bytes of mail then you can fire the command as

FETCH 2 (BODY[]<0.100>)

Solution 2:

If you really want to fetch the beginning of the first textual part of a message, you will have to parse the BODYSTRUCTURE. After you obtain the part ID of the desired textual part, use the BODY[number]<0.size> syntax.

The suggestion given in the other answer will fail on multipart messages (like if you have a text/plain and text/html, which is most common format today.

Post a Comment for "Obtain Partial Imap Text Part"