Kayako logo
SupportSuite, eSupport and LiveResponse Discussion, troubleshooting and feedback related to Kayako's flagship support desk products SupportSuite, eSupport and LiveResponse.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Question HTML ticket posts from Outlook butchered - 25-03-2008, 06:02 PM

I turned on HTML e-mails for the first time today. The ticket post rendering inserts a lot of extra spaces between lines of text, and seems to have trouble with <span> and <a>. I included a screenshot of what I get in the ticket post, and what it should look like in Outlook.

If I pull the code from the post using the "Edit Post" button, and save it as a htm file, it renders perfectly in the browser. Something is happening inside the PHP that is rendering the ticket posts.

My HTML Conversion is set to "No Processing"
E-Mail Content Priority is "HTML"
Automatically Convert Encoding of Incoming E-mails is "Yes"
Strip <SCRIPT> Tags is "Yes"
Allow HTML Tags is "Yes"
Valid HTML Tags is "<a><b><i><u><font><hr><strong>"

This is an important issue to resolve, as 100% of our internal clients use Outlook as their e-mail client.

Below is a sample ticket posts' HTML:

HTML Code:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><b>BOLD TEXT<o:p></o:p></b></p>

<p class=MsoNormal><span style='background:lime;mso-highlight:lime'>GREEN
HIGHLIGHT TEXT</span><o:p></o:p></p>

<p class=MsoNormal><span style='color:red'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><b><span style='color:#1F497D'>Jeremy English </span></b><span
style='color:#1F497D'>&nbsp;</span><b><span style='color:black'>|</span></b><b><span
style='color:#1F497D'> &nbsp;</span></b><b><span style='color:#C0504D'>IT
Specialist III</span></b><b><span style='color:#1F497D'> &nbsp;</span></b><b><span
style='color:black'>| </span></b><b><span style='color:#C0504D'>&nbsp;</span></b><b><span
style='color:#1F497D'>City of Tyler, Texas</span></b><span style='color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><i><span style='color:#1F497D'>Office:</span></i><span
style='color:#1F497D'> &nbsp;<b>(903) 531-1111</b>&nbsp; <b>|</b>&nbsp; <i>Mobile:</i>
&nbsp;<b>(903) 520-1640 </b>&nbsp;<b>|</b>&nbsp; <i>Fax:</i>&nbsp; &nbsp;<b>(903)
531-1129</b><o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><a
href="mailto:jenglish@tylertexas.com" title="mailto:jenglish@tylertexas.com"><span
style='color:#C0504D'>jenglish@tylertexas.com</span></a><o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html> 
Attached Images
File Type: jpg contents.jpg (55.9 KB, 24 views)
File Type: jpg outlook.jpg (25.0 KB, 15 views)
   
