[Merge] lp:~halvdanhg/dhis2/test-email into lp:dhis2

Halvdan Hoem Grelland has proposed merging lp:~halvdanhg/dhis2/test-email into lp:dhis2.

Commit message:
Implemented blueprint test-email. Added barebones EmailService and new api endpoint email/sendTestEmail

Requested reviews:
  Lars Helge Øverland (larshelge)

For more details, see:

Implements blueprint 'test-email': https://blueprints.launchpad.net/dhis2/+spec/test-email

Notable:
- The existing email API is abstracted as a MessageService wherein the mode of delivery (i.e. internal message, email, sms) for the message is not directly selectable. Using the MessageService was therefore not a very good solution.
- An EmailService has been implemented instead on top of EmailMessageSender. For now it only implements sendEmail(~) and sendTestEmail(), but could be extended to provide more general email related features (configuration etc.) if need be.
- A new API endpoint has been created at api/email/sendTestEmail which sends an automatically generated test message to the current user upon a POST-request. The reply string informs of the success or failure (missing settings) of the request.

Small remark:
Implementation and testing took a loot more time than it should have due to the default spring async executor (SimpleAsyncTaskExecutor) which is used by EmailMessageSender silently ignoring exceptions. This is still the case and could still cause inexplicable and undebuggable problems when sending emails.

Test by going to /dhis-web-maintenance-settings/systemEmailSettings.action and click the link "send me a test email"

review-diff.txt (17.1 KB)

···

--

Your team DHIS 2 developers is subscribed to branch lp:dhis2.

The proposal to merge lp:~halvdanhg/dhis2/test-email into lp:dhis2 has been updated.

    Status: Needs review => Merged

For more details, see:

···

--

Your team DHIS 2 developers is subscribed to branch lp:dhis2.