从Outlook邮件文件中读取内容、元数据和附件

outlook-msg的Python项目详细描述


outlook_msg

Build Status

outlook_msg是一个python库,由Hamilton Group处理 用户可以从outlook导出。在使用outlook将数据存档到 格式。例如,在汉密尔顿,我们看到这些文件与我们写的交易有关。如果我们想自动 以一种对最终用户来说最自然的方式处理我们需要从这些文件中提取数据。

这个库是在优秀的compoundfiles库之上构建的,没有 这一切都不可能。

开始

使用pip安装:

pip install outlook_msg

用法

打开电子邮件:

fromoutlook_msgimportMessagewithopen('file.msg')asmsg_file:msg=Message(msg_file)# Contents are the plaintext body of the emailcontents=msg.body# Attachments can be read and saved like sofirst_attachment=msg.attachments[0]withfirst_attachment.open()asattachment_fp,open(first_attachment.filename,'wb')asoutput_fp:output_fp.write(attachment_fp.read())

运行测试

我们使用pytest来运行我们的测试,但是您最好使用tox,这样您就可以对所有的 支持python版本,并将确保一个干净的环境。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何下载多个。java中的PDF文件   linux Java打开文件,形成实际用户主页~/   java如何在时间线内维护TableView选择?   java Hibernate注释@Where vs@WhereJoinTable   Java读/写访问异常FileNotFoundException(访问被拒绝)   继承在Java中是否可以扩展最后一个类?   Android HttpClient使用java使应用程序崩溃。lang.OutOfMemoryError:pthread_create   java为什么即使我在proguardproject中添加了jar文件,也会出现这种错误。txt?   如果添加JButton,swing Java FocusListener和KeyListener将无法工作   java使用solrj检索json格式的SolrDocument   使用Microsoft Visual Studio代码进行Java编程   java NoClassDefFoundError:org/apache/log4j/Logger   哈希集中包含相等对象的java   java中的参数化构造函数是否需要有一个主体?   java类似于NetBeans不必要的代码检测器   Java实践问题   java Blackberry“[projectname].调试文件丢失”和“I/O错误:找不到程序”jar