[Twisted-Python] [twisted.mail][newbie] return tempfail (4xx) after eomReceived()
Fabio Sangiovanni
sangiovanni at nweb.it
Mon Nov 25 03:06:44 MST 2013
Hi,
thanks for your anwser, and forgive my late follow up.
So, I understand that this feature is currently missing in twisted. I
suppose that the only thing to do in my case is to override the
_messageHandled method, and implement all the logic needed to my
purpose. Is this correct? Are you aware of some technique other people
adopted?
Thanks a lot,
Fabio
On 23/11/13 13:08, exarkun at twistedmatrix.com wrote:
> On 10:36 am, sangiovanni at nweb.it wrote:
>> Hello list,
>>
>> I'm trying to code an SMTP server that stores received messages in a
>> queue (es. RabbitMQ or Redis).
>> I'm figuring out how to do it with Twisted, and so far I managed to
>> print to console the messages the way I want.
>> I'm trying to understand now how to return a tempfail code (4xx) from
>> within eomReceived(), so to simulate (and, in the future, handle)
>> temporary unavailabilities of the queuing system, and thus to
>> delegate to the client the handling/retrying of the delivery (there
>> will be postfix in front of my smtp server, so it will keep the
>> message in its spool).
>> I ended up digging in the code until I found the _messageHandled
>> callback of the SMTP class, that's added to the deferred returned by
>> eomReceived. I admit I'm not very accustomed to deferreds yet, but I
>> can only see 250 and 550 response code inside it. I suspect that I
>> should return the 4xx code in one of the deferred's
>> callbacks/errbacks *before* _messageHandled, but I really can't
>> imagine how. Would you please give me some hints about how to
>> accomplish the task? Am I looking to the right direction at all?
>
> See https://twistedmatrix.com/trac/ticket/4904
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
More information about the Twisted-Python
mailing list