Exemplo n.º 1
0

def done(connection):
    connection.send("DONE\r\n".encode('utf8'))
    connection.loop = False


imaplib.IMAP4.idle = idle
imaplib.IMAP4.done = done

if __name__ == '__main__':
    import os
    from lamson.mail import MailRequest
    user = os.environ['EMAIL']
    password = os.environ['PASSWORD']
    print(os.environ['SERVER'])
    conn = imaplib.IMAP4_SSL(os.environ['SERVER'])
    conn.login(user, password)
    conn.select()
    loop = True
    while loop:
        for uid, msg in conn.idle():
            print(uid, msg)
            if msg == "EXISTS":
                conn.done()
                status, datas = conn.fetch(uid, '(RFC822)')
                m = MailRequest('localhost', None, None, datas[0][1])
                print(m.keys())
                print(m.all_parts())
                print(m.is_bounce())
Exemplo n.º 2
0
        raise Exception("IDLE not handled? : %s" % response)


def done(connection):
    connection.send("DONE\r\n")
    connection.loop = False

imaplib.IMAP4.idle = idle
imaplib.IMAP4.done = done

if __name__ == '__main__':
    import os
    from lamson.mail import MailRequest
    user = os.environ['EMAIL']
    password = os.environ['PASSWORD']
    print os.environ['SERVER']
    conn = imaplib.IMAP4_SSL(os.environ['SERVER'])
    conn.login(user, password)
    conn.select()
    loop = True
    while loop:
        for uid, msg in conn.idle():
            print uid, msg
            if msg == "EXISTS":
                conn.done()
                status, datas = conn.fetch(uid, '(RFC822)')
                m = MailRequest('localhost', None, None, datas[0][1])
                print m.keys()
                print m.all_parts()
                print m.is_bounce()
Exemplo n.º 3
0

def done(connection):
    connection.send("DONE\r\n")
    connection.loop = False


imaplib.IMAP4.idle = idle
imaplib.IMAP4.done = done

if __name__ == '__main__':
    import os
    from lamson.mail import MailRequest
    user = os.environ['EMAIL']
    password = os.environ['PASSWORD']
    print os.environ['SERVER']
    conn = imaplib.IMAP4_SSL(os.environ['SERVER'])
    conn.login(user, password)
    conn.select()
    loop = True
    while loop:
        for uid, msg in conn.idle():
            print uid, msg
            if msg == "EXISTS":
                conn.done()
                status, datas = conn.fetch(uid, '(RFC822)')
                m = MailRequest('localhost', None, None, datas[0][1])
                print m.keys()
                print m.all_parts()
                print m.is_bounce()