attributeerror: 'str' object has no attribute 'decode'
# You are trying to decode an object that is already decoded
# You have a str, there is no need to decode from UTF-8 anymore
# Simply drop the part
.decode('utf-8')
attributeerror: 'str' object has no attribute 'decode'
# You are trying to decode an object that is already decoded
# You have a str, there is no need to decode from UTF-8 anymore
# Simply drop the part
.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode' site:stackoverflow.com
import imaplib
from email.parser import HeaderParser
conn = imaplib.IMAP4_SSL('imap.gmail.com')
conn.login('[email protected]', 'password')
conn.select()
conn.search(None, 'ALL')
data = conn.fetch('1', '(BODY[HEADER])')
header_data = data[1][0][1].decode('utf-8')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us