in a bit of a quandary about an SMTP receiver

Eric S. Johansson esj at
Sun Jul 15 17:38:33 CEST 2007

I have wasted way too much time on this problem already and I'm hoping it's just 
that I'm missing some bit of information somewhere.

I need an SMTP receiver so I can handle filter requests from a postfix mail 
server.  the asyncore version works fine for one request at a time.  This is 
great except I need to process bursts of 10 to 15 request per second and 
individual requests sometimes run 0.5-10 seconds per request.  most of the 
filter work is either network or database query limited so queuing up a bunch of 
requests and handling them in parallel should work fine.

I have tried using a threaded version od but, I'm not convinced it's 
running any more than one thread at a time and properly splitting off threads at 
the right time.  Maybe my test case was inadequate but, high level of no 
confidence there.   If someone can show me that I'm wrong, that would be wonderful.

starting point:

Another recommendation was twisted as a foundation for building a new server but 
it would take me as long to build a new server from scratch using ordinary 
sockets as it would take me to learn how to use twisted.  the documentation 
leads me to two conclusions.  First is that twisted is a career, not something 
for getting a job done.  This is not meant to be disparaging but reflects three 
factors.  A steep learning curve, minimum amount of knowledge necessary to get a 
job done, and persistence of that knowledge once the job is done especially if 
you don't live in the twisted environment all the time.  The second is that for 
someone like me (speech recognition driven) twisted is pain.  Pain, pain, pain 
from way too much hand use caused by bumpy cap names.  normally, this shouldn't 
affect anybody else but for me, it is a serious disincentive.

Having said this, I have no other real objections to twisted and if someone 
wants to help by volunteering to build an SMTP receiver capable of being used as 
postfix filter interface, I would be glad to work with them.

The last option is building a new smtp filter around SocketServer but again, 
there is a serious lack of documentation making it another career option.

I am really stuck.  I can't go forward and there really isn't any other solution 
than I can see.  If there was some way to use the baseline asyncore code to 
handle multiple simultaneous requests, I could just do all my work another 
process but I'm not seeing how I can  context switch between multiple 
connections/connection states using asyncore as it stands today.


More information about the Python-list mailing list