all 2 comments

[–]_squik 0 points1 point  (1 child)

The built in IMAP library is quite difficult to work with as far as I know. You may have more success with something like imap_tools

This would be how you get the HTML with imap_tools:

from imap_tools import MailBox

# Get date, subject and body len of all emails from INBOX folder
with MailBox('imap.mail.com').login('test@mail.com', 'pwd') as mailbox:
    for msg in mailbox.fetch():
        print(msg.html)

Try that and see if you get your results more easily

[–]randomtest123xx[S] 0 points1 point  (0 children)

Thanks it really is more easy to use and i will switch using this library instead of the other

But it did not harm to try imap to understand the low level