栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Microsoft Outlook创建规则运行应用程序/脚本Python

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Microsoft Outlook创建规则运行应用程序/脚本Python

如果您可以简单地从python完成所有操作,为什么要在Outlook中创建运行脚本的规则(如果收到电子邮件)。

使用Python监视所有传入电子邮件的外观,然后执行某些代码(如果可以接收到主题为%BLAHBLAH%的电子邮件)。这是一个例子:

import win32com.clientimport pythoncomimport reclass Handler_Class(object):    def onNewMailEx(self, receivedItemsIDs):        # RecrivedItemIDs is a collection of mail IDs separated by a ",".        # You know, sometimes more than 1 mail is received at the same moment.        for ID in receivedItemsIDs.split(","): mail = outlook.Session.GetItemFromId(ID) subject = mail.Subject try:     # Taking all the "BLAHBLAH" which is enclosed by two "%".      command = re.search(r"%(.*?)%", subject).group(1)     print command # Or whatever pre you wish to execute. except:     passoutlook = win32com.client.DispatchWithEvents("Outlook.Application", Handler_Class)#and then an infinit loop that waits from events.pythoncom.PumpMessages()


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/639970.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号