The Fulcrum CommonsEmail Servivce simplifies the work with the commons-email library. The provided functionality covers four areas

  • factory methods for preconfigured emails
  • overwriting the recipients before sending emails
  • advanced diagnostic support for sending emails
  • extensibilty through inheritance

Factory Methods

The service provides factory methods for creating SimpleEmail, HtmlEmail and MultiPartEmail. The benefit of using these factory methods is getting a fully configured email where you can override the settings in your application. The following items can be configured using the factory methods
  • SMTP server settings, authentication and debugging
  • settings for mailFrom, mailReplyTo and bounceAddress
  • email headers

Overwriting Recipients

This is an in-house requierement since we quite often run load tests with real input data containing real email addresses. Therefore it is useful to enforce that the emails are sent to preconfigured mail account instead.

Advanced Diagnostic Support

The service implementation provides the following features
  • enable/disable the debug mode of javamail per domain
  • the send() method of the service uses a TransportListener to determine the exact cause for undeliverable emails
  • the email can be dumped into the temp directory

Extensibilty through Inheritance

The service provides application hooks enabled/disabled through the configuration. This allows integration with archiving systems through a derived service.