Home > osTicket > How to Make Response Message Text Bolder Than The Rest of The Message in the Response Email of osTicket v1.6 RC5

How to Make Response Message Text Bolder Than The Rest of The Message in the Response Email of osTicket v1.6 RC5

Have you ever wanted to make the response message text become bolder in the response email in your osTicket System so that your client will be easier to differs and read it from the other message in that email? Since the default of email template in osTicket using the plain text, then we have to change the type of the message that located in the class.email.php file, from the text mode to the html mode. This modification also will answer the same question in osTicket Discussion Forum as well. Okay, here is the solution I successfully made.

  1. Open your \include\class.msgtpl.php file, and find this code:

    144
    
                     ',ticket_reply_body='.db_input(Format::striptags($var['ticket_reply_body'])).

    then replace with this following code:

    144
    
                     ',ticket_reply_body='.db_input($var['ticket_reply_body']).

    Find again this code:

    209
    
                     ',ticket_reply_subj='.db_input(Format::striptags($info['ticket_reply_subj'])).

    then replace with this following code:

    209
    
                     ',ticket_reply_subj='.db_input($info['ticket_reply_subj']).
  2. Open your \include\class.email.php file, and find this code:

    160
    
            $body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));

    then replace with this following code:

    160
    161
    
            //$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));  // Text mode
            $body = stripslashes(preg_replace("/(\r\n|\r)/s", "<br />", trim($message))); // HTML mode

    Find again this code:

    203
    
            $mime->setTXTBody($body);

    then replace with this following code:

    203
    204
    
            //$mime->setTXTBody($body);  // switch to HTML mode below
            $mime->setHTMLBody($body);
  3. Go to your Admin Panel -> Emails -> Templates -> then click on your template record (default: osTicket Default Template), then at the Message Body directive under the Ticket Response/Reply section, change this code:

    %response

    become:

    <b>%response</b>

    Please note that since we have switched from the text mode to the html mode, then we have to change also this URL code at the same template place above in order to have the ability to be clicked, from this code:

    %url/view.php?e=%email&t=%ticket

    become this following code:

    <a href="%url/view.php?e=%email&t=%ticket">%url/view.php?e=%email&t=%ticket</a>

    afterwards, click on the Save Changes button to save the changes.

Now, each time your staff reply to a ticket, then the response message in the email that your client received will become bolder than the rest of the messages.

Please note that by using that technique above, you can also implement this html mode for other section in your email template in Admin Panel.

Have a nice try!

  • Share/Bookmark
309 views Print This Post Print This Post

  1. Tyler
    December 8th, 2009 at 04:32 | #1

    I followed this tutorial for my RC5 and my output e-mail looks like this

    Person,A request for support has been created and assigned ticket #757947. A representative will follow-up with you as soon as possible.You can view this ticket’s progress online here: http:/websiteaddress.com/support/view.php?e=emailaddress@email.com&t=757947.If you wish to send additional comments or information regarding this issue, please don’t open a new ticket. Simply login using the link above and update the ticket.websiteaddress.com.com admnimistrator

    I changed the personal info above, but it strips everything down to one line and is not bold.

    here are my changes

    /support/include/msgtpl.php

                     ',ticket_reply_subj='.db_input(Format::striptags($var['ticket_reply_subj'])).
    		 ',ticket_reply_body='.db_input($var['ticket_reply_body']).
     		 ',forgot_ticket_subj='.db_input(Format::striptags($var['forgot_ticket_subj'])).

    /support/include/class.email.php

    There are 2 entries of step 2 part 1. I replaced both instances. 1 instance is in the “send” function and another in “sendmail” function. In my settings i have SMTP as outgoing.

    instance 1

    //$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
    $body = stripslashes(preg_replace("/(\r\n|\r)/s", "", trim($message))); // HTML mode
    $fromname=$this->getName();

    instance 2

    $subject=stripslashes(preg_replace("/(\r\n|\r|\n)/s",'', trim($subject)));
    //$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
    $body = stripslashes(preg_replace("/(\r\n|\r)/s", "", trim($message))); // HTML mode
    $headers = array ('From' =>$from,

    step 2 part 2

    if($attachment && $attachment['file'] && is_readable($attachment['file'])) { //file of.
    //$mime->setTXTBody($body);  // switch to HTML mode below
    $mime->setHTMLBody($body);
    $mime->addAttachment($attachment['file'],$attachment['type'],$attachment['name']);

    E-mail template is

    <b>%response</b>
    <a href="%url/view.php?e=%email&t=%ticket" rel="nofollow">%url/view.php?e=%email&t=%ticket</a>

    Thanks for the up and coming support, and these tutorials are gold.

  2. Tyler
    December 8th, 2009 at 04:35 | #2

    looks like I cant paste in the e-mail template without this site changing it, but basically I followed your steps for it

  3. December 8th, 2009 at 14:46 | #3

    Tyler,

    I think you have missed the step that you called with instance 2 above.
    Yours is:

    $body = stripslashes(preg_replace("/(\r\n|\r)/s", "", trim($message))); // HTML mode

    whereas it should be:

    $body = stripslashes(preg_replace("/(\r\n|\r)/s", "<br />", trim($message))); // HTML mode

    In the other words, you missed the <br /> tag which has function to break the line to the next line.

  4. Tyler
    December 8th, 2009 at 22:01 | #4

    Masino, the instance 2 suggestion you had was already implemented in my code, I guess it was just a bad typo on my part on the post. The Results are still the same as my original post. Im just going to revert back and wait for others feedback because I know im doing it right.

  5. December 8th, 2009 at 23:15 | #5

    Tyler,

    I have re-tested that modification above and there is nothing left. Also, the response email that received by client also worked properly; the response message text was bold as well.

  1. No trackbacks yet.