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

If a user responses to an open ticket via email, the system creates a new ticket

Server Information
osTicket Version v1.9.4 (c18eac4)
Web Server Software Apache
MySQL Version 5.5.40
PHP Version 5.4.34

If a user responses to an open ticket via email, the system creates a new ticket even if the ticket number is in the header. How do I fix this so the system does not create a new ticket every time?


Comments

  • This shouldn't happen.  What email client is the user using?  (I've noticed that some email clients are not preserving the message-id field like they should).  You can also try putting the ticket number in the subject and see if that helps.
  • This has been an ongoing issue through multiple osTicket versions.  I think osTicket overthinks this feature.  In my opinion, there should be a defined string in the Subject line, and it should disregard all else (message ID).  That would enable users to insert new emails into a ticket simply by reproducing the defined string within the Subject.  That's how it's done in some other highly-regarded tracking systems.

    Maybe this should be an admin option--"Loose email matching", that looks ONLY at the Subject line vs. "Strict email matching", that also matches against message ID.  I'll submit a feature request when I have time.

    Jack
  • I am Using Roundcube open source web mail software.

    I guess the image didnt show up let me see if  i can re post it here
    osticket-error.png
    1368 x 768 - 160K
  • Interesting the image didnt post but it showed up went i hit attach a file.
    Maybe this will work

    image
    osticket-error.jpg
    1368 x 768 - 146K
  • I agree, that's horribly broken. It's very hit-or-miss for us. Sometimes replies get appended, sometimes they create new tickets.

    There may be some ways to improve this, but I don't know.  Hopefully, someone else will have good suggestions.  And hopefully, the developers will address it eventually.

    Jack
  • same problem to me, I thinked osticket uses mail subject to define ticket, indeed it uses a header? thanks
  • ah, I use roundcube too
  • I dont' understand, sometimes it update ticket, sometimes it create new
    I tried from roundcube and from thunderbird, same thing
    is there a log where I can debug it? thanks
  • if I delete previous message from reply it can create problems?
  • This is how i am going to solve this email reply issue.

    in the canned email response with the updated ticket, I am going to add

    "please log in to the support center to update your ticket"

    and remove any mention that the customer can reply to the email to update the ticket.


  • if customers have to support center and can't use email is a great limitation
    why don't use ticket number in subject? I think it's more simple....
  • From what i can tell the ticket number is in the subject line. Take a look at the image i posted.
    So that would mean their something wrong with the parsing of the subject line.

    To go any farther we would need to look at the parsing code and have the parser send its information to the debug log. which is outside my skill set.

  • sorry, I intend that osticket developers ( not you :) ) could use ticket number in subject and not some strange hidden value in headers: it's more simple and more accurate
  • osTicket defaults to the ticket number in the subject already... if it cannot determine what ticket to update based on the internal email message-id.
  • so first check message-id and then subject? I've made some tests and when I cut previous message in reply it opens a new ticket, even if I don't change subject
  • We are having the same issue. Here is the scenario;

    Customer opens a ticket and we have 8-10 responses back and forth with no issue. Then a new ticket is created from his next response. The only noticeable difference is the below in the body;


    Sent from my Verizon Wireless 4G LTE DROID
    On Dec 26, 2014 1:33 PM, XXX Support <support@xxx.com> wrote:


    The subject line is exactly the same as all the previous responses except it has"Re" at the beginning.

    Also, looking at other instances of the same issue, it appears what they all have in common when a new ticket is opened is the following at the end of the users email body;

    " On Dec xx, 2014 1:33 PM, XXX Support <support@xxx.com> wrote: "

    It seems that the logic that tells OST to check the subject line if the message ID is missing is not working correctly. We deal with very technical issues via our support system and can have many responses back and forth in a short time. Needless to say, this issue is impacting our support efficiency. I understand that this is a "free and open source" product but am thinking about trying to push for an allotment to purchase a support contract. However, if this issue has not been "identified" yet, I am concerned that there wouldn't be a fix even if we did purchase a contract.

    So, is the consensus that there is something that has been modified or "messed up" in the code that is causing this or is it in the original code "out of the box"?

    Thanks for any insight.
  • osTicket defaults to the ticket number in the subject already... if it cannot determine what ticket to update based on the internal email message-id.
    If that's true, it must have changed in 1.9.4 (and it's not mentioned in the release notes).  I know that with 1.9.3, I had cases where some replies (containing the ticket number string) appended to existing tickets, while others created new tickets (and got a NEW ticket number string added to the email subject, along with the original one).  While it seemed random, I'm sure it wasn't.  But I did not want to invest the time to identify a pattern.

    Jack
  • My last reply may be incorrect. I think I had the ticket number string wrong in the Subject line of the templates.  I just tested, and it appears to verify what @ntozier just said.

    Jack
  • I'm using Yahoo webmail client and I notice that the "reply above this line" is getting stripped when I reply to the message, which might be the reason new tickets are being generated.

  • with gmail I lost replied message
    also, there is no way to join/merge ticket, so if osticket create more tickets from same thread it's a caos...
  • Good to know mmiat! My customers aren't even receiving an auto response when they submit the ticket. Is there any known fix or workaround?  

    I've done message parsing based on body and subject line for a simple messaging system I built using PHP. It should be fairly simple to identify a message by finding the string, "[#XXXX]" in the subject line and extracting the ticket ID. The subject line is coming through intact, so why would it be missing the ticket number? 

    I was having the same issue with v1.9.1 and thought I'd upgrade to hopefully fix, but not luck.
  • if admins say to us where osticket parses incoming email maybe I can try to personalize for my use, using subject and not message-id
  • is this in class.mailfetch.php

            // Ensure we have a message-id. If unable to read it out of the
            // email, use the hash of the entire email headers
            if (!$header['mid'] && $header['header'])
                if (!($header['mid'] = Mail_Parse::findHeaderEntry($header['header'],
                        'message-id')))
                    $header['mid'] = '<' . md5($header['header']) . '@local>';

    ???
  • edited January 2015
    Same issue with me, registered on forum for resolution but the forum is already flooded :-P...

    Did few experiments to find what exactly causing the problem.
    Its the subject of the ticket causing the issue.

    1 - Case 
    if a user creates a new ticket with custom subject & any reply made to canned response of the ticket will create a new ticket.
    but reply made to canned response of new message on ticket by staff will work fine.

    2 - Case
    if a user creates a new ticket with blank subject & any reply made to canned response of the ticket will not create a new ticket - Everything will go fine then.

    Why ?

    email received for new ticket with custom subject is "Support Ticket Opened [#XXXXXX]", it should be "Custom Subject [#XXXXX]".
    but subject of canned response from ticket answer is perfect ie :- "Custom Subject [#XXXXX]".




    Should not happen, cause the ticket ID is mentioned in all email irrespective of email subject.
    Must be a bug, Script must be trying to look for exact email subject for ticket replies not ticket id mentioned in subject.


    Edit :- few more test done, problem with first mail only when subject is custom.
  • edited January 2015
    @darksecu -
    Same issue with me, registered on forum for resolution but the forum is already flooded :-P... Did few experiments to find what exactly causing the problem. Its the subject of the ticket causing the issue. 1 - Case  if a user creates a new ticket with custom subject & any reply made to canned response of the ticket will create a new ticket. but reply made to canned response of new message on ticket by staff will work fine. 2 - Case if a user creates a new ticket with blank subject & any reply made to canned response of the ticket will not create a new ticket - Everything will go fine then. Why ? http://jan.imghost.us/8neE.png email received for new ticket with custom subject is "Support Ticket Opened [#XXXXXX]", it should be "Custom Subject [#XXXXX]". but subject of canned response from ticket answer is perfect ie :- "Custom Subject [#XXXXX]". Should not happen, cause the ticket ID is mentioned in all email irrespective of email subject. Must be a bug, Script must be trying to look for exact email subject for ticket replies not ticket id mentioned in subject. Edit :- few more test done, problem with first mail only when subject is custom.
    Is this a contribution to the topic, or a topic hijack?  It is possible your issue is the same, but you didn't tell us what version you're using.

    Please attach images here rather than posting links to remote images.

    Thanks.
    Jack
  • osTicket Version v1.9.4 (c18eac4)
    My Bad, but it didn't mean to hi-jack the topic.
    the problem faced by OP and me are same, so obviously a contribution, i believe.
  • edited January 2015
    I had the same issue.  Worked around it by simply using the subject and extracting out the ticket number using my own regex ( "/\[#(.*?)\]/is" ) and remarking out all of the code above that in the function.

    The function and file in question is class.thread.php in the include folder.  I have attached my copy to this thread. rename extension to php of course.


            // Search for ticket by the [#123456] in the subject line
            // This is the last resort -  emails must match to avoid message
            // injection by third-party.
            $subject = $mailinfo['subject'];
           
            $match = array();
           
            if ($subject && $mailinfo['email'] && preg_match ("/\[#(.*?)\]/is", $subject, $match) && ($ticket = Ticket::lookupByNumber($match[1]))
                    //Lookup the user using the email address
                    && ($user = User::lookup(array('emails__address' => $mailinfo['email'])))) {
                    //We have a valid ticket and user

                $check1 = $ticket->getUserId();
                $check2 = $user->getId();
           
                //var_dump($check1); var_dump($check2);
           
                if ($check1 == $check2 //owner
                        ||  ($c = Collaborator::lookup( // check if collaborator
                                array('userId' => $user->getId(),
                                      'ticketId' => $ticket->getId())))) {

                    $mailinfo['userId'] = $user->getId();
                    return $ticket->getLastMessage();
                }
            }
           
            // Search for the message-id token in the body
            if (preg_match('`(?:data-mid="|Ref-Mid: )([^"\s]*)(?:$|")`',
                    $mailinfo['message'], $match))
                if ($thread = ThreadEntry::lookupByRefMessageId($match[1],
                        $mailinfo['email']))
                    return $thread;

            return null;
    class.thread.txt
    48K
  • @lockm4

    This was a great solution - is there a way to modify what you posted to remove the requirement that a ticket come in from the same email address which it is assigned?  Basically to allow anyone who emails in with the subject containing the ticket number to append to the ticket instead of opening up a new ticket?  I do realize that this could open the system up to spam.
Sign In or Register to comment.