[Proposal] Refactor backward compat implementation for the Mail Sender
We need to refactor the backward compat implementation for the Mail Sender since right now it’s causing for example https://jira.xwiki.org/browse/XWIKI-15196 (SMTP setting used for each new wiki no inherited from xwiki.properties).
Copying the most relevant extract here for easiness of read:
What I propose:
* Introduce a new MandatoryDocumentInitializer component (or a DataMigration one) in a platform-mail-send-legacy module which is in charge of two things:
** Look for all XWiki.XWikiPreferences xobjects in the current wiki and copy the values to the XWiki.MailConfig xobject if they're different from defaults. This would execute on each subwiki at init time.
** Remove the SMTP xclasses from XWiki.XWikiPreferences xclass and xobjects in the current wiki
* Modify XWikiPreferencesDocumentInitializer and remove the code that creates the mail-related xproperties.
* Modify DefaultMailSenderConfiguration to stop looking in XWiki.XWikiPreferences. The new order will be:
** Look in Mail.MailConfig in the current wiki
** Look in the xwiki properties file
Let me know if you see any issue with this.
Note: The old mailsender plugin is already taking its mail config from the new mail config.