Python 操作 Outlook 邮箱
#!/usr/bin/env python
import datetime
import win32com.client
import win32com.client as win32
namespace = win32com.client.Dispatch(‘Outlook.Application‘).GetNamespace(‘MAPI‘)
def folderlist():
for i in range(50):
try:
print(i,namespace.GetDefaultFolder(i).Name)
except:
pass
if name == ‘main‘:
#打印所有邮箱组
folderlist()
folderinbox = namespace.GetDefaultFolder(6).Name# 6-indox,3-delete,4-outbox,5-sent,
print(folderinbox)
inboxmail = namespace.GetDefaultFolder(6) #打印内容 #c01 = inboxmail.Items.Find(r"[Subject]=‘MDB Technical Weekly Meeting‘") #c02 = c01.Body #print(c02) #时间过滤 i = inboxmail.Items.Restrict(r"[LastModificationTime] > ‘28/4/2020‘") print("inbox:",i.Count) #内容过滤 for item in i: if "Done" in item.Body: print("邮件主题是: " + ‘"‘ + item.Subject + ‘"‘)
相关推荐
xiaoying 2020-09-28
dongxurr 2020-08-08
urmsone 2020-08-03
锋锋 2020-07-14
Dxiaoru 2020-07-06
糊一笑 2020-06-27
jackadmi 2020-06-27
lightlanguage 2020-06-13
丽丽 2020-06-11
修炼中的kongkong 2020-06-05
baixiaoshi 2020-06-04
htofly 2020-06-03
austindev 2020-04-29
shushan 2020-05-03
硅步至千里 2020-04-21
haidaoxianzi 2020-04-18
liusaisoso 2020-03-08
guan000 2020-03-07