Hi Daniel, Thanks for your reply!
I've tried "org.apache.camel.component.mail.SplitAttachmentsExpression". It failed because it used safeCopyProperties "CamelAttachmentObjects" to get email attachment as well. ________________________________ 发件人: Daniel Langevin <daniel.lange...@shq.gouv.qc.ca> 发送时间: 2023年9月7日 0:35 收件人: users@camel.apache.org <users@camel.apache.org> 主题: RE: Email attachment lost with poll enrich Hi, You can try "org.apache.camel.component.mail.SplitAttachmentsExpression" Here a part of my code to achieve with attachment, hope it's Help Daniel ,,, ,,, ,,, <split > <method beanType="org.apache.camel.component.mail.SplitAttachmentsExpression" /> <!-- Attachment name --> <setHeader name="attchName"><groovy>result="null"</groovy></setHeader> <!-- reset to null in each interration --> <setHeader name="attchName"> <!-- decode name (rfc5987) --> <groovy> def MimeUtility = new javax.mail.internet.MimeUtility(); if (request.headers['CamelSplitAttachmentId'] != null ) { result = MimeUtility.decodeText(request.headers['CamelSplitAttachmentId']); } else { result = "null" ; } result = result.replaceAll('/','_'); </groovy> </setHeader> <log message="Attch Name : ${header.attchName} " /> <log message="Attch CamelSplitAttd: ${header.CamelSplitAttachmentId} " /> <log message="Attch splitindex : ${header.CamelSplitIndex} " /> <log message="Attch splitsize : ${header.CamelSplitSize} " /> <choice> <when><simple>${header.attchName} != "null"</simple> <setHeader name="zzCamelSplitAttachmentId" ><simple>${header.CamelSplitAttachmentId.replaceAll('/','_')}</simple></setHeader> <!-- BODY contain attchment in BYTE since camel 3.xx --> <!-- Write the attachment on disk <to uri="file:{{SSStempAttchment}}?fileName=${header.attchName}" /> <stop/> </when> </choice> </split> ,,, ,,, ,,, -----Message d'origine----- De : _ Jane <belief...@hotmail.com> Envoyé : 5 septembre 2023 22:30 À : users@camel.apache.org Objet : Email attachment lost with poll enrich Dear Community, When using poll enrich to get email with attachments, I found that the email attachments lost when I'm using Camel 3.18.6. I tried to debug the programe and found the root cause that PollEnricher uses ExchangeHelper.copyResultsPreservePattern() to copy resource Exchange to result Exchange. But ExchangeHelper.copyResultsPreservePattern() doesn't copy safeCopyProperties which containing the "CamelAttachmentObjects" until it's fixed in Camel 4.0.0. My question is: is there any workaround with less effort to let me get the email attachment with poll enrich using Camel 3.18.6? Regards, Jane