/** * Emails to admins */ static function EMail_To_Ticket_Handler($template, &$ticket, $subject, $body, $files = array()) { $ticket = FSS_Helper::ObjectToArray($ticket); $mailer = new FSSMailer(); self::Ticket_To_Admins($mailer, $ticket); $lang = ""; if ($ticket['admin_id'] > 0) { $user = JFactory::getUser($ticket['admin_id']); $lang = $user->getParam('language'); } //$lang = // parse template etc $template = self::Get_Template($template, $lang); $email = self::ParseTemplate($template, $ticket, $subject, $body, $template['ishtml']); $mailer->isHTML($template['ishtml']); $mailer->setSubject($email['subject']); $mailer->setBody($email['body']); if (FSS_Settings::get('support_email_file_handler') == 1) { $mailer->addFiles($files); } $mailer->addDebug('Ticket', $ticket); $mailer->send(); }
static function EMail_To_Ticket_User($template_name, &$ticket, $subject = "", $body = "", $files = array()) { $cc_admins = $template_name == "email_on_create" || $template_name == "email_on_create_unreg" || $template_name == "email_unreg_passwords" ? false : true; $is_create = $template_name == "email_on_create" || $template_name == "email_on_create_unreg" ? true : false; $ticket = FSS_Helper::ObjectToArray($ticket); $db = JFactory::getDBO(); $mailer = new FSSMailer(); self::Ticket_To_Users($mailer, $ticket); // Add bcc to admins if set up. Dont send when creating a ticket as they get notifications from // Admin_Create function if ($cc_admins && FSS_Settings::get('support_email_bcc_handler')) { self::Ticket_To_Admins($mailer, $ticket); } // build template and parse it $template = self::Get_Template($template_name, $ticket['lang']); $email = self::ParseTemplate($template, $ticket, $subject, $body, $template['ishtml'], true); // set result to mailer $mailer->isHTML($template['ishtml']); $mailer->setSubject($email['subject']); $mailer->setBody($email['body']); // Only send attachments to users when creating if the ticket is created by an admin $session = JFactory::getSession(); if (FSS_Settings::get('support_email_file_user') && (!$is_create || $session->Get('admin_create') > 0)) { $mailer->addFiles($files); } // add debug info $mailer->addDebug('Ticket', $ticket); // send actual mail self::Send($mailer); }