-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
from datetime import date,timedelta
from imapclient import IMAPClient
# date_today = date.today()
date_today = date(year=2022, month=6, day=27)
try:
client = IMAPClient(host=cf['pop3_server'])
# with IMAPClient(host=cf['pop3_server']) as client:
client.login(cf['address'], cf['password'])
client.select_folder("INBOX")
messages = client.search("UNSEEN")
# messages = client.search(criteria=[u'SINCE', date_today])
logging.info("邮箱登录成功")
client_data = client.fetch(messages, "RFC822")
# 遍历出所有未读邮件独有的 id 与所有邮件MIME内容
for uid, message_data in client_data.items():
print(uid, message_data) # just only get a month email uid(unread)
except Exception as e:
print('error is {}'.format(e))
Metadata
Metadata
Assignees
Labels
No labels