Your first impression might be that the implementation is overly complicated - and yes, you are right. On the other hand sending emails is our core business and we regularly have to do the following things

  • Signing emails and/or attachment with X.509 certificates
  • Figuring out why sending en email goes wrong
  • Archving the emails being sent using the file system, database or commercial archiving systems

Domain Centric Approach

The configuration of the services is centered around domains whereas a domain usually maps to the mail address of the sender. A domain contains all relevant configuration information for the email being created or sent.

Application Hooks

The service provide methods which can be overriden by a derived class. Since the author has no idea about the required configuration needed by a derived class the CommonsEmailDomainEntry allows access to the corresponding configuration instance.

Determining a Domain

The domain is determined using the following steps

  • take the domain matching the sender's email address (e.g.
  • take the domain matching the sender's domain address (e.g.
  • take the default domain