Aug 6, 2012

HTML Email Being Stripped By osTicket

At my current company we use one of the easiest and simplest Help Desk ticketing systems ever, osTicket. I set it up for my company about a year ago when the higher ups wanted to expand the system they were using at the time, but the licensing costs were outrageous. osTicket on the other hand is free and open source!

Since implementing it, we've added some customization. First we integrated it with our Active Directory, then we hired a PHP developer to add some reporting functionality. One thing we never did, until now, was fixed it's ability to import HTML emails. Or rather, have it not strip the text out of HTML emails when generating a ticket.

We found that if someone forwarded an email to osTicket, that the original message would be stripped unless someone changed the format of their email to plain text. Most users don't think about stuff like tat though. Also we have some web forms that generate tickets via email, and those web forms send email in HTML format as well.

To keep osTicket from stripping out the text of an HTML email, you need to add a line of PHP code to /include/class.mailparse.php. Paste the following code:

$body=str_replace(" ", "", $body);
Right after this line:

 $body=str_replace("</DIV><DIV>", "\n", $body);
Save your changes, and that's it. We first tried commenting out the stripping code, but that just kept email from being imported at all.

Now, the formatting of the imported email isn't pretty, but at least none of the text is stripped out. If you have a better fix. One that preserves formatting better perhaps, please let us know in the comments.

Thanks to Casey Cirio for figuring this one out!



Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam