擅长:python、mysql、java
<p>我完成了密码。谢谢你的帮助。</p>
<pre><code>`import sys, win32com.client, datetime
# Connect with MS Outlook - must be open.
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace
("MAPI")
# connect to Sent Items
s = outlook.GetDefaultFolder(5).Items # "5" refers to the sent item of a
folder
#s.Sort("s", true)
# Get yesterdays date for the purpose of getting emails from this date
d = (datetime.date.today() - datetime.timedelta (days=1)).strftime("%d-%m-%
y")
# get the email/s
msg = s.GetLast()
# Loop through emails
while msg:
# Get email date
date = msg.SentOn.strftime("%d-%m-%y")
# Get Subject Line of email
sjl = msg.Subject
# Set the critera for whats wanted
if d == date and msg.Subject.startswith("xx") or msg.Subject.startswith
("yy"):
print("Subject: " + sjl + " Date : ", date)
msg = s.GetPrevious() `
</code></pre>
<p>这很管用。但是,如果没有根据约束找到消息,则不会退出。我试着打破,只是发现一个信息,而不是所有,我想知道是否和如何做一个例外?或者我试试别的d!=它也不起作用的日期(它找不到任何东西)。
我看不出For循环将使用带有msg(字符串)的日期。
我不确定——这里是比金纳:)
?? </p>