-
-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Labels
Milestone
Description
Actual behaviour
Configuration via system properties is ignored as long as there is no "simplejavamail.properties" file in the class path.
Expected behaviour
Configuration via system properties is possible, even without a properties file.
Why it happens
This is because the ConfigLoader loadProperties that gets called in the static init block does NOT call readProperties. readProperties is where the system properties are used if set.
The loadProperties variant for InputStream does call readProperties, but is itself only called if the loadProperties for String finds a file on the class path.
Ergo to enable system properties you need to add a file to the class path.
How to reproduce
- Use a basic builder, with no explicit optional settings, letting defaults happen
- set a system property (for example simplejavamail.defaults.verifyserveridentity) to any valid, non-default value (e.g. false)
- Check the setting in the Config of the Mailer the Builder built. In this example,
OperationConfig isVerifyingIdentityshould be false, but is true - add an empty "simplejavamail.properties" file to the classpath
- Check the setting again. This time, it will have the correct value