Beispiel #1
0
        imap.logout()

    def imap_get_msg(self, imap, subject):
        for i in range(0, int(self.fetchretries)):
            msgs = imap.search(None, 'SUBJECT', '"%s"' % (subject))
            for msgnum in msgs[1][0].split():
                msg = imap.fetch(msgnum, '(RFC822)')
                msg = msg[1][0][1]
                msg = email.message_from_string(msg)
                if msg['Subject'] == subject:
                    return True

            time.sleep(int(self.fetchwait))

        return False


if len(sys.argv) != 2:
    die("I need a test file!")

try:
    test = RawConfigParser()
    test.read(sys.argv[1])
except ParsingError, e:
    die("Test file error: " + e)

test = MailTest(test)
test.run()