This fork is no longer maintained, so better to head over to https://github.com/davidmoten/subethasmtp which is under active developement.
SubEtha SMTP is a Java library which allows your application to receive SMTP mail with a simple, easy-to-understand API.
This component can be used in almost any kind of email processing application. Hypothetical (and not-so hypothetical) uses include:
- A mailing list manager (see SubEthaMail)
- A mail server that delivers mail to user inboxes
- A mail archiver like The Mail Archive
- An email test harness (see Wiser)
- An email2fax system
- SMTPseudo A filtering forwarding server
- Baton SMTP proxy for one or more backends (rules based on sender/envelope)
- Mireka - Mail server and SMTP proxy with detailed logging, statistics and built-in, fail-fast filters
SubEthaSMTP's simple, low-level API is suitable for writing almost any kind of mail-receiving application. Read more in UsingSubEthaSMTP or join our MailingList.
SubEthaSMTP was split out of the SubEthaMail mailing list manager because it is a useful standalone component. When we wrote SubEtha, the last thing we wanted to do was write our own SMTP server. In our search for a modular Java SMTP component, we examined:
- Apache JAMES
- JBoss Mail Server, now also defunct Meldware Mail
- Dumbster
- Jsmtpd
- JES
- Green Mail
Since you're reading this page you probably already know what we found: Seven different SMTP implementations without the slightest thought given to reusability. Even Jstmpd, which purports to be a "A Modular Java SMTP Daemon", isn't. Even though JBoss Mail/Meldware Mail is in active development, the team was unintersted in componentization of the SMTP processing portion of their server. GreenMail, which is based on the JAMES code base is best summarized with this blog posting.
During the development of SubEtha's testing harness, we tried out the Dumbster software and found that not only was the API difficult to use, it did it not work properly, the developer has not done any development on it in about a year and it does not work reliably on Mac OS X. With two simple classes we re-implemented it as an included project called Wiser.
We hate reinventing wheels. This should be the LAST FREAKING JAVA SMTP IMPLEMENTATION.
This new fork by Engine821.com intends to tidy up some of the structure, while keeping the original (and excellent!) design and code. We are using this as a base for a production product, so intend on keeping the code fresh and well maintained.
We too did a survey of existing Java SMTP implementations and were unsatisfied... until we found SubEthaSMTP! The code is clean and very well thought out. So far the changes we've made are minor, including...
- Eliminating the embedded
/lib
directory. Maven correctly handles pulling in all the dependencies and best practices discourage keeping binary artifacts inside version control. - Updating to the latest versions of some of the libraries used.
- Removing some of the IDE metadata files. Your IDE can rercreate whichever ones you need based on your preferences and the Maven POM.
- Making the message handing exceptions be
checked
. This is possibly controversial, but we thought about it a lot and prefer to have these exceptions show up in thethrows
clause rather than have them potentially pop-up unexpectedly at run-time.
Ian McFarland contributed the first codebase to SubEtha Mail. Then, Jon Stevens and Jeff Schnitzer re-wrote most of Ian's code into what we have today. Edouard De Oliveira and Scott Hernandez have also made significant contributions.
If you have any bug reports, questions or comments about this SubEtha SMTP fork, it's best that you use the GitHub issue tracker to get in touch. Please do not email the authors directly.
For now, we have just focused on implementing just the minimal required aspects of http://rfc.net/rfc2821.html#s4.5.1. We also return SMTP status responses that mimic what Postfix returns.
Thanks to a contribution from Mike Wildpaner, we support the StartTLS specification.
Thanks to a contribution from Marco Trevisan, we support the SMTP AUTH specification.