Skip to content

WildFly support for MailHandler #110

@jmehrens

Description

@jmehrens

The MailHandler only supports setting mail properties through a properties object. Per the WildFly docs: All properties must be accessible via a setter method.

See also:

In order to support WildFly, one option would be to add a new public method that takes a string that is the path to a resource which then loads the properties file. Just need to verify that WildFly allows this. This would be the preferred option as it would be useful for loading the logging.properties as mail properties when using the standard LogManager.

Another option would be to create a new method which takes a string that can be parsed as the contents of properties file. Splitting string key/value pairs where semicolon is used to delimit the entries would be one option assuming that is not used in any other property values. Need to look at:

  1. Adding a new method setMailProperties(String). This would clear and set the new properties. Name might have to change if overloads don't work correctly..
  2. Adding a new method setMailEntries(String). This would simply add new properties without removing existing ones.
  3. Consider adding getter methods for these.
  4. Determine if the setAuthenticator(char[]) can be used in WildFly.
  5. Might need to adjust the behavior of setAuthenticator to perform a classname lookup.

Final option to consider would be adding property setters for Jakarta Mail API properties and Angus SMTP provider properties.

Things to consider before implementing this change are:

  1. This option has a lot of code smell.
  2. This will only add support for Angus SMTP even though other providers could be loaded instead.
  3. The number of public methods could grow out of hand.
  4. There would now be multiple ways to set properties.
  5. Every time a new property is defined in the API or SMTP provider we would have to consider if that property needs to be converted into a setter method.
  6. Order of when these properties are set will matter to ensure the correct protocol (smtp vs. smtps) is used. It also matters that the verify type is set last.

List of properties from API (draft):

  1. mail.debug
  2. mail.from
  3. mail.protocol.host
  4. mail.transport.protocol
  5. mail.user
  6. mail.protocol.port
  7. mail.mime.allowutf8

List of properties from Angus (draft):

  1. mail.smtp.connectiontimeout
  2. mail.smtp.timeout
  3. mail.smtp.auth
  4. mail.smtp.auth.mechanisms
  5. mail.smtp.ssl.enable
  6. mail.smtp.starttls.enable

List of properties from MailHandler (draft)

  1. authenticator
  2. mail.to
  3. mail.sender
  4. mail.bcc
  5. mail.cc
  6. mail.reply.to
  7. mail.sender
  8. verify

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions