` So I can update any ticket from my companies domain with the below code but all replies are as messages, can someone tell me how I can pass the correct code like "type" N and "flag" at the same time so it adds the reply as a internal note.
Thanks
John
// custom mod to allow own emails to update tickets
if ($subject
// Required `#` followed by one or more of
// punctuation (-) then letters, numbers, and symbols
// (Try not to match closing punctuation (`]`) in [#12345])
&& preg_match("/#((\p{P}*[^\p{C}\p{Z}\p{P}]+)+)/u", $subject, $match)
//Lookup by ticket number
&& ($ticket = Ticket::lookupByNumber($match[1]))
// Is it a company email address
&& (strpos($mailinfo["email"], "@domain.com") !== false ))
{
$staffId = Staff::getIdByEmail($mailinfo['email']);
if ($staffId && $mailinfo['staffId'] != $staffId)
{
$mailinfo['staffId'] = $staffId;
return $ticket->getLastMessage();}
}
return null;
}`