zhangyunhao116 / zmail

Zmail makes it easier to send and retrieve emails in python3
MIT License
433 stars 111 forks source link

使用get_mails(sender='')出现以下错误 #74

Closed gitscamI closed 4 years ago

gitscamI commented 5 years ago

import zmail server =zmail.server("fengfeng@qq.com","sdfsdfrozbdkberi") mail = server.get_mails(sender='PostMaster') Traceback (most recent call last): File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 152, in parse_headers bname, bvalue = line.split(b':', 1) ValueError: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/work/python3/lib/python3.6/site-packages/zmail/server.py", line 166, in get_mails for index, mail_as_bytes in enumerate(mail_as_bytes_list)] File "/work/python3/lib/python3.6/site-packages/zmail/server.py", line 166, in for index, mail_as_bytes in enumerate(mail_as_bytes_list)] File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 464, in parse_mail parsed_mail = parse(lines, debug, log) File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 416, in parse _content_text, _content_html, _attachment = multiple_part_decode(body, boundary, debug, log) File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 285, in multiple_part_decode parsed_part = parse(part, debug, log) # Recursive call File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 407, in parse raw_headers, headers, eof_idx, main_type, sub_type, charsets, extra_kv = parse_headers(lines, debug, log) File "/work/python3/lib/python3.6/site-packages/zmail/parser.py", line 154, in parse_headers raise ParseError('Invalid header:' + str(line)) zmail.exceptions.ParseError: Invalid header:b'\r'

gitscamI commented 5 years ago

上面错误的主要对象是:只要是 qq的退信,就不能正确解析。 正常收到的信不会出错,我用 server.get_mail(index)测试发现以上情况

zhangyunhao116 commented 5 years ago

看样子是QQ的退信不符合邮件协议规范 所以出现解析错误 这个退信通过什么可以复现么?