Here is my code:
import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', 'password') conn.select() conn.search(None, 'ALL') data = conn.fetch('1', '(BODY[HEADER])') header_data = data[1][0][1].decode('utf-8')
at this moment i get an error
AttributeError: 'str' object has no attribute 'decode'
Python 3 no longer has decryption, right? How can i fix this?
Also in:
data = conn.fetch('1', '(BODY[HEADER])')
I choose only the first letter. How to choose everything?
user4530588 Feb 18 '15 at 12:20 2015-02-18 12:20
source share