This will allow for %ticket, %name, %email, %subject, %dept, %status, %name, %firstname, and %lastname in the subject line.
It will also allow %ticket, %name, %email, %message, %subject, %signature, %dept, %status, %name, %firstname, and %lastname in the body.
It also changes the way %url works. I wanted the url to work like a real link, so now the %url opens the link and %/url closes it. (%urlClick Here to View Ticket%/url)
After modifying the code for this, you will need to change the template in the admin panel to be HTML. I haven't used this with attachments or the mail fetching part of osTicket.
CHANGE in include/class.ticket.php on ~ line 960
//New Ticket AutoResponse..
if($autorespond && $cfg->autoRespONNewTicket() && $dept->autoRespONNewTicket()){
$sql='SELECT ticket_autoresp_subj,ticket_autoresp_body FROM '.EMAIL_TEMPLATE_TABLE.
' WHERE cfg_id='.db_input($cfg->getId()).' AND tpl_id='.db_input($cfg->getDefaultTemplateId());
$resp=db_query($sql);
if($resp && list($subj,$body)=db_fetch_row($resp)){
$subj = str_replace("%ticket", $ticket->getExtId(),$subj);
$subj = str_replace("%name", $ticket->getName(),$subj);
$subj = str_replace("%email", $ticket->getEmail(),$subj);
$subj = str_replace("%subject", $ticket->getSubject(),$subj);
$subj = str_replace("%dept", $dept?$dept->getName():'',$subj);
$subj = str_replace("%status", $ticket->getStatus(), $subj);
$seperate_names = explode(" ",$ticket->getName(),2);
$subj = str_replace("%firstname", $seperate_names, $subj);
$body = str_replace("%firstname", $seperate_names, $body);
$subj = str_replace("%lastname", $seperate_names, $subj);
$body = str_replace("%lastname", $seperate_names, $body);
$body = '<html><body>'.$body;
$body = str_replace("%ticket", $ticket->getExtId(),$body);
$body = str_replace("%name", $ticket->getName(),$body);
$body = str_replace("%email", $ticket->getEmail(),$body);
$body = str_replace("%subject", $ticket->getSubject(),$body);
$body = str_replace("%dept", $dept?$dept->getName():'',$body);
$body = str_replace("%status", $ticket->getStatus(), $body);
$body_message = $var;
if($body_message == "Ticket created by staff") $body_message = $var;
$body_message = str_replace(chr(10), "<br />", $body_message);
$body = str_replace("%message",$body_message,$body);
$url = '<a target="_blank" href="'.$cfg->getBaseUrl().'/view.php?e='.$ticket->getEmail().'&t='.$ticket->getExtId().'">';
$body = str_replace("%url", $url, $body);
$body = str_replace("%/url", "</a>", $body);
$body = str_replace("%signature",$dept?$dept->getSignature():'',$body);
$body .= '</body></html>';
$email=$from=$fromName=null;
if(!$dept->noreplyAutoResp() && ($email=$dept->getEmail())){
$from=$email->getEmail();
$fromName=$email->getName();
//Reply separator tag.
if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator()))
$body ="\n$tag\n\n".$body;
}else{
$from=$cfg->getNoReplyEmail();
}
Misc:($ticket->getEmail(),$subj,$body,"KRA Support<".$from.">\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1");
}
}