How to use the imaplib2.IMAP4.abort function in imaplib2

To help you get started, we’ve selected a few imaplib2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goerz / procimap / ProcImap / ProcImap.py View on Github external
self.mailbox.close()
            sys.exit()
        else:
            while True:
                try:
                    unseen_msgs = self.mailbox.get_unseen_uids()
                    if len(unseen_msgs) > 0:
                        self._process_uids(unseen_msgs)
                        self.mailbox.expunge()
                    try:
                        self.mailbox.server.idle(TIMEOUT)
                    except:
                        log("IDLE caused exception. Sleeping for %s seconds" \
                                                                      % TIMEOUT)
                        time.sleep(TIMEOUT)
                except imaplib.IMAP4.abort, data:
                    log("In run(): caught exception: %s" % str(data))
                    self.mailbox.reconnect()
                    log("Reconnected mailbox")
                    # TODO: check if this could end in an infinite try-except
github assembl / assembl / assembl / processes / imaplib2_source_reader.py View on Github external
if not is_ok((search_status,)):
                    raise ReaderError(search_result)
                #print "UID searched with: "+ command + ", got result "+repr(search_status)+" and found "+repr(search_result)
                email_ids = search_result[0].split()

            if len(email_ids):
                print "Processing messages from IMAP: %d "% (len(email_ids))
                for email_id in email_ids:
                    self.import_email(email_id)
                    if self.status != ReaderStatus.READING:
                        break
            else:
                print "No IMAP messages to process"
            self.successful_read()
            self.set_status(ReaderStatus.PAUSED)
        except IMAP4.abort as e:
            raise IrrecoverableError(e)
        except IMAP4.error as e:
            raise ClientError(e)

imaplib2

A threaded Python IMAP4 client.

MIT
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis

Similar packages