Hi,
been troubleshooting a component where there was the infamous error 0.
as it turned out, the culprit was in the chaining of the mail. Now I got a report that one of my own plugins is showing the same error 0 behavior....
The following code which works okay on sites UPGRADED to Joomla 3.8.3 now is broken on sites that are FRESH INSTALLED with Joomla 3.8.3...
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->get('mailfrom'),
$config->get('fromname')
);
$body = "LOGFILE";
$body .= "\n----------\n";
$body .= file_get_contents($logFile);
$mailer
->setSender($sender)
->addReplyTo($sender)
->addRecipient($config->get('mailfrom'))
->setSubject("MAILLOG")
->setBody($body)
->isHTML(false);
$send = $mailer->Send();
When removing the chaining in the code, everything works as expected...
This is the error that is thrown in the log file:
2018-01-12T09:50:04+00:00 WARNING SECRET-IP deprecated Joomla\CMS\Mail\Mail::add() will not catch phpmailerException objects as of 4.0.
2018-01-12T09:50:04+00:00 CRITICAL SECRET-IP error Uncaught \Throwable of type Error thrown. Stack trace: #0 /home/...THE FILE WITH THE $MAILER CODE IN IT...php
Can anybody shed a light?
As said, on upgraded Joomla installation, this works okay, it only happens on fresh installed sites!