Lamson The Python SMTP Server

We’ve all been there, mucking around in the sendmail m4 macros trying one more time to get the damn mailing list to update for the new users. Every time we say, “This sucks, I want to rewrite this stupid thing.” Yet, when we’re done, we simply crawl back to our caves covered in our sendmail wounds.

Lamson’s goal is to put an end to the hell that is “e-mail application development”. Rather than stay suck in the 1970’s, Lamson adopts modern web application framework design and uses a proven scripting language (Python).

Instead of hideous aliases files (that you never remember to update) Lamson uses friendly regular expressions and routing.

Rather than bizarre flat file “databases” and hashtable stores, Lamson uses a real Object-Relation Mapping system (SQLAlchemy) to talk to an RDBMS.

Everything about Lamson is modern, rejecting any part of the gargantuan e-mail standards that doesn’t make sense in today’s world of giant attachments to MS Exchange™ servers through spam blockers trying their best to defend the world.

The 30 Second Introduction

If you have Python and easy_install already, then try this out:

$ easy_install lamson $ lamson gen -project mymailserver $ cd mymailserver $ lamson syncdb $ lamson start $ lamson log -queue run/queue -port 8899 $ nosetests $ lamson help -for send $ lamson send -sender me@mydomain.com -to test@test.com -subject "My test." -body "Hi there." -port 8823 $ less logs/lamson.log $ mutt -F muttrc $ lamson stop -ALL run

You now have a working base Lamson setup ready for you to work on with the following installed:

  • Lamson and all dependencies (SQLAlchemy, Mako, nosetests)
  • Code for your project in mymailserver. Look in app/handlers and config/settings.py
  • Two initial tests that verify your server is not an open relay and forwards mail in tests/handlers/open_relay_tests.py
  • A “logger” server running on port 8899 that dumps all of its mail into run/queue
  • A config script for mutt (muttrc) that you can use to inspect the run/queue and also send mail using Lamson’s send command.

Next Steps

If you want to write a Lamson application you’ll have to read the code. You can grab the