My Python program is decoding all the receiving emails and forwarding some of them with some conditions.
It seems most of the emails have contents with ASCII characters or base64 encoded characters.
But some of them have contents with quoted-printable (QP) encoded characters.
I can decode QP encoded strings with quopri module.
But how can I check if the content is QP encoded or not?
I want something like:
content = message.get_payload()
if is_qp_encoded(content): # Checking if QP encoded
decoded_string = quopri.decodestring(content)
print(decoded_string.decode('utf-8'))
I am not familiar with Python's email module, but check whether the message or any body part of it has a "Content-Transfer-Encoding" header field with the value "quoted-printable".