#!/usr/bin/env python3.6
import datetime, os, imaplib
days = (datetime.date.today() - datetime.timedelta(2)).strftime("%d-%b-%Y")
mailBox = imaplib.IMAP4_SSL("mail.server.ru")
mailBox.login("login","pass")
status, msgs = mailBox.select("INBOX")
assert status == 'OK'
result, data = mailBox.uid('search', None, '(SENTSINCE {date})'.format(date=days))
for uid in data[0].split():
typ, message_data = mailBox.fetch(uid, '(RFC822)')
if message_data is None:
print('Message {mess} is none!'.format(mess=message_data))
continue
mailBox.close()
mailBox.logout()