Python 操作 Outlook 邮箱
2021-02-03 10:16
标签:com def mod str out list() 内容 cli strong import datetime namespace = win32com.client.Dispatch(‘Outlook.Application‘).GetNamespace(‘MAPI‘) def folderlist(): if name == ‘main‘: Python 操作 Outlook 邮箱 标签:com def mod str out list() 内容 cli strong 原文地址:https://blog.51cto.com/plking/2491492
import win32com.client
import win32com.client as win32
for i in range(50):
try:
print(i,namespace.GetDefaultFolder(i).Name)
except:
pass
#打印所有邮箱组
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 + ‘"‘)
文章标题:Python 操作 Outlook 邮箱
文章链接:http://soscw.com/index.php/essay/50371.html