a guest Sep 24th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. result, data = mail.uid('search', None, "UNSEEN")
  2. if result == 'OK':
  3.         print (data[0].split())
  4.         for num in data[0].split():
  5.             try:
  6.                 result, data = mail.uid('fetch', num, '(RFC822)')
  7.                 if result == 'OK':
  8.                     msg = email.message_from_bytes(data[0][1])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand