Re: [Twisted-Python] ESMTPClient
On Thu, 11 Mar 2004 16:33:35 +0100, "Koen Van Herck" <koen_van_herck@yahoo.com> wrote:
Does anyone have an example of using twisted.protocols.smtp.ESMTPClient ? I.e., I would like to write a client for sending mail to an SMTP server which requires authentication.
ESMTPClient (along with several other client implementations in Twisted) supports authentication by allowing you to specify a dictionary mapping authentication schemes to authentication logic objects. For example, to use only Cram-MD5 authentication from twisted.protocols import smtp from twisted.protocols.imap4 import CramMD5ClientAuthenticator class ESMTPClientFactory(protocol.ClientFactory): def __init__(self, *a, **kw): self.a, self.kw = a, kw def buildProtocol(self, addr): p = smtp.ESMTPClient('password') p.factory = self p.requireAuthentication = True p.authenticators = {'CRAM-MD5': CramMD5ClientAuthenticator('username')} return p Having had to write out the above, it is even more apparent to me how much work is left to be done on the client side of many of our protocol implementations. The code is untested; please let me know if you run into any problems with it. Jp
participants (1)
-
exarkun@divmod.com