LamsonProject: Lamson The Python Mail Server

#

## Features

- Avoid aliases forever! Lamson uses friendly regular expressions and FSM-based routing.

- Lamson uses SQLAlchemy to talk to an RDBMS instead of a bizarre combination of flat-files and hashtables!

- Get up and running quickly. Lamson can be installed and running in 30 seconds.

Get Started »

## 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 1970s, Lamson adopts modern web application framework design and uses a proven scripting language (Python).

# Lamson The Python Mail Server

Rather than stay stuck in the 1970's, Lamson adopts modern web application framework design and uses a proven scripting language (Python).

    @route("(post_name)@(host)")
    def START(message, post_name=None, host=None):
        message['X-Post-Name'] = post_name
        confirmation.send(relay, "post", message, "mail/confirm.msg", locals())
        return CONFIRMING

Instead of hideous aliases files (that you never remember to update) Lamson uses friendly regular expressions and routing decorators that make configuring how email is handled trivial.

    @route("post-confirm-(id_number)@(host)", id_number="[a-z0-9]+")
    def CONFIRMING(message, id_number=None, host=None):
        original = confirmation.verify(message, id_number)
        ...

    @route("(post_name)@(host)")
    @route("(post_name)-(action)@(host)", action="delete")
    def POSTING(message, post_name=None, host=None, action=None):
        name, address = parseaddr(message['from'])
        ...

Rather than bizarre flat file "databases" and hashtable stores, Lamson uses a real Object-Relation Mapping system (SQLAlchemy) to talk to an RDBMS, but also lets you use any database system you can get a library for. It makes no assumptions about what you use, it just makes SQLAlchemy easier.

    table = Table(table_name, metadata,
            Column('id', Integer, primary_key=True),
            Column('sender', String(50), nullable=False),
            Column('state', String(50), nullable=False, default="START"),
            Column('module', String(50), nullable=False),
            Column("last_modified", DateTime,
                default=datetime.datetime.now,
                onupdate=datetime.datetime.now,
                nullable=False)
    )
    mapper(FSMState, table)

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(TM) 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 start
    $ lamson log
    $ 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 everything you need installed.

## Next Steps

Grab the code and you can read through the quick start documentation. After you've gone through that, best thing to do is read the code to the examples/osb example included in the source distribution and read the rest of the documentation on this site.

At any point, you can get help for all available Lamson commands with:

    $ lamson help

You can get individual command help with:

    $ lamson help -for start

Finally, if you really want to get started using Lamson to implement your dream email application, but are completely lost, then you can contact me for help.