Email configuration does not support all required configuration parameters

Description

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.

Activity

Show:

Mike Seaton February 17, 2022 at 2:21 PM
Edited

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

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.

https://github.com/openmrs/openmrs-core/pull/3998

Fixed

Details

Assignee

Reporter

Complexity

Low

Priority

Created February 16, 2022 at 8:34 PM
Updated April 19, 2022 at 5:42 PM
Resolved April 19, 2022 at 5:42 PM