简体   繁体   English

检测发送(或不发送)Python发送的Outlook邮件(使用win32com)

[英]Detect sending (or not) of Outlook mail sent by Python (with win32com)

My overall goal is to send some generated emails via Outlook from Python/win32com ( unfortunately this part isn't really feasible to change ) and the method here works very well: 我的总体目标是通过Outlook从Python / win32com发送一些生成的电子邮件( 遗憾的是这部分不太可能改变 ),这里的方法非常有效:

How do I generate and open an Outlook email with Python (but do not send) 如何使用Python生成和打开Outlook电子邮件(但不发送)

I'm using it to generate the emails, with them showing up via the Outlook UI and then I either send them (possibly with editing) or cancel them (ie do not send). 我用它来生成电子邮件,它们通过Outlook UI显示,然后我发送它们(可能带有编辑)或取消它们(即不发送)。

However there is one limitation and from Googling and tinkering in Python I cannot see what I should do. 然而,有一个限制,从谷歌搜索和修补Python我无法看到我应该做什么。

I would like to be able to programmatically log whether the displayed email was actually sent or cancelled. 我希望能够以编程方式记录显示的电子邮件是否实际发送或取消。

I cannot see any value returned from mail.Display(True) and the mail object itself doesn't show any attributes that look like they indicate what happened. 我看不到mail.Display(True)返回的任何值,并且邮件对象本身没有显示任何看起来像是表明发生了什么的属性。

Is there a way to do this? 有没有办法做到这一点?

MailItem对象将在发送时触发MailItem.Send事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM