leemason Posted February 29, 2012 Share Posted February 29, 2012 im trying to send an email to all support department admins when a ticket is opened from the admin area. everything works fine except the ticket id is never passed into the subject field, it shows in an email as: [Ticket ID:] - the message name ive followed the example api function to the letter, and tried a few variables to see if there where mistakes in the example page, but still nothing. i know the ticketid is passed to the function as i tested it by printing out all the vars in the email and the ticket id is present, it just doesnt get passed to the subject line.] here is my function: function email_all_dept_users($vars){ $clientname = get_query_val('tblclients', 'firstname', array('id' => $vars['userid'])); $clientname .= ' '.get_query_val('tblclients', 'lastname', array('id' => $vars['userid'])); $deptname = get_query_val('tblticketdepartments', 'name', array('id' => $vars['deptid'])); $postfields["messagename"] = "Support Ticket Created"; $postfields["mergefields"]["client_name"] = $clientname; $postfields["mergefields"]["client_id"] = $vars['userid']; $postfields["mergefields"]["ticket_id"] = $vars['ticketid']; //$postfields["mergefields"]["ticketid"] = $vars['ticketid']; ive also tried this with no luck $postfields["mergefields"]["ticket_department"] = $deptname; $postfields["mergefields"]["ticket_subject"] = $vars['subject']; $postfields["mergefields"]["ticket_priority"] = $vars['priority']; $postfields["mergefields"]["ticket_message"] = $vars['message'].print_r($vars,true);//been doing this to check if ticket id is present $postfields["type"] = "support"; $postfields["deptid"] = $vars['deptid']; $results = localAPI("sendadminemail",$postfields); }//function add_hook("TicketOpenAdmin", 99, 'email_all_dept_users'); ive also tried different priorities from 1 all the way through to 99999 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted February 29, 2012 Share Posted February 29, 2012 Try setting it with customsubject. I'm not sure you can pass mergefields like that to the subject line. $postfields['customsubject'] = '[Ticket ID: '.$vars['ticketid'].'] '.$postfields['messagename']; 0 Quote Link to comment Share on other sites More sharing options...
leemason Posted February 29, 2012 Author Share Posted February 29, 2012 that doesnt work becuase i "think" to use that you also have to specify a custom message as well which will probably mess up sites using a language other than english. its strange because the subject of the message comes through as: [Ticket ID: ] New Support Ticket Opened so it is using the built in email template fine, just not using the ticket id, which is even more pussling as its written as per the documentation. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.