At the moment in order to send emails, static class UserMail provides a bundle of static functions and helpers. This makes testing impossible.
class Mailer service was introduced as part of T247229 but it just calls static method and didn't change calls
- UserMail class and all its methods should be marked as deprecated
- Calls to UserMail's methods should be changed to retrospective methods of Mailer
- Mailer should be injected through DI where it's possible or MediaWikiServices::instance() where DI is not introduced.