Full featured SMTP in Python ?

In a recent post Ian explain he get a lot of trouble w/ the configuration of his mail system. I ran into the same issues a little time ago. Now i’m using postfix and courier-imap and maildrop to dispatch the mail between. This setup is really easy because Postfix just accept incomming mail, and maildrop deliver it in the right imap folders. By this way, i only have to tweak maildrop to add some users. And works fine with virtualhost. In my current setup, i’m using a home-made spambayes deamon (sb_global_server), to spam-tag all incomming mail. (even for virtual host users)

Now, i need to setup a mailing list manager… and issues are back again :( I read the mailman howto, and no, it doesn’t support virtual-hosting out-of-the-box. Play with a bunch of alias? no thanks… I can use another one of course, but intregation w/ postfix is not so-trivial for most of them.

So why not write a full featured SMTP daemon in Py? We will get:

  • a system that can scale easily ..
  • support for most of db-backend without a pain
  • can embed spambayes .. or any other filtering system in only one piece of code ..
  • only one users configuration (not to use LDAP or others to glue..)

Right now, if you want to have a good mail system you need to use a bunch of stuffs, written in a bunch of langage .. and use a bunch of tricks to glue each others… But everybody wants a nice/simple mail system ?



Related Posts

7 thoughts on “Full featured SMTP in Python ?

  1. twisted.mail provide ‘basic’ mail support. I’m looking for something really more full featured.

  2. You should have a look at Quotient (www.divmod.org) which is a full featured web mail server with a lot of other features added.

    Surely you can take out the code you need from Quotient, or, better yet, IMHO, use quotient locally to handle your e-mails.

    It has automatic Mailing Lists and anti-spam filters with postini and spambayes and so on.

    Have a look. BTW It’s based on twisted.mail, and it shouldn’t be hard to write a full featured SMTP daemon with twisted.

  3. Please, let’s not have a bunch of splintered SMTP-in-Python solutions the way we have a bunch of splintered HTTP-in-Python solutions!

    Twisted.mail is utterly devoid of docstrings but seems like a worthy start. Quotient is written by smart people who write nice OOP Python and is based on twisted, which is written by a bunch of smart people who write nice OOP Python. (I wouldn’t dream of writing anything with Python + networking with anything but twisted.)

  4. I dont think youd really want a huge monolithic SMTP server. Ive been thinking about this today after reading your blog, because it seemed like it might be fun (not that I have the time).

    It’s good to use postfix + LDAP + spambayes. Maybe the problem is just that theyre hard to set up and there need to be better support tools?

    This might be a better area to focus on than building a monolithic application which will probably end up less stable and with way more support problems than just properly configuring the current tools available.

    -geoff

  5. The issue is that a normal setup have:

    • postfix or sendmail / qmail
    • courier-imap or imap-uw
    • courier-pop or pop3d ..
    • all variant w/ ssl enable
    • ldap or sql to glue each other

    +:

    • spambayes or spamassassin
    • virus filtering (amavis ?)
    • mailing list manager

    And so on .. The issue is twice:
    - complicated
    - and use a bunch of softs + bunch of glue.

  6. Here’s an example of deploying Quotient (assuming you have installed it already, and I won’t lie, installation can be a slight hassle):

    exarkun@boson:~$ mkdir demo

    exarkun@boson:~$ cd demo

    exarkun@boson:~/demo$ mktap quotient –certificate /tmp/demo_server.pem                       

    exarkun@boson:~/demo$ twistd -f quotient.tap

    exarkun@boson:~/demo$

    Note that by default the server listens on standard ports + 10000 so as to be demoable without root privileges and on a machine running other mail servers.

    This runs a server with pop3, pop3s, imap4, imap4s, smtp, smtps, http, https, and sip.  The server supports spambayes for spam filtering, automatic mailing list filing for several common mailing list types, full text indexing of mail in the system, “grabbers” for proactively retrieving mail from other POP3 or IMAP4 accounts, a simple address book, and more.  There is currently no virus protection built into the system, but we have talked about adding such (and a contribution of that sort would be much appreciated ;)

    To clear up some other misconceptions: Quotient is based on the protocol implementations (now) in twisted.mail, but uses almost none of its server architecture, which is complete crap.  If for some reason, someone chooses to write a new mail server, I _do_ recommend using Twisted’s mail protocol implementations, and I _do not_ recommend using anything else from twisted.mail.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>