We are in need of a solution that will notify our Support Techs when a note is added to a Ticket in a Department that they are assigned to.
We started writing an action hook but we cannot get the emails to work. I have included what we have gotten so far; if we can get some thoughts how to get it to send the email:
We started writing an action hook but we cannot get the emails to work. I have included what we have gotten so far; if we can get some thoughts how to get it to send the email:
Code:
<?php
function send_admin_note_email($vars) {
// ticketid, replyid, deptid, deptname, subject, message, priority, admin, status
$ticketid = $vars['ticketid'];
$ticketmessage = $vars['message'];
$adminid = $vars['adminid'];
$message = "<p>A new Admin note has been made.</p>\n\n";
$message .= "<p> </p>\n\n";
$message .= "<p>---<br />\n";
$message .= $ticketmessage."<br />\n";
$message .= "---</p>\n";
$message .= "<p><a href=\"".$whmcs_admin_url."supporttickets.php?action=viewticket&id=".$ticketid."\">".$whmcs_admin_url."supporttickets.php?action=viewticket&id=".$ticketid."</a></p>\n";
// Get ticket, so we can notify all admins that are subscribed
$postfields = array();
$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "getticket"; #action performed by the API:Functions
$postfields["ticketid"] = $ticketid;
}
add_hook("TicketAddNote",1,"send_admin_note_email");
?>