From e8502b8f9891be16b80874d514d557e2b3b8dd42 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Fri, 24 Apr 2026 07:03:34 +0200 Subject: [PATCH] MailTemplate should work with interface --- migrations/61-62/new-deprecations.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/migrations/61-62/new-deprecations.md b/migrations/61-62/new-deprecations.md index b44322025..014e4c343 100644 --- a/migrations/61-62/new-deprecations.md +++ b/migrations/61-62/new-deprecations.md @@ -11,6 +11,20 @@ New Deprecations This page lists all the new deprecations you should be aware of and what you should now be using instead. -:::tip[Reader Note] - No deprecations have been introduced in Joomla 6.2 yet -::: +### MailTemplate accepts MailerInterface objects + +PR: [47677](https://github.com/joomla/joomla-cms/pull/47677) +Files: +- `libraries/src/Mail/MailTemplate.php` +Description: +The injected `mailer` property can be a `MailerInterface` to not enforce a `Mail` instance. Not injecting a mailer instance is deprecated and will be not supported anymore in 8.0. + +```php +// Old code +$mail = Factory::getMailer(); +$mailer = new MailTemplate('com_foo.bar', $language, $mail); + +// New: +$mail = $this->getMailerFactory()->createMailer($config); +$mailer = new MailTemplate('com_foo.bar', $language, $mail); +```