Skip to content

How not to fetch attachments with body #431

Answered by mjs
shoaib30 asked this question in Q&A
Discussion options

You must be logged in to vote

This is completely possible by fetching the BODYSTRUCTURE for each message. This provides details for each part of the email, including the content type for each. Using this you can figure out the parts you're interested in (i.e. the text/plain or text/html parts), compute the part number(s) of interest and then fetch BODY.PEEK[<part number>] to retrieve it.

Relevant parts of IMAP RFC:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shoaib30
Comment options

Answer selected by shoaib30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #429 on March 15, 2021 09:55.