[Twisted-Python] Re: Help needed with SmartHostSMTPRelayingManager

James Tanis jtanis at pycoder.org
Thu Dec 1 23:39:22 EST 2005


Alright, I believe I answered my own question. I just need to override
relaymanager.SmartHostSMTPRelayingManager.__init__ and define
self.fArgs there to include the needed arguments.. correct? Just
wondering why this isn't included in the default __init__ if it's
required by the default SMTPClient.__init__

On 12/1/05, James Tanis <jtanis at pycoder.org> wrote:
> Right now I've got this SMTP server that I've slowly been piecing
> together using Twisted 2.1. I was able to get everything working as
> far as local delivery, but after adding a relaymanager.Queue the
> server was able to receive and queue messages from a mail client as
> well as deliver to local accounts. The problem comes in with
> relaymanager.SmartHostSMTPRelayingManager. Here is the log with
> traceback:
>
> 2005/12/01 21:24 EST [-] Log opened.
> 2005/12/01 21:24 EST [-] twistd 2.1.0 (/usr/local/bin/python 2.4.2) starting up
> 2005/12/01 21:24 EST [-] reactor class:
> twisted.internet.selectreactor.SelectReactor
> 2005/12/01 21:24 EST [-] Loading ./h2smtp.py...
> 2005/12/01 21:24 EST [-] Set 71757_1133487291.33_0_138982188 waiting
> 2005/12/01 21:24 EST [-] Set 71757_1133487291.33_0_138982188 waiting
> 2005/12/01 21:24 EST [-] /etc/resolv.conf changed, reparsing
> 2005/12/01 21:24 EST [-] Resolver added ('24.197.160.17', 53) to server list
> 2005/12/01 21:24 EST [-] Resolver added ('24.197.160.18', 53) to server list
> 2005/12/01 21:24 EST [-] twisted.names.dns.DNSDatagramProtocol starting on 62457
> 2005/12/01 21:24 EST [-] Loaded.
> 2005/12/01 21:24 EST [-] twisted.mail.protocols.ESMTPFactory starting on 2500
> 2005/12/01 21:24 EST [-] Starting factory
> <twisted.mail.protocols.ESMTPFactory instance at 0x85b04ec>
> 2005/12/01 21:24 EST [-] twisted.mail.protocols.POP3Factory starting on 1100
> 2005/12/01 21:24 EST [-] Starting factory
> <twisted.mail.protocols.POP3Factory instance at 0x85b052c>
> 2005/12/01 21:24 EST [twisted.names.dns.DNSDatagramProtocol (UDP)]
> Starting factory <twisted.mail.relaymanager.SMTPManagedRelayerFactory
> instance at 0x85fff0c>
> 2005/12/01 21:24 EST [Uninitialized] Traceback (most recent call last):
>          File "/usr/local/lib/python2.4/site-packages/twisted/python/log.py",
> line 58, in callWithLogger
>            return callWithContext({"system": lp}, func, *args, **kw)
>          File "/usr/local/lib/python2.4/site-packages/twisted/python/log.py",
> line 43, in callWithContext
>            return context.call({ILogContext: newCtx}, func, *args, **kw)
>          File "/usr/local/lib/python2.4/site-packages/twisted/python/context.py",
> line 59, in callWithContext
>            return self.currentContext().callWithContext(ctx, func, *args, **kw)
>          File "/usr/local/lib/python2.4/site-packages/twisted/python/context.py",
> line 37, in callWithContext
>            return func(*args,**kw)
>        --- <exception caught here> ---
>          File "/usr/local/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
> line 139, in _doReadOrWrite
>            why = getattr(selectable, method)()
>          File "/usr/local/lib/python2.4/site-packages/twisted/internet/tcp.py",
> line 542, in doConnect
>            self._connectDone()
>          File "/usr/local/lib/python2.4/site-packages/twisted/internet/tcp.py",
> line 545, in _connectDone
>            self.protocol = self.connector.buildProtocol(self.getPeer())
>          File "/usr/local/lib/python2.4/site-packages/twisted/internet/base.py",
> line 669, in buildProtocol
>            return self.factory.buildProtocol(addr)
>          File "/usr/local/lib/python2.4/site-packages/twisted/mail/relaymanager.py",
> line 103, in buildProtocol
>            protocol = self.protocol(self.messages, self.manager, *self.pArgs,
>          File "/usr/local/lib/python2.4/site-packages/twisted/mail/relaymanager.py",
> line 79, in __init__
>            relay.SMTPRelayer.__init__(self, messages, *args, **kw)
>          File "/usr/local/lib/python2.4/site-packages/twisted/mail/relay.py",
> line 108, in __init__
>            smtp.SMTPClient.__init__(self, *args, **kw)
>        exceptions.TypeError: __init__() takes at least 2 arguments (1 given)
>
> 2005/12/01 21:24 EST [Uninitialized] Backing off on delivery of
> ['71757_1133487291.33_0_138982188']
> 2005/12/01 21:24 EST [Uninitialized] Stopping factory
> <twisted.mail.relaymanager.SMTPManagedRelayerFactory instance at
> 0x85fff0c>
>
> From what I can tell smtp.SMTPClient isn't getting passed identity.
> Since this error is generated with a call to the relaying manager's
> .checkState(self) function which only takes self as a argument.. well
> lets just say I can't figure out what I'm missing from my own tracing
> through the code in the relay/relaymanager/smtp modules. You should
> find my code attached, the error should be easily reproducible if you
> want to run it.
>
> --
> James Tanis
> jtanis at pycoder.org
> http://pycoder.org
>
>
>


--
James Tanis
jtanis at pycoder.org
http://pycoder.org




More information about the Twisted-Python mailing list