import poplib
import getpass
mServer = poplib.POP3('mail.sfcn.org')
mServer.user(getpass.getuser())
mServer.pass_(getpass.getpass())
numMessages = len(mServer.list()[1])
print "You have %d messages." % (numMessages)
for mList in range(numMessages) :
for msg in mServer.retr(mList+1)[1]:
if msg.startswith('Subject'):
print msg
break
mServer.quit()
|