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

Modifying subject/description automatically based on email body.

I am getting a automatically generated email from an automated system to open a ticket.  So far, I have not been able to convince them to change the mail message.

The subject line is nearly generic.  The actually good info is in the body of the message.  It would take some parsing to be useful.

If possible, what would be the best way to modify the subject on the fly from the osTicket side?  Either some sort of plugin?  Api to parse open tickets w/ generic subject and modify them?

I'm also looking at intercepting the mail and changing it there... but more parts to break.



  • Your best (and easiest) course of action would be to have them change the subject of the email before it is sent in the first place.

    Trying to parse the body for information that you want sounds like a nightmare.  I imagine that you would have to re-engineer the email parsing function(s) to do that.  Doesn't sound like fun.
  • I'm still working on fixing the other end.  Agree it is the best.

    Parsing is easy, lots of keywords I can easily pick out.  I also wanted to post-process it a bit and do a lookup table to decode some of the info.  I know I won't get them to do that part.

    I was thinking I could do it w/ the API... but I haven't tried anything yet.
  • edited November 2017
    grizly - thanks - that looks cool.  And lots of comments in the code too :)

    I'll read up on plugins and give it a spin.  And my PHP are very expired.

    I've started writing an interceptor on the other end.  I found they are calling sendmail and it allows me to select a different mailer.  So I'm working on a pre-parser.  Take stdin, modify as needed, then pass back to sendmail. 

    What I am wanting to do is find a string in the body ( $string = m/^Issue:.*\<(\d+)\>$ ) and then looking it up in a hash.  Then I put that returned value in the subject.

    Like your solution as it is much more generic.  I've realized once I start this for one program, I'm in for everything :)

Sign In or Register to comment.