Beispiel #1
0
 if label in exclude: continue
 if mailbox is None:
     mailbox = ImapMailbox((server, label))
 else:
     mailbox.switch(label)
 if options.search == '':
     uids = mailbox.get_all_uids()
 else:
     uids = mailbox.search(options.search)
 for uid in uids:
     if record.has_key("%s.%s" % (label, uid)):
         if options.verbose: print "Skip %s.%s" % (label, uid)
         continue
     try:
         size = mailbox.get_size(uid)
         message = mailbox.get(uid)
     except Exception, errormessage:
         record_file.flush()
         if options.raise_exception: raise
         print "Skipped %s.%s due to Exception: %s" \
             % (label, uid, errormessage)
         try:
             mailbox.reconnect()
         except:
             mailbox = ImapMailbox((server.clone(), label))
         continue
     if message.size != size:
         errormessage = "Expected to download %s bytes. " % size
         errormessage += "Downloaded %s bytes. " % message.size
         # retry
         try: