Jul-15-2019, 10:05 AM
(Jul-13-2019, 05:29 PM)micseydel Wrote: Can you re-frame your question with 5-10 lines of code (in code tags) along with any instructions for how to get the code to reproduce the problem?
Sure
For imap initialization
def imap_init(): """ Initialize IMAP connection """ print("Initializing IMAP... ") global i i = imapclient.IMAPClient(imapserver, ssl_context=ssl_context) c = i.login(radr, pwd) i.select_folder("INBOX", readonly=True) print("Done. ")for fetch unread emails
def get_unread(): global i uids = i.search(['UNSEEN']) if not uids: return None else: print("Found %s unreads" % len(uids)) return i.fetch(uids, ['BODY[]', 'FLAGS'])