Вот этот код отображает только новые, т.е. еще не прочитанные, письма
def get_list_mail():
server = imaplib.IMAP4_SSL(server_imap, port_imap)
server.login("*****@mail.ru", password)
server.select()
result, ids = server.search(None, '(UNSEEN)')
print "New emails with your email in TO is %d" % len(ids[0].split())
for id in ids[0].split():
subject = server.fetch(id,
'(BODY.PEEK[HEADER.FIELDS (SUBJECT)])')[1][0][1].strip()
print "\t" + quopri.decodestring(subject.encode('utf-8')).decode('utf-8')
server.close()
server.logout()