'Parse E-Mail as HTML/EML/PDF from IMAPlib python

I would like to somehow parse html code from an specific email using IMAPlib. I started the code by using the basics:

email = "[email protected]"
pw = "Pw"
imap = imaplib.IMAP4_SSL("imap.gmail.com")
imap.login(email, pw)
imap.select('INBOX')
imap.search(None, "SUBJECT", '"Specific Subject"')

basically this returns an ID and I cannot figure out on how to get HTMl code from the body of that UID. Would love to get a little support on that one Cheers



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source