email the hard way
So I needed email server (MTA) capability for a feature on the personal project I'm working on.
I figured that I had a few choices:
- use sendmail (default on linux) or one of its alternatives (postfix, exim, etc)
- use a different thirdparty MTA, preferably a Java-based one
- use a "managed service" like fastmail, who I already use very happily for my inbox/IMAP
Fastmail would probably have been the easiest path, but I decided I might want to have more control and my VPS service gives me a much bigger bandwith allocation then fastmail would. Having decided o do it myself, I was very hesitant to use the notorious sendmail (its just scary to be able to write a book of hundreds pages long about an app that does a relatively simple job) or even its supposed 'simplier' alternatives like postfix, so I hunted around for a simple Java based one and found James (from apache) ZeroToaster, a cheap commercial java app and JES, pretty much the same thing, but open source.
So I of course went with JES and the initial out-of-the-box experience was excellant, 30 min & I was up and running send/receiving emails, and that included changing my DNS MX records.
Unfortunately after running it for a few hours it got into a nasty loop of repeatedly throwing an exception trying to deliver a malformed email it received (yes I had spam start coming in within minutes! of starting it up).
But this is where the power of oss does shine, being a nice simple app (the reason I avoided James like the plague) I grabbed the src-code zip, found the offeneding code and added some code to put aside malformed emails and fixed a null pointer bug in the shutdown code for good measure!
So probably for less tha a couple of hours of work I now have a working light MTA, with just enough features that I need and a resoanble confidence that I can fix other problems that might turn up. The only downside is that the sourceforge project for JES seems to have been abandoned for over a year, so for now I've just imported the code into my own subversion repo.
Still need to come up with a little wrapper to start it via rc script.
And I've found on JES's maillist that someones had success with compiling it with GCJ, with excellant results in terms of memory footprint and performance, so theres something else to look into.
[Update] Doh! Just found a patch on the sroucforge project page that fixes the problem I found with malformed emails (actually bounce mails with an empty address).
I figured that I had a few choices:
- use sendmail (default on linux) or one of its alternatives (postfix, exim, etc)
- use a different thirdparty MTA, preferably a Java-based one
- use a "managed service" like fastmail, who I already use very happily for my inbox/IMAP
Fastmail would probably have been the easiest path, but I decided I might want to have more control and my VPS service gives me a much bigger bandwith allocation then fastmail would. Having decided o do it myself, I was very hesitant to use the notorious sendmail (its just scary to be able to write a book of hundreds pages long about an app that does a relatively simple job) or even its supposed 'simplier' alternatives like postfix, so I hunted around for a simple Java based one and found James (from apache) ZeroToaster, a cheap commercial java app and JES, pretty much the same thing, but open source.
So I of course went with JES and the initial out-of-the-box experience was excellant, 30 min & I was up and running send/receiving emails, and that included changing my DNS MX records.
Unfortunately after running it for a few hours it got into a nasty loop of repeatedly throwing an exception trying to deliver a malformed email it received (yes I had spam start coming in within minutes! of starting it up).
But this is where the power of oss does shine, being a nice simple app (the reason I avoided James like the plague) I grabbed the src-code zip, found the offeneding code and added some code to put aside malformed emails and fixed a null pointer bug in the shutdown code for good measure!
So probably for less tha a couple of hours of work I now have a working light MTA, with just enough features that I need and a resoanble confidence that I can fix other problems that might turn up. The only downside is that the sourceforge project for JES seems to have been abandoned for over a year, so for now I've just imported the code into my own subversion repo.
Still need to come up with a little wrapper to start it via rc script.
And I've found on JES's maillist that someones had success with compiling it with GCJ, with excellant results in terms of memory footprint and performance, so theres something else to look into.
[Update] Doh! Just found a patch on the sroucforge project page that fixes the problem I found with malformed emails (actually bounce mails with an empty address).
Labels: java
