[Twisted-Python] smtp.SMTP help
greg at digitalinfo.net
Fri Oct 3 13:27:47 EDT 2003
Actually, I tried returning an instance (i.e. "return MyMessage()" )
here on my first shot at this, but I got:
File "/usr/lib/python2.2/site-packages/twisted/protocols/smtp.py", line
self.__messages = [f() for (u, f) in recipients]
exceptions.AttributeError: MyMessage instance has no __call__ method
FYI I'm using Twisted 1.07.
Jp Calderone wrote:
>> def validateTo(self, user):
>> return MyMessage
> You need to return an *instance* here. You probably also want to
>associate the user with the instance, too, since you won't be told again who
>you're delivering for. Changing MyMessage.__init__ to take a user argument
>and returning "MyMessage(user)" might be a good way to go.
> The validateTo and validateFrom methods are your chance to refuse this
>message. "helo" and "origin" identify the source of the message. "user"
>identifies the destination. If any of them are not to your liking, you
>should raise smtp.SMTPBadRcpt or smtp.SMTPBadSender.
More information about the Twisted-Python