如何python win32com使用EML文件Open Outlook。附件文件提取和身体内容阅读
Python win32com
使用Open Outlook.Application
。 EML 附件文件提取。并阅读主题和身体内容。使用Python本机包使用。 EML文件格式。
代码
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
msg = outlook.OpenSharedItem("C:\\sample\\todo.eml")
print(msg)
错误
Traceback (most recent call last):
File "init.py", line 4, in <module>
msg = outlook.OpenSharedItem("C:\\sample\\todo.eml")
File "<COMObject GetNamespace>", line 2, in OpenSharedItem
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096,
'Microsoft Outlook', 'Invalid path or URL.', None, 0, -2147352567), None)
python使用EML文件打开Win32COM模块用于使用。 分享的任何想法
python win32com
use open Outlook.Application
. eml attachment files extract. and read subject and body content. use python native package use. eml file format.
Code
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
msg = outlook.OpenSharedItem("C:\\sample\\todo.eml")
print(msg)
error
Traceback (most recent call last):
File "init.py", line 4, in <module>
msg = outlook.OpenSharedItem("C:\\sample\\todo.eml")
File "<COMObject GetNamespace>", line 2, in OpenSharedItem
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096,
'Microsoft Outlook', 'Invalid path or URL.', None, 0, -2147352567), None)
python use eml file open win32com module to use.
any ideas to share
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是有两个原因:
1.-命令:“ Outlook.opensharedItem [...]” 也不能像以前一样在控制台中执行,即使您使用“ CMD”,相同的行也会给您相同的错误。
2.-您在PC上没有安装Outlok(这是执行此类命令所必需的)
It can be for two reasons:
1.- The command: " outlook.OpenSharedItem[...]" cannot be executed in the console as before, even if you use "cmd", this same line will give you the same error.
2.- You do not have Outlok installed on your PC (which is necessary to execute this type of command)