[Stackless] asyncore/chat or stackless for SMTP server?

Bob Ippolito bob at redivi.com
Wed Oct 18 22:40:02 CEST 2006

On 10/18/06, Count László de Almásy <calmasy at gmail.com> wrote:
> Greetings,
> I'm still trying to wrap my head fully around stackless, so bear with
> me if this is a dumb question.  Basically, I'm being tasked to write a
> simple SMTP proxy for my company for incoming mail that answers on
> port 25, performs some rudimentary anti-spam checks, and then forwards
> the connection along to the "real" SMTP server, which may either be
> running on the same machine under a different port, or on different
> host's port 25.  The idea is that this will be the application that
> has direct exposure to the Internet, reject as much obvious spam mail
> as possible, and then let the rest through for the real SMTP server to
> handle.  It must be ultra scalable, supporting upwards of thousands of
> concurrent connections.  For such a task, would stackless be better
> than Python's asyncore/asynchat modules?  If so, why?

If you use stackless, you'll probably have to implement a big chunk of
the networking stack yourself. The advantage is that you can write
more natural code than you would with stock Python.

You might want to look at Twisted, which already has the SMTP protocol
implemented. The callback based coding style doesn't always feel
natural, but it's proven to be robust and scalable and it implements
the protocol you're dealing with. The code would almost certainly be
short with Twisted.

Erlang is a good candidate for something like this too, but that
requires learning a different langauge and paradigm. Bluetail
implemented something kinda like this back in 1999 using Erlang (the
Bluetail Mail Robustifier). I'm not aware of any open source SMTP
server implementations for Erlang, though.

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list