Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 20f91ec9e2
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 47 lines (33 sloc) 0.964 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
# Pop3 email reader, built as proof of Zawinski's Law. It shows From and Subject
# lines in a cellblock.

import poplib
import re

def maxObject_outlet(col, row, str):
# print('c=%d r=%d: %s' % (col, row, str))
    maxObject.outlet(0, ['set', col, row, str])

def go():
    print(go.pophost)
    print(go.username)
    print(go.password)

    con = poplib.POP3(go.pophost)
    con.user(go.username)
    con.pass_(go.password)

    numMessages = len(con.list()[1])
    print(numMessages)

    for i in range(numMessages):
        for j in con.top(i+1,0)[1]:
            fr = re.findall(r'^From: .*', j)
            su = re.findall(r'^Subject: .*', j)

            if len(fr) != 0:
                maxObject_outlet(0, i, fr[0])

            if len(su) != 0:
                maxObject_outlet(1, i, su[0])

    con.quit()

go.fromIdx = 0
go.subjIdx = 0

def pophost(h):
    go.pophost = h

def username(u):
    go.username = u

def password(p):
    go.password = p
Something went wrong with that request. Please try again.