尝试使用ExchangeLib在过去24小时内退回电子邮件

时间:2019-03-25 20:02:57

标签: python email exchange-server exchangelib

我正在尝试使用ExchangeLib在过去24小时内退回收件箱中的所有电子邮件。我目前已将其设置为返回收件箱中的最新电子邮件,我只需要24小时部分的帮助。这是我到目前为止的内容:

credentials = Credentials('My@email', 'password')
account = Account('My@email', credentials=credentials, autodiscover=True)

for item in account.inbox.all().order_by('-datetime_received')[:1]:
    print(item.subject, item.sender.email_address)

    html = item.unique_body

    soup = BeautifulSoup(html, "html.parser")
    for span in soup.find_all('font'):
        return(item.subject, item.sender.email_address, span.text)

我一直在尝试查找有关此操作的参考,但老实说,我没有找到太多。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您需要在df1字段上添加一个大于过滤器:

datetime_received