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

[plugin] Ticket Rewriter

https://github.com/clonemeagain/plugin-fwd-rewriter

Utility plugin.

Originally developed to solve a forwarding problem, whereby tickets forwarded to the ticketing system were created "by the forwarder", not the original sender, this provides the option to "rewrite the sender", hence the name. Allows for nested forwards.

It has recently been expanded to rewrite almost anything in an email before it becomes a ticket. Almost. It doesn't touch attachments (yet). :-)


Features:
- Rewrite forwarded mail from allowed sending domains, sets the sender as the original email creator, not the person forwarding.
- Drupal contact form parser, detects a Drupal contact form email and rewrites the resulting ticket as if it was sent by the person filling out the form. Easy ticket integration with your Drupal CMS via email. (If other systems have obvious formats, let me know, we can add them)
- Add a message to the ticket body indicating it was edited. (No thread at this point, as the ticket hasn't been created yet)
- Arbitrary text find and replace, also regex find and replace (dangerous, but fun!)
- Find and replace for email addresses.


Caveats:
- English language only, sorry everyone else, pulls welcome! I can't write regex for languages I don't know.
- 1.10+ only, I could modify it for 1.9 if necessary. Open an issue.
- Only rewrites email, API can rewrite themselves, the web form should not need it.
- Only works with registration disabled: pulls welcome!
- Doesn't work with mail forwarded via Outlook. For some reason Outlook doesn't include the email address of the original sender. Frustrating.

I highly recommend the setting of email domain(s) to filter the allowed sender's of forwards, this ensures only your agents can forward tickets and have them rewritten. Bit of a security issue allowing just anyone to forward tickets, so if you don't set one, it is disabled.

Let me know if it's useful to you, feel free to submit feature requests or pulls.

Comments

  • This is cool!

    My need is to be able to do a regex match in the body to put in the subject.

    If I'm ok with a "prototype" (hack) solution, it looks like I may be able to get away with just modifying this routine?

    private function rewriteText(&$vars, &$rules) {

    My PHP sucks, so despite the good comments it has taken me a while to follow through the code.

    Am I on the right track?
  • Awesome plugin @Grizly thanks for sharing.
  • @brkaus, yeah mate, if you've a specific string to match, then you'll find it in $vars['message']->body and can change the $vars['subject'] to whatever you want. to osticket it will always have been that way.
Sign In or Register to comment.