Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何检查邮件内容是否引用可打印编码?_Python_Email_Quoted Printable - Fatal编程技术网

Python 如何检查邮件内容是否引用可打印编码?

Python 如何检查邮件内容是否引用可打印编码?,python,email,quoted-printable,Python,Email,Quoted Printable,我的Python程序正在解码所有接收到的电子邮件,并在一定条件下转发其中一些电子邮件 似乎大多数电子邮件的内容都包含ASCII字符或base64编码字符 但其中有些内容包含引用的可打印(QP)编码字符 我可以用模块解码QP编码的字符串 但是如何检查内容是否为QP编码 我想要像这样的东西: content = message.get_payload() if is_qp_encoded(content): # Checking if QP encoded decoded_string =

我的Python程序正在解码所有接收到的电子邮件,并在一定条件下转发其中一些电子邮件

似乎大多数电子邮件的内容都包含ASCII字符或base64编码字符

但其中有些内容包含引用的可打印(QP)编码字符

我可以用模块解码QP编码的字符串

但是如何检查内容是否为QP编码

我想要像这样的东西:

content = message.get_payload()
if is_qp_encoded(content): # Checking if QP encoded
    decoded_string = quopri.decodestring(content)
    print(decoded_string.decode('utf-8'))

我不熟悉Python的电子邮件模块,但请检查消息或其任何正文部分是否有值为“quoted printable”的“Content Transfer Encoding”标题字段