[Twisted-Python] POP3 Client

exarkun at divmod.com exarkun at divmod.com
Tue Apr 6 23:51:08 EDT 2004

On Wed, 07 Apr 2004 01:44:37 +0000, "Ofir Reichenberg" <ofir_r at hotmail.com> wrote:
> I've been trying to build a simple POP3 client using Twisted and have had no 
> luck.
> I'm looking for something that retrieves the list of headers waiting on the 
> server.

  There is a much nicer POP3 client class in Quotient (which needs to be folded back into Twisted ... when I get the time).  I highly recommend using it instead:


> It appears that to do that I need to build a POP3 factory based on a domain. 
> How can I build a domain ojbect for a "real" internet domain? (as opposed to 
> a local server)

  I'm not sure what you mean here.  What you want to do is something along these lines:

    from twisted.internet import protocol
    from wherever import POP3Client

    class MyPOP3Client(POP3Client):
        # Override some callbacks, like connectionMade or perhaps serverGreeting

    f = protocol.ClientFactory()
    f.protocol = MyPOP3Client
    from twisted.internet import reactor
    reactor.connectTCP('internet.host.name', 110, f)

  The above can be run just like any other Python program (it won't work, of course, as it is an incomplete example).  As alternatives to the last three lines, you can use twisted.application and the utility program "twistd" instead.


More information about the Twisted-Python mailing list