以下代码:
#!/usr/bin/env python
from exchangelib import ServiceAccount, Configuration, Account, DELEGATE
import os
import logging
from config import cfg
logging.basicConfig()
credentials = ServiceAccount(username=cfg['imap_user'],
password=cfg['imap_password'])
config = Configuration(server=cfg['imap_server'], credentials=credentials)
account = Account(primary_smtp_address=cfg['smpt_address'], config=config,
autodiscover=False, access_type=DELEGATE)
unread = account.inbox.filter(is_read=False) # returns unread emails
for msg in unread:
print("last_modified_time={}".format(msg.last_modified_time))
print("datetime_sent ={}".format(msg.datetime_sent))
print("#" * 80)
给我输出
last_modified_time=2017-08-01 09:37:56+00:00
datetime_sent =2017-08-01 09:37:15+00:00
################################################################################
last_modified_time=2017-07-31 14:41:55+00:00
datetime_sent =2017-07-31 14:40:34+00:00
################################################################################
为什么是datetime_sent
之前last_modified_time
?是发件人电子邮件服务器的时间吗(因此可能是任何时间)?接收服务器后来修改了电子邮件吗?如何修改收到的电子邮件?标志修改(例如设置为“读取”)是否也在改变last_modified_time
?