[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: A replacement for Fetchmail?



> > A code for sending mail
> > from a smtp server is about 20-40 lines, so fetching mail from a pop3
> > server should not be too big. Anyway, fetchmail's code is always 
> there to
> > guide you :-)

Why reinvent the wheel when you can do:

#!/usr/bin/env python

from poplib import *
if __name__ == "__main__":
        a = POP3(TESTSERVER)
        print a.getwelcome()
        a.user(TESTACCOUNT)
        a.pass_(TESTPASSWORD)
        a.list()
        (numMsgs, totalSize) = a.stat()
        for i in range(1, numMsgs + 1):
                (header, msg, octets) = a.retr(i)
                print "Message ", `i`, ':'
                for line in msg:
                        print '   ' + line
                print '-----------------------'
        a.quit()