How can I send a password recovery email in html without changing nextcloud's code?

Hi there,
I decide to rewrite my email templates, and I want to push all my email in html rather than a plain text.but it seems that some emails such as password recovery email can only send in plain text.

i tried to figure it out and I found that in nextcloud/core/Controller/LostController.php a function called sendEmail().

In this function it sends a mail use $message->setPlainBody,and
shows that there is a method $message->setHtmlBody(‘The message text’);

after I change the $message, it’s working, but I do not think it’s a good idea to change nextcloud’s original code, so please tell me if there’s a way to do it without changing its code.