Hi,

when I send a mail message with attachments using the camel-mail component,
the mail message is composed as "multipart mail message" and all of my
camel-message headers are appended to the mail and being sent.

But when I poll a mailbox full of those messages there is a gap (asymmetry):
The camel-mail component does not read and reconstruct all custom headers
into my camel message as expected.

I looked at the source code of the mail-component (Camel 2.10.3) and think I
have found an inconsistency in the method 

protected Map<String, Object> extractHeadersFromMail(Message mailMessage,
Exchange exchange) 

of the MailBinding.java class.
The current version only calls  mailMessage.getAllHeaders() and does *not*
consider that this could be a multipart content or a nested message. I think
there's lack of some more iterators over BodyParts "part.getAllHeaders()"
and/or IMAPNestedMessages "nestedMessage.getAllHeaders()" to really retrieve
*all* possible custom headers - and finally be symmetric to the mail
creation logic.

...
Object content = mailMessage.getContent();
if ( content  instanceof Multipart )
{
  // Iterate over BodyParts and get all headers per part
  ...
}
else if (content  instanceof IMAPNestedMessage)
{
  // Recursively walk through IMAPNestedMessage, find Multiparts and iterate
over BodyParts and get all headers per part
...
}

Can somebody verify or confirm that ?
Is it possible to extend that class and override this function of that
component somehow - or do I have to write a custom mail-component ? Maybe
this will be fixed in a future version of camel ? ...

Best regards 




 



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-component-is-asymmetric-tp5726418.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to