参考链接

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import eml_parser


with open('xxx.eml', 'rb') as fhdl:
raw_email = fhdl.read()

mail = eml_parser.eml_parser.decode_email_b(raw_email, include_raw_body=True)
data = mail['body'][0]

for key, item in data.items():
# print(key, item)
print(key)

print(data['content'])