创建Outlook .msg文件的Python脚本 [英] Python Script to Create Outlook .msg File

查看:203
本文介绍了创建Outlook .msg文件的Python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Python创建Outlook .msg文件?我想生成几个.msg文件,但主题行中的数据不同.我找到的所有模块仅用于解析已创建的.msg文件.

Is there a way to create an Outlook .msg file using Python? I want to generate several .msg files but with different data in the subject line. All the modules I have found are only for parsing already created .msg files.

推荐答案

不是直接在Python中,但是您可以从头开始显式创建MSG文件(其格式为

Not directly in Python, but you can either explicitly create an MSG file from the scratch (it format is documented) or use a wrapper like Redemption - it is a regular COM object and can be used in Python using win32com.client.Dispatch. In VB:

  set Session = CreateObject("Redemption.RDOSession")
  set Msg = Session.CreateMessageFromMsgFile("C:\Temp\test.msg")
  Msg.Sent = true
  Msg.Subject = "test"
  Msg.Body = "test body"
  Msg.Save

这篇关于创建Outlook .msg文件的Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