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

Gmail strip quoted reply leaves a line

I have everything set up and can see the reply separator working, but it will still add the "On Tuesday, June 3rd, so and so wrote" line to every ticket, which is pretty annoying to have to see every other line. I'm migrating from spiceworks, and digging in there I can see my current filter is some regex. Is there any way to get osTicket to strip out that remaining line of the reply like the regex does? Regex below.



  • Good question...
    We have the same issue with outlook replies, there are always 4 lines above the separator tag:
    And 2 other lines I currently do not remember.

    We looked in the filters etc. but didn't find anything suitable to handle it in osticket.

    But we found the reason why these lines appear. The separator tag is hidden and sent within the (reply / new ticket) messages from osticket. When the user in outlook or Gmail then responds to the mail, the separator tag gets visible since it's part of the body of the original message. Gmail and also outlook add these header / info line above the body of the original message and this means also above the separator tag.
  • I've point this thread out to the devs. I'm thinking that a graceful solution may to be to check the line before the separator and if blank remove it.  Thoughts?
  • edited June 2014
    Can't look at the moment (already at home) but maybe checking the meta data or so of the mail to find out from which mail client (Gmail, outlook, thunderbird, ...) it was sent and then remove the lines above the separator tag that are added by the mail client would be my approach to get the line(s) removed.
    Maybe as a plugin? (Off topic: Btw. is there a how-to for creating plugins? - we are thinking about TRYING [no developers, only admins] to develop some...)
  • SAdly there is no howTo for creating plugins or documentation about it at all, but its been requested.
  • Since we are able to live without the plugins for now and also in the future it's not a problem. But thanks for response Neil and sorry for off topic question.
  • No worries. :) 
    [Especially since I really appreciate all the assistance that you provide people.  Thank you!]
  • Very welcome. Trying to help other osticket users/admins/enthusiasts with my knowledge, despite the fact I'm still learning new things about osticket :)
  • Heh.  They are pushing out new versions fast enough where I'm still learning new things about it too!. :)
  • Hopefully a future version will have some options for popular clients, like GMail, Outlook, etc with a checkbox in in the settings page to strip those lines out of the emails. That way you could simply have the email run through an additional filter before it hits the filter for the separator.

    I've been using Spiceworks for a while, and I hate it. osTicket has so much more usability that I am willing to live with this minor annoyance for the time being. It just seems odd to me that some enterprising GMail using osTicket admin out there hasn't solved it by now. Cmon people, we can't all code.
  • That is the great thing about osTicket, there are some minor annoyances, but you can live with them and simply wait for newer versions to sooner or later fix / improve these little annoyances :)
  • I fixed it by adding some regex to stripQuotedReply function in /include/class.thread.php file. Here is what I added:

        function stripQuotedReply($tag) {

        $this->body = preg_replace('/From:<.{1,200}>Sent:<.{1,200}>To:<.{1,200}>Subject:<.{1,200}'.$tag.'/', $tag, $this->body);
            $this->body = preg_replace('/From:<.{1,200}>Sent:<.{1,200}>To:<.{1,200}>Subject:<.{1,200}$/', $tag, $this->body);
            $this->body = preg_replace('/>[^>]+wrote:<br.{1,200}$/', '>'.$tag, $this->body);

             //Strip quoted reply...on emailed  messages
             if (!$tag || strpos($this->body, $tag) === false)

  • Thanks, sober 
    But do you know how to put response separator before header From...  ?
    Or may be somebody know how preg_replace works with russian language? 
Sign In or Register to comment.