Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1008

Joomla! 4.x Coding • Re: How to override the MailerFactory?

$
0
0
Hi there,

@SharkyKZ : Do you have the full source code of your plugin? - I have an Joomla! site, with an self signed certificate on an exchange server. When I add in file libraries/src/Mail/Mail.php by method useSmtp the following lines:

Code:

$this->SMTPOptions = [  'ssl' => [    'verify_peer' => false,    'verify_peer_name' => false,    'allow_self_signed' => true  ]];
all works fine. That is not very maintainable, so I create an Joomla! system plugin.

Code:

public function onAfterInitialise(){  $container = Factory::getContainer();  $container->extend(    MVCFactoryInterface::class,    static function ($mvcFactory) {      if ($mvcFactory instanceof MailerFactoryAwareInterface)      {        $mailerFactory = new \Company\Mail\MailerFactory($container->get('config'));        $mvcFactory->setMailerFactory($mailerFactory);      }            return $mvcFactory;    }  );}
When execute the Joomla! instance, the debug bar shows:

Key Joomla\CMS\MVC\Factory\MVCFactoryInterface has not been registered with the container. - Maybe you can give a little help.

Thanks

Greetings
Pascal

Statistics: Posted by thynk — Wed Jul 17, 2024 2:37 pm



Viewing all articles
Browse latest Browse all 1008

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>