祝读者大人圣诞快乐^_^
工作交接,需要把一些处理过的邮件记录到数据库里面,需要记录的内容包括:附件Excel文件中的每一条记录
提报人
生效时间
其中附件和提报人希望能从Foxmail导出的邮件中读出来。
2020-12-25更新:https://blog.csdn.net/weixin_44702836/article/details/105429726blog.csdn.net
在CSDN上找到一个例子(地址如上)。
import eml_parser
import os
with open("D:\\*******.eml", 'rb') as f:
a = f.read()
eml = eml_parser.eml_parser.decode_email_b(a, True, True)
print(eml["header"])
eml["header"]的输出如下,如果需要带姓名的邮箱,就要用print(eml["header"]['header']['from']):
'subject': '******7.28',
'from': '[email protected]',
'to': ['[email protected]', '[email protected]'],
'cc': ['[email protected]', '[email protected]', 'm@