[ 
https://issues.apache.org/activemq/browse/CAMEL-2054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54681#action_54681
 ] 

slad commented on CAMEL-2054:
-----------------------------

Thanks Claus for the fix. Yes, truncating 4 char in filename is not RFC 
standard but the problem is filename shows up as "cid:filename" in email, which 
is not nice as users do not see readable filename in the email. I hope this 
gets fixed.

I mentioned wrong fix above, it should be conditional i.e.

+                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
+                        
messageBodyPart.setFileName(attachmentFilename.substring(4));
+                    } else {
+                        messageBodyPart.setFileName(attachmentFilename);
+                    }

Regarding, unique name for content-id, it can be tough one to resolve as camel 
generated content-id has to be than replace in any of the mail parts which are 
referencing it.

For ex: If I have logo.gif as attachment, I may have referenced it in email 
body like <img src="cid:logo.gif" /> 

So if camel generates unique content-id for this part as lets say - 123ABC than 
part will have Content-ID: <123ABC> than we have to change the reference for 
all logo.gif in body part 

i.e. above image reference should now get changed to <img src="123ABC" />

Thanks!


> Mail Component: Content-ID reference in multipart broken
> --------------------------------------------------------
>
>                 Key: CAMEL-2054
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2054
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.1, 1.6.2, 2.0.0
>         Environment: Email clients like gmail, zimbra. Outlook 2003 works
>            Reporter: slad
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.1.0
>
>
> It looks like Camel Mail Component does not set Content-ID mime header 
> correctly or probably assumption is that BodyPart will take care of it. As a 
> result embedded images in html body do not work ( img src="cid:somename.img").
> Currently Content-ID is set as -
> //MailBinding.java
> // add a Content-ID header to the attachment
> messageBodyPart.addHeader("Content-ID", attachmentFilename.substring(4));
> But according to RFC standards [http://www.ietf.org/rfc/rfc2392.txt], 
> Content-ID value should be enclosed with in angle brackets, so it should be 
> modified to -
> //MailBinding.java
> // add a Content-ID header to the attachment
> messageBodyPart.addHeader("Content-ID", "<" + attachmentFilename.substring(4) 
> + ">");
> Also, below should be modified which incorrectly sets fileName inclusive of 
> "cid:", but expectation would be strip off "cid" off it, similar to Content-ID
> // Set the filename
> messageBodyPart.setFileName(attachmentFilename);
> Should be -
> // Set the filename
> messageBodyPart.setFileName(attachmentFilename.substring(4));
> Also, RFC standard mentions that Content-ID should be globally unique but 
> Camel Mail just sets it to filename instead. I understand this can be 
> problematic as camel will have to replace references to each of such cid's  
> in any of the mail parts. 
> As I understand from RFC document, is that this is required in case you send 
> emails itself attachments, and attachments can same name can trample each 
> other(I may be wrong here). I guess we can live with this for a while :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to