Apache James

Needed a SMTP server for testing our application today, and after evaluating a few options (company smtp, various free/open source solutions) it turned out that James worked best.

James was able to run as a standalone SMTP/POP3/NNTP server or Windows Service all at the same time, and highly configurable with its XML file. I was able to get it running quickly with its installation instructions. However the site documentation wasn’t so explicit on SSL configuration; its instructions assumed a lot about the user knowing about JSSE, keystores, SSL and the such. (Well, they probably are thinking someone who didn’t know these shouldn’t be setting up a secure mail server)

http://james.apache.org/server/2.3.0/usingTLS.html
http://wiki.apache.org/james/UsingSSL

These are two good references to getting it setup. In short, do the following:

  1. Use java keytool to create a keystore containing the key pair for SSL.
  2. Edit {james}\apps\james\SAR-INF\config.xml
  3. Uncomment the ssl section of the section, replacing the values of file, password, and key-password with those of your keystore.
  4. Edit your SMTP server section and uncomment the useTLS element. Change the port number if preferred.
  5. Copy {jre}\lib\ext\sunjce_provider.jar file into the {james}\lib directory.
  6. Restart James.
  7. Test using a mail client. For a self-signed cert you may need to configure your mail client to accept the certificate.

Remember always to check your log file for error messages. It saved me loads of time from guessing what’s actually wrong. Also important is to copy {jre}\lib\ext\sunjce_provider.jar file into the {james}\lib directory. Yes, this is the step I missed that was causing a NoSuchAlgorithmException which I found in the log file.

Leave a Reply