I am sending an email with an EmailMessage object in a Gmail field.
The subject of the letter looks something like this: u "You have a letter from Daėrius ęėįęėįęįėęįę --- reply3_433441"
When I receive an email while looking at the message information, I see that the Subject line looks like this:
Subject: =? utf-8? b? WW91IGdvdCBhIGxldHRlciBmcm9tIERhxJdyaXVzIMSZxJfEr8SZxJfEr8SZ? = =? UTF-8? B XK / El 8SZxK / EmS0tLXJlcGx5M180MzM0NDE =? =
How to decode this theme?
I have properly decrypted the email body (tex / plain) as follows:
for part in msg.walk():
if part.get_content_type() == 'text/plain':
msg_encoding = part.get_content_charset()
msg_text = part.get_payload().decode('quoted-printable')
msg_text = smart_unicode(msg_text, encoding=msg_encoding, strings_only=False, errors='strict')
source
share