I have several custom Joomla components which use Factory::getMailer() to send emails, but I notice that this method is deprecated and will be unavailable in Joomla 6. I haven’t been able to find any simple instructions for how to replace Factory::getMailer() in Joomla 4+.
I have tried using Factory::getContainer()->get(MailerFactoryInterface::class)->createMailer() but this throws an error because it seems like I probably have to set up some stuff in the provider.php file and/or the component file. I can’t find any information about exactly what is required.
Malcolm Lyon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.