You need to parse and understand the actual structure of the BODYSTRUCTURE response BODYSTRUCTURE , see RFC 3501, p. 56 . Also, do not forget to apply the appropriate Content-Transfer-Encoding (for example, base64 or quoted-printable ) and use the correct encoding of the set (the charset parameter of the Content-Type header of each part of the body). All this information is included in the BODYSTRUCTURE response; refer to the documentation of your library to find out how to access it.
source share