Reply With Quote
  (#2) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,025
Join Date: Jan 2006
Location: United Kingdom
25-03-2008, 07:41 PM

Hi jenglish,

There are a number of tags in there you have not allowed. You need to either extend the list of tags you wish to allow, or disable tag stripping altogether to let them all through.


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
Reply With Quote
  (#3) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Question Question - 25-03-2008, 07:58 PM

Is it possible to allow all tags, except for <SCRIPT>?
   
Reply With Quote
  (#4) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 137
Join Date: Oct 2007
Location: Jakarta, Indonesia
26-03-2008, 04:47 AM

Quote:
Originally Posted by jenglish View Post
I turned on HTML e-mails for the first time today. The ticket post rendering inserts a lot of extra spaces between lines of text, and seems to have trouble with <span> and <a>. I included a screenshot of what I get in the ticket post, and what it should look like in Outlook.

......

This is an important issue to resolve, as 100% of our internal clients use Outlook as their e-mail client.
I posted this issue separately, but got no response from anyone. Kayako people, please help. Our company also uses Outlook extensively. I've allowed HTML tags, removing <script>, and tried adding <span> to the list of HTML tags allowed, and I have yet to get this to work.


Matthew Arciniega
The Precision Group

+ Holiday schedules, attachable to work and staff schedules
+ No more HTML parsing bugs
   
Reply With Quote
  (#5) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 137
Join Date: Oct 2007
Location: Jakarta, Indonesia
26-03-2008, 05:12 AM

Sorry, I think I misread things a little.

I also see the same problem as jenglish with tickets originating in Outlook.

But another thing I see is that when helpdesk staff reply to a new ticket via Outlook, all the line breaks get stripped and the message goes to the client in one long messy paragraph.


Matthew Arciniega
The Precision Group

+ Holiday schedules, attachable to work and staff schedules
+ No more HTML parsing bugs
   
Reply With Quote
  (#6) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,025
Join Date: Jan 2006
Location: United Kingdom
26-03-2008, 10:40 AM

Hi there,

Please try and remove all of the allowed tags, whilst keeping 'Strip tags' on. This will mean that you won't get pretty renderings of Outlook's HTML e-mail, but it will mean your e-mails are readable.

Readable HTML e-mail in-line inside of a web browser is difficult to support explicitly, due to the messy nature and different approaches many e-mail clients take.

Doing this, you should at least have readable plain looking e-mails.


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
Reply With Quote
  (#7) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
I think I see why this is happening - 26-03-2008, 01:33 PM

When the ticket post is rendered, it is getting a <br /> tag inserted at the end of every line, regardless of what is there. This is causing the extra spacing between lines (Outlook is already using <p> <div> and <span> to align the text).

It is also causing the rendering problems I am having with parts of the tags being rendered as text.

Note the occurance of <span <br /> style='color:#1F497D'>
Not exactly valid HTML...

HTML Code:
<p class=MsoNormal><b><span style='color:#1F497D'>Jeremy English </span></b><span<br />
style='color:#1F497D'>&nbsp;</span><b><span style='color:black'>|</span></b><b><span<br /> 
Could you please point me to the function that is inserting these <br /> tags so that I may modify it to fit my needs? Any help with this would be greatly appreciated, and will save me tons of time digging through all the Kayako PHP files with GREP.
   
Reply With Quote
  (#8) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Found the code - 26-03-2008, 02:04 PM

I found the code that is inserting the <BR> tags. This was apparently done to make sure that plaintext posts are rendered correctly and do not run together on one line.

I will attempt to modify this function to differentiate between a post that contains plaintext and one that has Outlook formatting tags.

If I get it working, I will post the solution here.

Wish me luck!
   
Reply With Quote
  (#9) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Thumbs up SOLUTION FOUND! (Outlook e-mail formatting in ticket posts) - 26-03-2008, 02:39 PM

Drumroll please...

Here is a method of showing all the pretty formatting of Outlook , WITHOUT breaking the formatting of newlines on plaintext posts.

This requires an edit to modules/tickets/functions_ticketmain.php

Please do not attempt this if you are not familiar with PHP. YOU CAN BREAK YOUR ENTIRE HELPDESK IF YOU MESS THIS UP!

Here is how to make the mod:

Locate the function in this file called "getTicketPosts"

Look for the section in this function with the following code (mine was on line 537, yours will probably be different)

PHP Code:
if ($nobr == true)
{
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $dbCore->Record["contents"];
} else {
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $this->returnProcessedContent($dbCore->Record["contents"]);

Add the following code above it, and modify the if statement as follows. Yours should look the same as this:

PHP Code:
$ContentsCopy $dbCore->Record["contents"];  //make a copy of the contents
$OriginalLength strlen($ContentsCopy);  //get original length of the string
$NewLength strlen(strip_tags($ContentsCopy));  //get length after HTML tags are stripped
            
if ($OriginalLength != $NewLength || $nobr == true)
{
  
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $dbCore->Record["contents"];
} else {
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $this->returnProcessedContent($dbCore->Record["contents"]);
         } 
The logic here is to check for HTML tags before inserting a <BR> on every line. If there are any HTML or PHP tags present, the PHP function strip_tags will remove them, resulting in a different string length. If the length is different, HTML is present, so you do not want to insert the <BR> tags. Just display the HTML-formatted text as-is.

That's all it takes. You should be able to read ticket posts from Outlook in all their original HTML glory. This won't affent plain-text posts. They will still have the <BR> tags inserted so they display property. If this does not work for you, make sure your Admin control panel settings are similar to the ones in my first post.

Enjoy!
   
Reply With Quote
  (#10) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,025
Join Date: Jan 2006
Location: United Kingdom
26-03-2008, 02:40 PM

jenglish,

Just as I was typing a good luck message, here you are already! Thank you very much for sharing this fix; I really appreciate community participation. We will look at the solution and look to implement something similar.

Would you be able to post in the Modifications & Addons forum?

Many thanks,


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
Reply With Quote
  (#11) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Talking 26-03-2008, 02:43 PM

Jamie,

I will post this in the modifications forum shortly. I am sure your team can come up with a more elegant solution for a future version. My quick hack might cause some problems I haven't found yet...

Thanks for your hard work, and for such a great product.
   
Reply With Quote
Reply

Tags
butchered, html, outlook, posts, ticket

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding emails from outlook to a ticket oliverm SyncWorks 2 25-01-2008 01:46 AM
Tickets Tickets -> Flag individual ticket posts Jamie Edwards Feature Requests 0 09-10-2007 06:39 PM
New Build: 3.10.02 STABLE Ryan Lederman News and Announcements 0 05-03-2007 09:53 PM
Headache ! ticket no updated when using outlook gallica SupportSuite, eSupport and LiveResponse 0 17-10-2006 08:51 PM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46