<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: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=iso-8859-1"><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;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
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;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.5pt;
font-family:Consolas;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:Consolas;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></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-GB link=blue vlink=purple><div class=WordSection1><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Hi Emmanuel,<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> Thanks for your reply.<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>The test case for us was quite simple. We use Miscrosoft Office Outlook as the email client.<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> 1) Create a ticket<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> 2) The Ticket owner updates the ticket by sending an email to RT that has<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> an inline image<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> 3) RT sends an email to the Requestor and CC’s that has been converted to plain text<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'> We believe that the plain text conversion was taking place in Transaction.pm here (highlighted):<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> my $content;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> if ( my $content_obj =<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) )<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $content = $content_obj->Content ||'';<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $RT::Logger->debug( "From Transaction.pm args{type} is ".$args{Type} );<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $RT::Logger->debug( "but the detected object type of the content is ".$content_obj->ContentType );<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> if ( lc $content_obj->ContentType eq 'text/html' ) {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'># if ( 1 ) {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $content =~ s/<p>--\s+<br \/>.*?$//s if $args{'Quote'};<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> if ($args{Type} ne 'text/html') {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $RT::Logger->error( "In content type is html ".$args{Type} );<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> $content = RT::Interface::Email::ConvertHTMLToText($content);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='background:yellow;mso-highlight:yellow'>else {<o:p></o:p></span></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> $content =~ s/\n-- \n.*?$//s if $args{'Quote'};<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> if ($args{Type} eq 'text/html') {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> # Extremely simple text->html converter<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> $content =~ s/&/&/g;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> $content =~ s/</</g;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> $content =~ s/>/>/g;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> $content = "<pre>$content</pre>";<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> }<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New";background:yellow;mso-highlight:yellow'> }</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>We also think that we have solved the issue with a modification as follows:<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> my $all_parts = $self->Attachments;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ while ( my $part = $all_parts->Next ) {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+# $RT::Logger->debug("Detected a part in the multipart of type ".$part->ContentType);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ if ( lc $part->ContentType eq 'text/html' ) {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ return $part;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ }<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ next;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'>+ }<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> while ( my $part = $all_parts->Next ) {<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> next unless RT::I18N::IsTextualContentType($part->ContentType)<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> && $part->Content;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'># $RT::Logger->debug("Figured this part of type ".$part->ContentType." would do you");<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> return $part;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Could you confirm that this code change is appropriate.<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Regards<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Kevin Curtis<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>FarSite Communications.<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span lang=EN-US>-----Original Message-----<br>From: rt-users [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Emmanuel Lacour<br>Sent: 30 May 2014 17:32<br>To: rt-users@lists.bestpractical.com<br>Subject: Re: [rt-users] In Line Images in Emails</span><o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>On Fri, May 30, 2014 at 11:57:22AM +0100, Kevin Curtis wrote:<o:p></o:p></p><p class=MsoPlainText>> <o:p></o:p></p><p class=MsoPlainText>> We have found that whenever RT receives an email that contains an inline<o:p></o:p></p><p class=MsoPlainText>> image (internally or externally), any emails that get sent out by RT (for<o:p></o:p></p><p class=MsoPlainText>> example to the CC list or the requestor or the owner) the email that gets<o:p></o:p></p><p class=MsoPlainText>> sent out has the text/html section stripped of any html formatting and the<o:p></o:p></p><p class=MsoPlainText>> text is encased in a <pre> .. </pre> block.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>html/body is stripped in RT::Transaction->Content, but not wrapped in <pre> ...<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>can you send more information (test case) for this problem?<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>> <o:p></o:p></p><p class=MsoPlainText>> There is not an image either.<o:p></o:p></p><p class=MsoPlainText>> <o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>The problem appears when the image is referenced as src="<a href="cid:..."><span style='color:windowtext;text-decoration:none'>cid:...</span></a>". There is a bug caused by the fact that RT changes multipart/related to multipart/mixed that breaks displaying of inline images.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I worked a bit on this but did not found a beautiful fix (as a template may makes reference to another Transaction content than the current one ...).<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>A quick fix is to hack RT::Transaction::Content so it looks for CIDs, then try to find corresponding images attachments in RT::Tickets->Attachments, then replaced the CID by src="data:image...".<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>-- <o:p></o:p></p><p class=MsoPlainText>Easter-eggs Spécialiste GNU/Linux<o:p></o:p></p><p class=MsoPlainText>44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité<o:p></o:p></p><p class=MsoPlainText>Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76<o:p></o:p></p><p class=MsoPlainText><a href="mailto:elacour@easter-eggs.com"><span style='color:windowtext;text-decoration:none'>mailto:elacour@easter-eggs.com</span></a> - <a href="http://www.easter-eggs.com"><span style='color:windowtext;text-decoration:none'>http://www.easter-eggs.com</span></a><o:p></o:p></p><p class=MsoPlainText>--<o:p></o:p></p><p class=MsoPlainText>RT Training - Boston, September 9-10<o:p></o:p></p><p class=MsoPlainText><a href="http://bestpractical.com/training"><span style='color:windowtext;text-decoration:none'>http://bestpractical.com/training</span></a><o:p></o:p></p></div></body></html>