Thanks to several users on here, I now am able to connect to the server via IMAP and download all of the unread messages. The problem, however, is that themessages are not in a readable form. Do I need to figure out a way to render the HTML in my application?
Here is my code:
import imaplib
server = imaplib.IMAP4_SSL('imap.gmail.com')
server.login('USER', 'PASS')
server.select('INBOX')
resp, items = server.search(None, "(UNSEEN)")
for mail in items[0].split():
resp, data = server.fetch(mail, '(RFC822)')
body = data[0][1]
print body