specific mail search python unseen since t

Solutions on MaxInterview for specific mail search python unseen since t by the best coders in the world

showing results for - "specific mail search python unseen since t"
Juan Diego
16 Aug 2019
1 import imaplib,time
2 T=time.time()
3 M=imaplib.IMAP4_SSL("imap.gmail.com")
4 M.login(user,psw)
5 M.select() 
6 typ, data = M.search(None, 'UNSEEN SINCE T')
7 for num in string.split(data[0]):
8    try :
9       typ, data=M.fetch(num,'(RFC822)')
10       msg=email.message_from_string(data[0][1])
11       print msg["From"]
12       print msg["Subject"]  
13       print msg["Date"]  
14   except Exception,e:
15      print "hello world"
16M.close()
17M.logout()
18