Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

new variable in subject & message body of email response

Hi,

I want to add new variable in subject & message body of auto response email to users.

I add %subject (The subject user submitted) in subject line of autoresponse email template.
my subject line is: [Support #%ticket] : %subject .
and in message body : i add %message for original user message echo.

And in include/class.ticket.php I add this line in the autoresponse function & email alert function:

$subj = str_replace(\"%subject\", $this->getSubject(),$subj);
$body = str_replace(\"%subject\", $this->getSubject(),$body);
$body = str_replace(\"%message\", $msg,$body);


But it doesn't Work and in emails it echo "%subject" and "%message" yet.

How can I fix this?

Comments

  • lol.

    I found the way.
    I change Mother function in class.ticket.php
    as folow:
    FIND:

    //SEND OUT NEW TICKET AUTORESP && ALERTS.
    //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)){

    ADD BELOW:

    // new changes by Morteza Ghorbani (admin@delsystem.ir)
    $subj = str_replace(\"%subject\", $ticket->getSubject(),$subj);
    $subj = str_replace(\"%email\", $ticket->getEmail(),$subj);
    // new changes by Morteza Ghorbani (admin@delsystem.ir)


    AND FIND:

    //If enabled...send alert to staff (New Ticket Alert)
    if($alertstaff && $cfg->alertONNewTicket() && is_object($ticket)){

    $sql='SELECT ticket_alert_subj,ticket_alert_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)){

    ADD:

    $subj = str_replace(\"%subject\", $ticket->getSubject(),$subj);
    $subj = str_replace(\"%ticket\", $ticket->getExtId(),$subj);
    $subj = str_replace(\"%email\", $ticket->getEmail(),$subj);

  • To get the message to echo into the autoresponce I had to add
     $body = str_replace(\"%message\",$var['message'],$body);


    Like This

    // new changes by Morteza Ghorbani (admin@delsystem.ir)
    $subj = str_replace(\"%subject\", $ticket->getSubject(),$subj);
    $subj = str_replace(\"%email\", $ticket->getEmail(),$subj);
    $body = str_replace(\"%message\",$var['message'],$body);
    // New changes by Morteza Ghorbani (admin@delsystem.ir)


    But after that the %message echo works great in the autoresponder!

    Thanks for the MOD!
Sign In or Register to comment.