import getpass, poplib, sys, emailhost = "server.com"user = "userName"dest = "address"passwd = "password"destfd = open(dest, "at")p = poplib.POP3(host)try: p.user(user) p.pass_(passwd)except poplib.error_proto, e: print e sys.exit(1)for item in p.list()[1]: number, octets = item.split(' ') print "Downloading message %s (%s bytes)" % (number, octets) lines = p.retr(number)[1] msg = email.message_from_string("n".join(lines)) destfd.write(msg.as_string(unixfrom = 1))p.quit()destfd.close()
Name (required)
email (will not be published) (required)
Website