标签:com def mod str out list() 内容 cli strong
#!/usr/bin/env pythonimport 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 + ‘"‘)
标签:com def mod str out list() 内容 cli strong
原文地址:https://blog.51cto.com/plking/2491492