Python email checker script shows only unread messages, but not ones received since the program was opened -


i'm writing program, , part of check new emails every 10 seconds. fine , shows me unread messages when start program, on next loop doesn't show newly sent messages since program opened. there particular reason, or doing wrong? in advanced!

edit: yes, i've sent messages account in question after program has started, , let sit few minutes, , still nothing

while(1):         time.sleep(10)         print("\n\nrefreshing....")          rv, data = m.search(none, 'unseen') #check new messages, works fine first run          print(rv)         print(data)         if rv != 'ok':             print("no messages found!")             return          num in data[0].split():             print("num: " + str(num))             rv, data = m.fetch(num, '(rfc822)')             if rv != 'ok':                 print("error getting message", num)                 return              msg = email.message_from_bytes(data[0][1])             hdr = email.header.make_header(email.header.decode_header(msg['subject']))             subject = str(hdr)              print('message: %s\n' % (subject))             if "blabla" in subject:                  #do stuff here 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -