📜  特定的 mail.search python UNSEEN SINCE T - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:12.931000             🧑  作者: Mango

代码示例1
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()