We are using osticket v1.7.0 and have email templates setup. For the Response/Reply Template, we wanted to include the incoming message (%{message} variable). However, it is now showing up, all it's showing is the variable definition itself.

Here's the modified output

From: support@companyabc.com

Date Created: 07/18/2013 11 am

Subject: Support for user-id: 2416

Original Message:

%{message}

Thank you for using companyabc.com.

Customer Service

companyabc.com

a month later

If someone has a solution for embedding the original incoming email message into the replies from staff I would be very grateful. I searched this forum for a while but I could not find a good solution for this. I also tried to use the %{message} variable in our template but it does not replace the variable with the original email message it only shows the %{message} variable itself like dwtien says.

My understanding is that this functionality was removed between 1.6 and 1.7. I'm not really sure why it was removed. You may be able to add it back in by comparing the two versions and simply re-add the missing code.

hmmpff missing more features. We started trying OST from yesterday and we are running into some "must haves" we miss like this original message and also simply sending a CC or BCC to someone. Well we'll hang in there for a while!

There is a mod that allows CCing of responses in the mods section of the forums.

I have followed that instructions and I have a problem with it. I am able to enter the cc address in the view and the headers are set etc and if I look at the incoming email (on original reply) I see the cc address in that mail but the cc is never delivered.

FYI were using smtp sending

We too have the PRoblem with the %{message}-Variable when using in the New Message Auto-Response Template. In other Templates, the variable is working fine.

I found in the forum, that this already happened in v1.6, and there are solutions to do this, you just have to put some code lines behind some other code lines. But those lines do not exist in v 1.7... So me too, i would realy be happy if anyone knows how to fix this.

4 days later

Greetings everyone, in my case I like to receive the tickets alerts in my email without the need to enter to the osTicket Portal to know what is the issue, I don't know why but the New Ticket Alerts are not working, so we preffer the Ticket Assignment Alert.

The problem? The variable %{message} is not working in the "Ticket Assignment Alert" template (it shows %{message} instead the original incoming message) and if you use the variable %{comments} only shows me "Auto Assignment" because the SYSTEM (Auto Assignment) function.

If there is someone who already find what and which file modify please be so kind and let us know and show us what to do, 'cause is a helpful functionality.

Thanks!

15 days later

Solution

I created a way to retrieve the original message - this works on the "Post Reply" (utilizing Template used on ticket response/reply). The way template variables work is much different then in 1.6 (in my opinion, much cleaner)

in class.ticket.php in function "postreply"...

Change:

$msg = $this->replaceVars($msg,

array('response' => $response, 'signature' => $signature, 'staff' => $thisstaff));

To:

$msg = $this->replaceVars($msg,

array('response' => $response, 'signature' => $signature, 'staff' => $thisstaff, 'originalmsg' => $this->getOriginalMessage()));

create new function after function postreply:

function getOriginalMessage(){

$sql = 'select body from '.TICKET_THREAD_TABLE.' where ticket_id='.$this->id.' LIMIT 0,1';

if(!($res=db_query($sql)) || !db_num_rows($res))

return '';

$originalMessage = db_fetch_array($res);

return $originalMessage;

}

use %{originalmsg} in your template - again, I only created this for staff to post replies to the original request. If you need it for other templates, this should give you a general idea of what to look for in the other functions.

Enjoy!

7 days later

Still having troubles

Hey hawkhead99,

Thank you so much for your response, after I add your code also add the variable originalmsg to Ticket Assigment Alert Template (around line 320):

//Get the message template

if($email && $recipients && $tpl && ($msg=$tpl->getAssignedAlertMsgTemplate())) {

$msg = $this->replaceVars($msg,

array('comments' => $comments,

'assignee' => $assignee,

'assigner' => $assigner,

'originalmsg' => $this->getOriginalMessage()

));

But stills doesn't send me the message, now appears a blank space, am i doing something wrong? :

Thank you again for your help!

Neolex,

I made the same update you presented below and it worked...

Are you running 1.7ST?

If you are getting a blank, it is doing the find and replace, but the function (getOriginalMessage) is returning nothing.

This could happen if the query fails or no rows were found.

You can check this by firing up mysql query browser and doing the following query:

select body from ost_ticket_thread where ticket_id=(ticket id you are trying to assign) LIMIT 0,1

NOTE: remember the ticket id is the number you see in the URL NOT the actual ticket number you see displayed on page

Let me know what happens

You were right, the function is good, but it don't retrieve anything first because the name of my table is different ostnew_ticket_thread instead of ost_ticket_thread, but the thing is I think the problem is where the function is looking for..

We are looking in ticket_id instead of ticketID (this one is the random number generated at the moment the user open a ticket)

Or what you think? Is there a way to move a column to another table or have a better suggestion?

(There are a few pics so I can explain myself better)

ticket.jpg

ticket_thread.jpg

Once your pics get approved - I will take a look...

If I remember correctly (I originally installed back on 1.6ST and migrated over) - the installer let you specify a prefix besides just "OST" - so its not a big deal yours is "OSTNew" as the definition "TICKET_THREAD_TABLE" (which is specified in the function) would account for this.

In my table, the ticket_id column is what maps to the static ID given in sequential order - this is completely unmodified... Not sure why yours would be different?

I reference this in the function by calling a where ticket_id = $this->ID ID *should* still be the sequential order ticket ID and not the random one that is displayed to the user (assuming random is what you picked for what gets displayed to users).

Do a search on class.tickets.php for "TICKET_THREAD_TABLE" there should be another query in there that does essentially the same thing (referencing a specific row with that sequential ID)... If you cant find one, search for that in class.thread.php - that one will have it for sure. What you will be looking for is where ID gets referenced in the query and what column it is tied to. That will give you your answer.

If you don't find the answer though, again, I will check out your pics when they get approved :)

3 years later

Have you tried %{ticket.thread.original} ? This should show the original message.

@[deleted] this post is from 2013 and predates that variable.  Killing zombie thread with a headshot.Closing thread.

Write a Reply...