python imaplib search unseen and from code example
Example: specific mail.search python UNSEEN SINCE T
import imaplib,time
T=time.time()
M=imaplib.IMAP4_SSL("imap.gmail.com")
M.login(user,psw)
M.select()
typ, data = M.search(None, 'UNSEEN SINCE T')
for num in string.split(data[0]):
try :
typ, data=M.fetch(num,'(RFC822)')
msg=email.message_from_string(data[0][1])
print msg["From"]
print msg["Subject"]
print msg["Date"]
except Exception,e:
print "hello world"
M.close()
M.logout()