dburrows/ blog/ entry/ from-blogspot/ Announce: leafsmtp

I recently redid my whole mail setup to use mutt and modular programs for sending/receiving mail. Since I've generally found a full-fledged MTA to be overkill and an unnecessary pain to configure for a personal system, I tried out a "simple" SMTP relayer called esmtp. It was OK (aside from my configuration confusion), but it has a few small deficiencies, esp. the fact that it doesn't manage a queue, thus forcing all deliveries to run in the foreground. Having determined that Python modules exist to run the client (and, in fact, the server) end of an SMTP session, I decided that it can't be that hard to write my own implementation of these programs with just a bit more oomph.

Happily, I turned out to be right. After three days of hacking, I now have a fully-functional...or at least functional enough to relay my email around...email system in a mere 736 lines of Python. It can put messages into an on-disk queue directory (~/MailQueue by default); the benefit here is that it makes it totally safe to background the delivery process, which is nice if you happen to have a slow SMTP server or (when using it as a delivery backend for getmail/fetchmail) run a lot of time-consuming spam checks. Without sticking the mail on the disk while it's being delivered, there is a chance that you'll lose mail if the delivery fails, especially if the delivery process has forked into the background. And unlike complete MTAs such as exim, this all works without needing anything to run as root (unless you want to deliver to the mail spools of other users).

There is no Debian package. In fact, there isn't a proper source package, but you can pull down the upstream repository with

darcs get http://people.debian.org/~dburrows/darcs/leafsmtp

You'll have to either pass the --set-scripts-executable parameter to darcs, or run "chmod +x" on the leafsmtp executable once it downloads. There's only a little documentation, but hopefully it's enough to get you going.

Oh, and the name: it is, of course, indicative of the fact that this is meant to be a reasonable mail system for leaf nodes on the Internet. It's a little inaccurate, since a leaf node could receive mail directly, but it sounds a lot nicer than most of the other things I thought of :-).