You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mi Jane 米静 <Ja...@universalbeijing.com> on 2022/08/31 08:28:59 UTC

Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane


RE: Poll enrich with mail component will lose attachments

Posted by Daniel Langevin <da...@shq.gouv.qc.ca>.
Hi, 

You can try adding &disconnect=false, in your imaps parameter.

Hope it's help.


Daniel



-----Message d'origine-----
De : Mi Jane 米静 <Ja...@universalbeijing.com> 
Envoyé : 31 août 2022 04:29
À : users@camel.apache.org
Objet : Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane


Re: Poll enrich with mail component will lose attachments

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you try with Camel 3.18.x

On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Dear community,
>
> When I used Camel 3.11, poll enrich with mail component worked well and I
> could get the mail attachments.
> When I changed to Camel 3.16 for other reasons, I could get the mail but I
> couldn’t get the attachments.
>
> Here is an example:
>
> ……
>
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> .process(new Processor() {
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                                 AttachmentMessage attachmentMessage =
> exchange.getMessage(AttachmentMessage.class);
>                                 Map<String, DataHandler> attachments =
> attachmentMessage.getAttachments();
>                                 if (attachments != null) {
>                                                 LOGGER.info("attachments:
> {}", attachments.size());
>                                 } else {
>                                                 LOGGER.info("no
> attachment");
>                                 }
>                 }
> })
> ……
>
> With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got
> log “no attachment”.
> Is it a known issue for Camel 3.16, or is there any extra parameter I
> missed? Thanks in advance!
>
> Regards,
> Jane
>
>

-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Poll enrich with mail component will lose attachments

Posted by Mi Jane 米静 <Ja...@universalbeijing.com>.
Hi Claus,

Yes. My test of poll enrich + mail is local running on vanilla Quarkus and Camel, not Camel K.

Here are the results:
i. Test Camel 3.18 Quarkus 2.11: no attachment
ii. Test Camel 3.17 Quarkus 2.10: no attachment
iii. Test Camel 3.16 Quarkus 2.9: no attachment
iv. Test Camel 3.16 Quarkus 2.8: no attachment
v. Test Camel 3.14 Quarkus 2.7: get attachment
vi. Test Camel 3.11 Quarkus 2.2.5: get attachment

Regards,
Jane

-----Original Message-----
From: Claus Ibsen <cl...@gmail.com> 
Sent: Tuesday, September 6, 2022 6:17 PM
To: users@camel.apache.org
Subject: Re: Poll enrich with mail component will lose attachments

Hi

Did you test this on vanilla Quarkus and Camel (not Camel K)


On Tue, Sep 6, 2022 at 7:27 AM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Hi Claus,
>
> I tested Camel 3.18.0 with Quarkus 2.11.0. The result is the same: I 
> got the mail message but no attachment.
>
> Regards,
> Jane
>
> -----Original Message-----
> From: Claus Ibsen <cl...@gmail.com>
> Sent: Friday, September 2, 2022 1:51 PM
> To: users@camel.apache.org
> Subject: Re: Poll enrich with mail component will lose attachments
>
> Hi
>
> Can you try testing with 3.18.x
>
> On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 
> <Ja...@universalbeijing.com>
> wrote:
>
> > Dear community,
> >
> > When I used Camel 3.11, poll enrich with mail component worked well 
> > and I could get the mail attachments.
> > When I changed to Camel 3.16 for other reasons, I could get the mail 
> > but I couldn’t get the attachments.
> >
> > Here is an example:
> >
> > ……
> >
> > .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFold
> > er
> > =false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> > .process(new Processor() {
> >                 @Override
> >                 public void process(Exchange exchange) throws Exception {
> >                                 AttachmentMessage attachmentMessage 
> > = exchange.getMessage(AttachmentMessage.class);
> >                                 Map<String, DataHandler> attachments 
> > = attachmentMessage.getAttachments();
> >                                 if (attachments != null) {
> >                                                 LOGGER.info("attachments:
> > {}", attachments.size());
> >                                 } else {
> >                                                 LOGGER.info("no 
> > attachment");
> >                                 }
> >                 }
> > })
> > ……
> >
> > With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I 
> > got log “no attachment”.
> > Is it a known issue for Camel 3.16, or is there any extra parameter 
> > I missed? Thanks in advance!
> >
> > Regards,
> > Jane
> >
> >
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Poll enrich with mail component will lose attachments

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Did you test this on vanilla Quarkus and Camel (not Camel K)


On Tue, Sep 6, 2022 at 7:27 AM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Hi Claus,
>
> I tested Camel 3.18.0 with Quarkus 2.11.0. The result is the same: I got
> the mail message but no attachment.
>
> Regards,
> Jane
>
> -----Original Message-----
> From: Claus Ibsen <cl...@gmail.com>
> Sent: Friday, September 2, 2022 1:51 PM
> To: users@camel.apache.org
> Subject: Re: Poll enrich with mail component will lose attachments
>
> Hi
>
> Can you try testing with 3.18.x
>
> On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 <Ja...@universalbeijing.com>
> wrote:
>
> > Dear community,
> >
> > When I used Camel 3.11, poll enrich with mail component worked well
> > and I could get the mail attachments.
> > When I changed to Camel 3.16 for other reasons, I could get the mail
> > but I couldn’t get the attachments.
> >
> > Here is an example:
> >
> > ……
> >
> > .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder
> > =false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> > .process(new Processor() {
> >                 @Override
> >                 public void process(Exchange exchange) throws Exception {
> >                                 AttachmentMessage attachmentMessage =
> > exchange.getMessage(AttachmentMessage.class);
> >                                 Map<String, DataHandler> attachments =
> > attachmentMessage.getAttachments();
> >                                 if (attachments != null) {
> >                                                 LOGGER.info("attachments:
> > {}", attachments.size());
> >                                 } else {
> >                                                 LOGGER.info("no
> > attachment");
> >                                 }
> >                 }
> > })
> > ……
> >
> > With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I
> > got log “no attachment”.
> > Is it a known issue for Camel 3.16, or is there any extra parameter I
> > missed? Thanks in advance!
> >
> > Regards,
> > Jane
> >
> >
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Poll enrich with mail component will lose attachments

Posted by "Mattern, Alex" <al...@bbh.com.INVALID>.
Mi Jane,

You could consider writing your own custom:
MiJaneEmailEndpoint extends DefaultEndpoint
MiJaneEmailComponent extends DefaultComponent
MiJaneEmailPollConsumer extends ScheduledPollConsumer

This is as we have done and we can receive attachments from Microsoft Exchange. Camel version 3.7.2

Alex Mattern

-----Original Message-----
From: Mi Jane 米静 <Ja...@universalbeijing.com> 
Sent: Tuesday, September 6, 2022 1:28 AM
To: users@camel.apache.org
Subject: [EXTERNAL SENDER:] RE: Poll enrich with mail component will lose attachments

Hi Claus,

I tested Camel 3.18.0 with Quarkus 2.11.0. The result is the same: I got the mail message but no attachment.

Regards,
Jane

-----Original Message-----
From: Claus Ibsen <cl...@gmail.com>
Sent: Friday, September 2, 2022 1:51 PM
To: users@camel.apache.org
Subject: Re: Poll enrich with mail component will lose attachments

Hi

Can you try testing with 3.18.x

On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Dear community,
>
> When I used Camel 3.11, poll enrich with mail component worked well 
> and I could get the mail attachments.
> When I changed to Camel 3.16 for other reasons, I could get the mail 
> but I couldn’t get the attachments.
>
> Here is an example:
>
> ……
>
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder
> =false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> .process(new Processor() {
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                                 AttachmentMessage attachmentMessage = 
> exchange.getMessage(AttachmentMessage.class);
>                                 Map<String, DataHandler> attachments = 
> attachmentMessage.getAttachments();
>                                 if (attachments != null) {
>                                                 LOGGER.info("attachments:
> {}", attachments.size());
>                                 } else {
>                                                 LOGGER.info("no 
> attachment");
>                                 }
>                 }
> })
> ……
>
> With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I 
> got log “no attachment”.
> Is it a known issue for Camel 3.16, or is there any extra parameter I 
> missed? Thanks in advance!
>
> Regards,
> Jane
>
>

--
Claus Ibsen
-----------------
https://urldefense.com/v3/__http://davsclaus.com__;!!KV6Wb-o!8Yd-C1AxawtkFQ2Caaw1Osv8YfGqq80fe34VX3VG0JcFyt_87Y4X_eLPWreVCz1HppafhKrKY2dtNypxSRC9hqcf$   @davsclaus
Camel in Action 2: https://urldefense.com/v3/__https://www.manning.com/ibsen2__;!!KV6Wb-o!8Yd-C1AxawtkFQ2Caaw1Osv8YfGqq80fe34VX3VG0JcFyt_87Y4X_eLPWreVCz1HppafhKrKY2dtNypxSYVDXpOl$  

*************************** IMPORTANT NOTE*****************************
The opinions expressed in this message and/or any attachments are those of the author and not necessarily those of Brown Brothers Harriman & Co., its subsidiaries and affiliates ("BBH"). There is no guarantee that this message is either private or confidential, and it may have been altered by unauthorized sources without your or our knowledge. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. BBH accepts no responsibility for loss or damage from its use, including damage from virus.
******************************************************************************

RE: Poll enrich with mail component will lose attachments

Posted by Mi Jane 米静 <Ja...@universalbeijing.com>.
Hi Claus,

I tested Camel 3.18.0 with Quarkus 2.11.0. The result is the same: I got the mail message but no attachment.

Regards,
Jane

-----Original Message-----
From: Claus Ibsen <cl...@gmail.com> 
Sent: Friday, September 2, 2022 1:51 PM
To: users@camel.apache.org
Subject: Re: Poll enrich with mail component will lose attachments

Hi

Can you try testing with 3.18.x

On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Dear community,
>
> When I used Camel 3.11, poll enrich with mail component worked well 
> and I could get the mail attachments.
> When I changed to Camel 3.16 for other reasons, I could get the mail 
> but I couldn’t get the attachments.
>
> Here is an example:
>
> ……
>
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder
> =false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> .process(new Processor() {
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                                 AttachmentMessage attachmentMessage = 
> exchange.getMessage(AttachmentMessage.class);
>                                 Map<String, DataHandler> attachments = 
> attachmentMessage.getAttachments();
>                                 if (attachments != null) {
>                                                 LOGGER.info("attachments:
> {}", attachments.size());
>                                 } else {
>                                                 LOGGER.info("no 
> attachment");
>                                 }
>                 }
> })
> ……
>
> With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I 
> got log “no attachment”.
> Is it a known issue for Camel 3.16, or is there any extra parameter I 
> missed? Thanks in advance!
>
> Regards,
> Jane
>
>

--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Poll enrich with mail component will lose attachments

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you try testing with 3.18.x

On Wed, Aug 31, 2022 at 12:41 PM Mi Jane 米静 <Ja...@universalbeijing.com>
wrote:

> Dear community,
>
> When I used Camel 3.11, poll enrich with mail component worked well and I
> could get the mail attachments.
> When I changed to Camel 3.16 for other reasons, I could get the mail but I
> couldn’t get the attachments.
>
> Here is an example:
>
> ……
>
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
> .process(new Processor() {
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                                 AttachmentMessage attachmentMessage =
> exchange.getMessage(AttachmentMessage.class);
>                                 Map<String, DataHandler> attachments =
> attachmentMessage.getAttachments();
>                                 if (attachments != null) {
>                                                 LOGGER.info("attachments:
> {}", attachments.size());
>                                 } else {
>                                                 LOGGER.info("no
> attachment");
>                                 }
>                 }
> })
> ……
>
> With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got
> log “no attachment”.
> Is it a known issue for Camel 3.16, or is there any extra parameter I
> missed? Thanks in advance!
>
> Regards,
> Jane
>
>

-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Poll enrich with mail component will lose attachments

Posted by Mi Jane 米静 <Ja...@universalbeijing.com>.
Hi Daniel,

you say you don't have an attachment, did you make sure you got at least a message body ???
Because the problem may come from the PollEnrich.

Jane: Yes. I got the message body but no attachment. It's working well if I use only mail consumer, no matter which version of camel. The problem seems to be come from PollEnrich + Mail with Camel 3.18.

I make a little test with my environment Camel version 3.14.3 running into karaf 4.3.3

Jane: It's also working well when I used Camel 3.16... it's just, I wanted to upgrade the Camel dependency version to fix some other issues and then found the problem...



Regards,
Jane

-----Original Message-----
From: Daniel Langevin <da...@shq.gouv.qc.ca> 
Sent: Thursday, September 1, 2022 9:04 PM
To: users@camel.apache.org
Subject: RE: Poll enrich with mail component will lose attachments

Hi Jane,
I make a little test with my environment Camel version 3.14.3 running into karaf 4.3.3

Here a simple rest service extract from a blueprint  deployment and it works very well, with and without an attachment !!!!

<rest path="/readMail"  produces="application/json" >  <description>TTT - Poll imap read With PollEnrich</description>  <get uri="/">
   <route id="rte.TTT.rest.readMail" >
   <pollEnrich >
     <simple>imaps://{{SHQ_imap_server}}?username={{SHQ_imap_user}}&amp;password={{SHQ_imap_pwd}}&amp;delete=true&amp;unseen=true&amp;peek=true&amp;mapMailMessage=true&amp;closeFolder=false&amp;debugMode=true</simple>
   </pollEnrich>
   <setHeader name="zzLOG"><groovy>
   import javax.activation.DataHandler;
   import org.apache.camel.attachment.*;
   AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
   Map&lt;String, DataHandler&gt; attachments = attachmentMessage.getAttachments();
        if (attachments != null) {
           result="Yes attachment";
        } else {
           result="No attachment";
        }
   </groovy></setHeader>
   <log message="Attachment ? = ${header.zzLOG}"/>
   </route>
 </get>
</rest>


Regards

Daniel

-----Message d'origine-----
De : Mi Jane 米静 <Ja...@universalbeijing.com> Envoyé : 1 septembre 2022 00:31 À : users@camel.apache.org Objet : RE: Poll enrich with mail component will lose attachments

Hi Claus, Hi Daniel,

Thanks for your reply!

I tried Camel 3.18.X and “&disconnect=false”. It’s still not working.

Regards,
Jane

From: Mi Jane 米静
Sent: Wednesday, August 31, 2022 4:29 PM
To: users@camel.apache.org
Subject: Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane


RE: Poll enrich with mail component will lose attachments

Posted by Daniel Langevin <da...@shq.gouv.qc.ca>.
Hi Jane,
I make a little test with my environment Camel version 3.14.3 running into karaf 4.3.3

Here a simple rest service extract from a blueprint  deployment and it works very well, with and without an attachment !!!!

<rest path="/readMail"  produces="application/json" >
 <description>TTT - Poll imap read With PollEnrich</description>
 <get uri="/">
   <route id="rte.TTT.rest.readMail" >
   <pollEnrich >
     <simple>imaps://{{SHQ_imap_server}}?username={{SHQ_imap_user}}&amp;password={{SHQ_imap_pwd}}&amp;delete=true&amp;unseen=true&amp;peek=true&amp;mapMailMessage=true&amp;closeFolder=false&amp;debugMode=true</simple>
   </pollEnrich>
   <setHeader name="zzLOG"><groovy>
   import javax.activation.DataHandler;
   import org.apache.camel.attachment.*;
   AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
   Map&lt;String, DataHandler&gt; attachments = attachmentMessage.getAttachments();
        if (attachments != null) {
           result="Yes attachment";
        } else {
           result="No attachment";
        }
   </groovy></setHeader>
   <log message="Attachment ? = ${header.zzLOG}"/>
   </route>
 </get>
</rest>


Regards

Daniel

-----Message d'origine-----
De : Mi Jane 米静 <Ja...@universalbeijing.com> 
Envoyé : 1 septembre 2022 00:31
À : users@camel.apache.org
Objet : RE: Poll enrich with mail component will lose attachments

Hi Claus, Hi Daniel,

Thanks for your reply!

I tried Camel 3.18.X and “&disconnect=false”. It’s still not working.

Regards,
Jane

From: Mi Jane 米静
Sent: Wednesday, August 31, 2022 4:29 PM
To: users@camel.apache.org
Subject: Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane


RE: Poll enrich with mail component will lose attachments

Posted by Daniel Langevin <da...@shq.gouv.qc.ca>.
Hello Jane,

you say you don't have an attachment, did you make sure you got at least a message body ???
Because the problem may come from the PollEnrich.



Regards,
Daniel


-----Message d'origine-----
De : Mi Jane 米静 <Ja...@universalbeijing.com> 
Envoyé : 1 septembre 2022 00:31
À : users@camel.apache.org
Objet : RE: Poll enrich with mail component will lose attachments

Hi Claus, Hi Daniel,

Thanks for your reply!

I tried Camel 3.18.X and “&disconnect=false”. It’s still not working.

Regards,
Jane

From: Mi Jane 米静
Sent: Wednesday, August 31, 2022 4:29 PM
To: users@camel.apache.org
Subject: Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane


RE: Poll enrich with mail component will lose attachments

Posted by Mi Jane 米静 <Ja...@universalbeijing.com>.
Hi Claus, Hi Daniel,

Thanks for your reply!

I tried Camel 3.18.X and “&disconnect=false”. It’s still not working.

Regards,
Jane

From: Mi Jane 米静
Sent: Wednesday, August 31, 2022 4:29 PM
To: users@camel.apache.org
Subject: Poll enrich with mail component will lose attachments

Dear community,

When I used Camel 3.11, poll enrich with mail component worked well and I could get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I couldn’t get the attachments.

Here is an example:

……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                                AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class);
                                Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
                                if (attachments != null) {
                                                LOGGER.info("attachments: {}", attachments.size());
                                } else {
                                                LOGGER.info("no attachment");
                                }
                }
})
……

With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed? Thanks in advance!

Regards,
Jane