Use case is to read email and extract body and other meta data and save it in mongo.
when I execute above line m getting, "2022=\n 15:23" in response. Quotable printable.
when I execute above line m getting, "2022 15:23" in response. Quotable printable is removed.
This is as expected and works locally, when I pass eml file. I am using the later one, "decode=True" on server but it is not decoding quotable printable.
Then I tried above, but still it is not decoding as expected.
Here is entire the script m using in local, running on Jython 2.7.2
msg = email.message_from_file(open("some_eml.eml"))
body = ""
for part in msg.walk():
ctype = part.get_content_type()
cdispo = str(part.get('Content-Disposition'))
if (ctype == 'text/plain' or ctype == 'text/html') and 'attachment' not in cdispo:
body = part.get_content() # decode
body_byte = msg.get_payload()
body = body_byte.decode("utf-8", 'ignore')
utf = quopri.decodestring(body)
text = utf.decode('utf-8', errors='replace')
on server it is same m using without print and necessary boiler plate required for Nifi.
Any help appreciated.