public static function ActNotificaUtente($array) { $mailer = JFactory::getMailer(); $config = JFactory::getConfig(); $sender = array($config->get('mailfrom'), $config->get('fromname')); FB::log($sender, " sender ActNotificaUtente "); $mailer->setSender($sender); $db = JFactory::getDBO(); $query = "select b.id as id, b.name as nome, b.email as email, a.titolo as titolo\n from #__gg_contenuti a, #__users as b,#__gg_notifiche_utente_contenuti_map c\n where\n a.tipologia = c.idtipologiacontenuto\n and c.idutente = b.id\n and a.id = " . $array['id']; FB::log($query, " ActNotificaUtente "); $db->setQuery($query); $result = $db->loadAssocList(); FB::log($result, " user ActNotificaUtente "); //$mailer->addRecipient("*****@*****.**"); foreach ($result as $sender) { FB::log(gglmsHelper::checkContenuto4Utente($sender['id'], $array['id']), " check user ActNotificaUtente "); FB::log($sender, " sender dentro foreach ActNotificaUtente "); if (gglmsHelper::checkContenuto4Utente($sender['id'], $array['id']) != 0) { $mailer->addRecipient($sender['email']); $body = "Gentile " . $sender['nome'] . " e' stato pubblicato in EdiAcademy un nuovo contenuto dal titolo: " . $sender['titolo']; $mailer->setSubject('Notifica from EdiAcademy'); $mailer->setBody($body); FB::log($mailer, " mailer ActNotificaUtente "); $send = $mailer->Send(); if ($send !== true) { echo 'Error sending email: ' . $send->__toString(); FB::log($send->__toString(), " error email send "); } FB::log($send, " send ActNotificaUtente "); //exit(); $mailer->ClearAllRecipients(); } } }