Saturday, September 17, 2005

Fun with Email

So earlier this week I ran across Matt Sergeant's O'Reillynet article about Qpsmtpd.

Now I've known about Qpsmtpd for a while now, I saw a great talk about it at OSCON a few years back, and I know the ASF uses it for their mail, so I'm not exactly new to the concepts here, but one thing in the article struck me as just too damn cool. You see, while there are special plugins for Qpsmtpd that let it deliver mail to Qmail or Postfix, the simplest way to integrate it with your existing system is just to run your normal SMTP server on an alternate port, and have Qpsmtpd do all the fancy filtering and spam blocking, then just forward it on via, you guessed it, SMTP.

Back in the Apache world, some of the HTTPD developers have been working on mod_smtpd, which lets you make the Apache HTTPD speak SMTP.

In the open source world good engineers borrow ideas and great engineers steal them, so much of the mod_smtpd design is based on Qpsmtpd. Ironically enough, the Qpsmtpd design was inspired by the modular design of the Apache HTTPD server, so now the cycle is complete...

Now mod_smtpd is just getting to the point where it's able to do useful things, but it still doesn't have a queue plugin that lets you forward mail via SMTP.

So I wrote one this morning.

It's pretty bare bones, with a really basic SMTP implementation under the hood, but it is enough for my mod_smtpd server to be able to forward mail to my exisitng Postfix server, and that's the whole point. Grab the patch here, if you're interested, although honestly, if you're interested enough in mod_smtpd at this point that you'd actually want the code, you're probably on the mailing list already ;-)