Email configuration does not support all required configuration parameters
Description
Activity

Mike Seaton February 17, 2022 at 3:23 PM
Cherry-picked up to 2.5.x:
https://github.com/openmrs/openmrs-core/commit/0d51b8315c9f25c6789ad23470c051a6564d8460
https://github.com/openmrs/openmrs-core/commit/d47fd26288366144c0513c920a143c7a5d36b83e
And up to master:
https://github.com/openmrs/openmrs-core/commit/9e4f23cf48455e86c6ccdf5681a296df6c094d74
https://github.com/openmrs/openmrs-core/commit/4e4213b087dadafa071ef466f77b75e33f6fb6fc

Mike Seaton February 17, 2022 at 2:21 PMEdited
I cherry-picked this into the 2.4.x and committed here:
https://github.com/openmrs/openmrs-core/commit/c0cbd7d45481984578c3d195967d68dd76e36407
This led to a build failure in a single unit test:
[ERROR] Failures:
[ERROR] UserServiceTest.setUserActivationKey_shouldCreateUserActivationKey:1518 Unexpected exception type thrown ==> expected: <org.openmrs.notification.MessageException> but was: <java.lang.NoClassDefFoundError>
I have a PR issued here to address this:
https://github.com/openmrs/openmrs-core/pull/3999
/ - do either of you know what changed that would require this between 2.3 and 2.4?
That was committed to 2.4.x here: https://github.com/openmrs/openmrs-core/commit/13e1781c47ac1a80bb46fdecdcffe12a9d6ff3d5

Daniel Kayiwa February 17, 2022 at 11:06 AM
Merged by to the 2.3.x branch at https://github.com/openmrs/openmrs-core/commit/ea9381bcb204fb69ad5e6d381e9b6c44abfc1ef0

Mike Seaton February 16, 2022 at 8:41 PM
This collects all configuration settings from global properties, runtime properties, and system properties that are prefixed with "mail.", and uses these to configure the mail session, in order to enable setting any current or future mail settings that are needed for java mail without hard-coding any specific or limited supported properties.
This is a PR against the 2.3.x branch, will need to be ported up if/when merged.
Details
Assignee
Mike SeatonMike SeatonReporter
Mike SeatonMike SeatonComplexity
LowFix versions
Priority
Should
Details
Details
Assignee

Reporter

Recently, I was trying to configure the OpenMRS email capabilities (MessageService and MailSender / Mail Session) to test out email capabilities.
I was using Gmail as an email service, and in order to configure this successfully, I found that I needed to set the following properties when creating the mail Session:
This was is not possible to define using the existing Mail configuration, which only supports a subset of these properties. Specifically, mail.smtp.ssl.protocols and mail.smtp.socketFactory.class are not able to be configured.
This ticket aims to fix this by supporting a wider, more general range of mail configuration settings based on the "mail." prefix.
/ let me know if you have any thoughts or concerns about this.