0
I’m using the following:
import imaplib
import email
m = imaplib.IMAP4_SSL("imap.gmail.com", 993)
m.login("myemail","mypass")
m.select("Inbox")
result, data = m.uid('search', None, "ALL") # search all email and return uids
if result == 'OK':
for num in data[0].split():
result, data = m.uid('fetch', num, '(RFC822)')
if result == 'OK':
email_message = email.message_from_string(data[0][1]) # raw email text including headers
print 'From:' + email_message['subject']
m.close()
m.logout()
I can only get the Subject from the email, and I want the content of the message. What are the values beyond Subject and from?
Using python 2.7