Beispiel #1
0
def fetch_by_keyword(kwd):
    c = imap_utils.open_connection(hostn, uname, psswd, verbose=True)
    messages = imap_utils.getMsgs(c, keyword=kwd)
    filenames = []
    for msg in messages:
        filenames += fetch_attachments(msg)
    c.logout()
    return filenames
Beispiel #2
0
def fetch_latest_unread():
    c = imap_utils.open_connection(hostn, uname, psswd, verbose=False)
    messages = list(imap_utils.getMsgs(c, keyword="CASTp", unread=True))
    filenames = []
    for msg in messages:
        msg_time = email.utils.mktime_tz(email.utils.parsedate_tz(msg["Date"]))
        cur_time = time.time()
        # HACK: a time issue causes CASTp to send messages "from the future".
        #       I use this behavior to detect recently-sent emails.
        if cur_time > msg_time:
            continue
        filenames += fetch_attachments(msg)
    c.logout()
    return filenames
Beispiel #3
0
def poll(keyword, verbose=False):
    c = imap_utils.open_connection(hostn, uname, psswd, verbose=verbose)
    messages = imap_utils.getMsgs(c, keyword=keyword)
    for msg in messages:
        return True
    return False
Beispiel #4
0
data
typ, data = c.search(None, '(TEXT "1eak")')
data
c.close()
c=open_connection(True)
c.select()
typ, data = c.search(None, '(TEXT "1eak")')
data
typ, data = c.search(None, '(TEXT "pockets")')
data
typ, data = c.search(None, '(TEXT "dudermaninan")')
data
typ, data = c.search(None, '(TEXT "duder")')
data
c.close()
c=open_connection(True)
c.select()
typ, data = c.search(None, '(TEXT "dudermaninan")')
data
import imap_utils
import imap_utils
c=open_connection(True)
messages=imap_utils.getMsgs(c, 'duder')
len(messages)
len([ms for ms in messages])
import imap_utils
c.close()
c=open_connection(True)
messages=imap_utils.getMsgs(c, 'duder')
len([ms for ms in messages])