We sometimes have users that will email our support@ address 3 times in quick succession.

This creates 3 tickets.

Instead, I would like new emails to simply re-open the last ticket by that user (if any in the system). only generating a new ticket if we have never seen that email address before.

"A merge all tickets by same email sender into one ticket" would do as well.

a year later

Solution

I made this solution. This looks like a lot of text, but it's a very easy hack, just read check it out. All emails from a the same email address go to the same Ticket ID. I'm sure it could be re-written and there could be some problems that come up but I've tested it and it works. When you get an email from someone who is already in the Database with a Ticket of any status, this will append the response to that Ticket just like if the TicketID were in the email subject. If that email address is not in the database it will make a new ticket. Before applying this I would Delete all tickets except for one per email address. Feel free to improve on this code and post the replies in this thread, or any problems and questions.

The file to edit is include/class.mailfetch.php

Find these two lines, they are around 240 in the file.

$newticket=true;

//Check the subject line for possible ID.

I insert the following between these two lines.

//New Match compare email and not TicketID

$sql5='SELECT email,ticketID FROM ticket WHERE email="'.$var.'"';

$msgres =db_query($sql5);

while ($msg_row = db_fetch_array($msgres)) {

if($msg_row==$var) {

$extid = $msg_row;

$ticket= new Ticket(Ticket:($extid));

}

}

UPDATE 30 MINUTES LATER.

I thought it might be wise / preferable and ideal in my case to update the SUBJECT when the new email was received. This way it will change the subject of the existing ticket to the subject of the new email from the user with the same email address as the previously opened tickets. With the cost of email these days a lot of couples / family's share address and this will allow them to note in the subject which person is actually sending the email.

Here is the new code, just use it in place of the previous code if you want to update the subject, the direction are the same.

//New Match compare email and not TicketID

$sql5='SELECT email,ticketID FROM ticket WHERE email="'.$var.'"';

$msgres =db_query($sql5);

while ($msg_row = db_fetch_array($msgres)) {

if($msg_row==$var) {

$extid = $msg_row;

$ticket= new Ticket(Ticket:($extid));

//Start UPDATE SUBJECT

$sql='UPDATE ticket SET updated=NOW(),subject='.db_input(Format:($var)).' WHERE ticketID='.db_input($extid);

//echo $sql;

if(db_query($sql)){

//success

}

//END Update Subject

}

}

2 months later

are you sure?

I do not think that it works exactly as you describe.

I need to change the code so, when someone sends an email,the tickets are sorted regarding the subject and not regarding the #ticketid

I've tried everything,but no hope.

Any ideas?

It still works for my situation. Although the emails don't get a new ticket ID so they are still in the back of the queue, but if you close tickets out they will be reopened.

Do you want them to be sorted by the alphabetical subject? Or by the date of the most recent?

Hello Hattmall and thank you for the reply.

I will explain exactly what we need.

I've created a department especially for a company that we cooperate with.

This company sends as their tickets(per e-mail) in the form(at the e-mail subject)

repair ticket

This comes automatic in our osTicket and we can reply to their tickets through the osTicket.

But,when they need to reply again,we need the ticket to be updated regarding the e-mail subject and not our ticketID.

When they send a reply e-mail in the form:

RE: repair ticket ,we need the ticket to be updated.For the moment,a new ticket is created(because at the reply,they do not add on the subject our ticketID).

I've added the Merge mod,so everytime,I have to manually merge the tickets and this thing causes me a big headache.

So,is there something I can do that the osTicket can "match" the subject of the incoming e-mail with the subject of the,already created,ticket and NOT the ticketID?

we use version 1.6ST

thank you

2 years later

Deari am looking for same solution One ticket per email address (auto re-open)for new version of osticket v1.8.1.2can you help me ?Thanks

Write a Reply...