Hello, I have problem, Im using osticket om ny side and different ticket system on other side.Problem is when Im creating ticket, my message is going to the other ticket system, that ticket system generate new message instead of reply with different message-id. And mine osticket creates new ticket instead of adding this message to the existing ticket.I need to check only ticket number in subject-id without message-id and references.Could someone help me?I think the main function in class.thread.php file

I think i need to change something here   function lookupByEmailHeaders(&$mailinfo, &$seen=false) {        // Search for messages using the References header, then the        // in-reply-to header                if ($mailinfo &&                ($entry = ThreadEntry:()                 ->filter(array('email_info__mid' => $mailinfo))                 ->order_by(false)                 ->first()                 )         ) {            $seen = true;            return $entry;        }        $possibles = array();        foreach (array('mid', 'in-reply-to', 'references') as $header) {            $matches = array();            if (!isset($mailinfo) || !$mailinfo)                continue;            // Header may have multiple entries (usually separated by            // spaces ( )            elseif (!preg_match_all('/<(+@+)>/', $mailinfo,                        $matches))                continue;            // The References header will have the most recent message-id            // (parent) on the far right.            // @[deleted] rfc 1036, section 2.2.5            // @[deleted] http://www.jwz.org/doc/threading.html            $possibles = array_merge($possibles, array_reverse($matches));        }        // Add the message id if it is embedded in the body        $match = array();        if (preg_match('`(?="mid-|Ref-Mid: )(*)(?:$|")`',                (string) $mailinfo, $match)            && !in_array($match, $possibles)        ) {            $possibles = $match;        }        $thread = null;        foreach ($possibles as $mid) {            // Attempt to detect the ticket and user ids from the            // message-id header. If the message originated from            // osTicket, the Mailer class can break it apart. If it came            // from this help desk, the 'loopback' property will be set            // to true.            $mid_info = Mailer:($mid);            if (!$mid_info || !$mid_info)                continue;            if (isset($mid_info)                && @$mid_info                && ($t = ThreadEntry:($mid_info))                && ($t->thread_id == $mid_info)            ) {                if (@$mid_info) {                    $mailinfo = $mid_info;                }                elseif (@$mid_info) {                    $mailinfo = $mid_info;                }                // Capture the user type                if (@$mid_info)                    $mailinfo = $mid_info;                // ThreadEntry was positively identified                return $t;            }        }        // Passive threading - listen mode        if (count($possibles)                && ($entry = ThreadEntry:()                    ->filter(array('email_info__mid__in' => array_map(                        function ($a) { return "<$a>"; },                    $possibles)))                    ->first()                )         ) {            $mailinfo = true;            return $entry;        }

       // Search for ticket by the in the subject line        // This is the last resort -  emails must match to avoid message        // injection by third-party.        $subject = $mailinfo;        $match = array();        if ($subject                && $mailinfo`) in )                && preg_match("/#((\p{P}*+)+)/u", $subject, $match)                //Lookup by ticket number                && ($ticket = Ticket:($match))                //Lookup the user using the email address                && ($user = User:(array('emails__address' => $mailinfo)))) {            //We have a valid ticket and user            if ($ticket->getUserId() == $user->getId() //owner                    ||  ($c = Collaborator:( // check if collaborator                            array('user_id' => $user->getId(),                                  'thread_id' => $ticket->getThreadId())))) {                $mailinfo = $user->getId();                return $ticket->getLastMessage();            }        }        return null;    }

This does not appear to be a suggestion or feedback.osTicket will try to match using multiple ways, and if it fails match on the ticket # in the subject.  That being said there would not be a ticket number that matched in a second ticket system.  Well unless you were doing some sort of real time replication or got really unlucky using random assignment.There is no way to do this using stock osTicket UI.

thanks for the reply.Subject stays the same:   RE: Ticket  but message-id is different. And osticket creates new ticket instead of adding this message to the existing ticket.

6 days later

I can confirm that OSTickets 1.10 does not match on the ticket-number in the subject - we got a lot of new tickets with "#1234 in the subject of the customers mail!we had the same Problem in the past in ostickets 1.9x - the reason was, that ostickets didnt assign the message was not sent from an address which was stored as collaborator of the ticket........ so i changed the code in class.thread.php at below line 940 (accepted the mail and added the sender as collaborator..):// We found a match  - see if we can ID the user.// XXX: Check access of ref is enough? /* Comfine MOD Start */                    /* we dont want the check of the user ID ... Check of REF-ID is enough!                     if ($ref && ($uid = $t->getUIDFromEmailReference($ref))) {                        if ($ref =='s') //staff                            $mailinfo = $uid;                        else // user or collaborator.                            $mailinfo = $uid;                        // Best possible case — found the thread and the                        // user                    */                            $user = User:($mailinfo);                        // if user is not already in system, create him                                          if(!ThreadEntry:($user,$t->getTicket(),$mailinfo)){                               return null;                           }                        return $t;                    //}                    /* Comfine MOD End */and it worked well, but now in 1.10 the entire code is very different and i cannot find the right location to modify the code, ntozier, can you please give me a hint where we can change this behavier in the 1.10? ...i stuck at class.mailer.php in the decodeMessageId method and i don't understand the code.thanks in advance!

<-- forum moderator.  Not a project dev.  I have no idea where you would change something like this in the code.

Thanks for the MOD Comfine. ntozier could you ask dev to help us?

4 months later

Hello Arly.I have this problem too...Did you already found out how to change this in version 1.10?We would love to have this working in our setup as well.Thank you 

a year later

This thread is from 2017.
Killing zombie thread with a headshot.

Write a Reply...