You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by A-Light <an...@outlook.com> on 2014/11/28 18:36:13 UTC

Mail - copyTo not working and MailBoxPostProcessAction not found

Hi all,
I'm using a route that gets new messages from an imap consumer. Something
like this:

  <from
uri="imap://mailserver?username={{usr}}&amp;password={{pwd}}&amp;mapMailMessage=false"/>
  <bean ref=emailSerializer">
  <to uri="activemq:queue:mailQueue"/>

The emails get processed and being sent to the queue, passing from unread to
read (UNSEEN to SEEN) but what I would like to do is moving the processed
email into a "processed" folder on the mailbox.

I tried to get this in two ways, according to the documentation of the Camel
Mail component:
- added the copyTo=processed parameter to the imap uri, but it seems to have
no effect (the folder processed exists in the mailbox)
- adding the postProcessAction=myPostProcess where myPostProcess has to
implement the org.apache.camel.component.mail.MailBoxPostProcessAction but:
  1) the MailBoxPostProcessAction is not recognized as an existent interface
  2) the postProcessAction is not recognized as a valid parameter

I am using Camel 2.14.0.

Can you please help me with this? 
Is there some configuration that I am missing?

Thank you,
A.



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

I suggest if you can do a new test where you dont mark an existing
mail back as unseen, but try with an actual new mail.

Also as camel-mail dont have an unit test for that option, it would be
good to add one. And see if indeed there is a bug, though the option
has been around for years. So others ought to have spotted a problem
before.

And you are welcome to log a JIRA ticket and refer to this thread so
we wont forget and can look into it.

Though I personally have best time in the morning to do Camel stuff,
so maybe I find a slot tomorrow.

On Thu, Dec 4, 2014 at 5:28 PM, A-Light <an...@outlook.com> wrote:
> Hi,
> is there any update on this issue? Is there something I can do to help
> understand why this method is not invoked or in general on how to make this
> feature work?
>
> (reposted with the right account)
>
> Thanks,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5760155.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by A-Light <an...@outlook.com>.
Hi,
is there any update on this issue? Is there something I can do to help
understand why this method is not invoked or in general on how to make this
feature work?

(reposted with the right account)

Thanks,
A. 



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5760155.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by A-Light <an...@outlook.com>.
Oh ok, I got it wrong, sorry :)

I enabled the log and in fact I can see the following lines at each mailbox
polling:

2014-12-01 11:36:05,628 (Camel (mail-test) thread #20 -
imap://mailserver:143) DEBUG [org.apache.camel.component.mail.MailConsumer]
Polling mailbox folder: imap://mailserver:143, folder=INBOX
2014-12-01 11:36:05,666 (Camel (mail-test) thread #20 -
imap://mailserver:143) DEBUG [org.apache.camel.component.mail.MailConsumer]
Fetching 0 messages. Total 0 messages.
2014-12-01 11:36:05,667 (Camel (mail-test) thread #20 -
imap://mailserver:143) DEBUG [org.apache.camel.component.mail.MailConsumer]
Close mailbox folder INBOX from imap://mailserver:143, folder=INBOX

But when I mark an email as unread, I see the email going through the route
but nowhere in the log I can see the message "folder.copyMessages". 

Just to clarify: as a quick way to test the route, I'm simply marking an
existing email as unread instead of actually sending a new email to the
mailbox, but I already verified that the behavior doesn't change.

What can I do to help know?

Thanks,
A.




--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5759862.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by Claus Ibsen <cl...@gmail.com>.
I refer to the logging configuration, eg if using log4j then its the
log4j.properties or its .xml file you set the logging levels. Then set
the level to TRACE for org.apache.camel.component.mail

On Mon, Dec 1, 2014 at 12:00 PM, A-Light <an...@outlook.com> wrote:
> Hi Claus,
> thank you for your answer.
>
> I enabled the trace both by adding the "debugMode=true" in the uri
> parameters and by placing trace="true" in the context but in the log I
> didn't see any row containing "folder.copyMessages".
>
> What I saw in the log that seems related to the "process" folder is:
>
>   DEBUG IMAP: LOGIN command result: A1 OK LOGIN completed
>   A2 CAPABILITY
>   * CAPABILITY IMAP4 IMAP4rev1 CHILDREN IDLE QUOTA SORT ACL NAMESPACE
> RIGHTS=texk
>   A2 OK CAPABILITY completed
>   A3 LIST "" processed
>   * LIST (\HasNoChildren) "." "processed"
>   A3 OK LIST completed
>   A190 COPY 173 processed
>   A190 OK COPY completed
>   A191 STORE 173 +FLAGS (\Seen)
>   * 173 FETCH (FLAGS (\Seen) UID 180)
>   A191 OK STORE completed
>   DEBUG IMAP: pool is full, not adding an Authenticated connection
>   A192 CLOSE
>   A192 OK CLOSE completed
>   A193 LOGOUT
>   * BYE Have a nice day
>   A193 OK Logout completed
>
> But anyway, the email remained in the inbox after the processing.
>
> What can I provide to better understand what's happening?
>
> Thank you,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5759855.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by A-Light <an...@outlook.com>.
Hi Claus,
thank you for your answer.

I enabled the trace both by adding the "debugMode=true" in the uri
parameters and by placing trace="true" in the context but in the log I
didn't see any row containing "folder.copyMessages".

What I saw in the log that seems related to the "process" folder is: 

  DEBUG IMAP: LOGIN command result: A1 OK LOGIN completed
  A2 CAPABILITY
  * CAPABILITY IMAP4 IMAP4rev1 CHILDREN IDLE QUOTA SORT ACL NAMESPACE
RIGHTS=texk
  A2 OK CAPABILITY completed
  A3 LIST "" processed
  * LIST (\HasNoChildren) "." "processed"
  A3 OK LIST completed
  A190 COPY 173 processed
  A190 OK COPY completed
  A191 STORE 173 +FLAGS (\Seen)
  * 173 FETCH (FLAGS (\Seen) UID 180)
  A191 OK STORE completed
  DEBUG IMAP: pool is full, not adding an Authenticated connection
  A192 CLOSE
  A192 OK CLOSE completed
  A193 LOGOUT
  * BYE Have a nice day
  A193 OK Logout completed

But anyway, the email remained in the inbox after the processing.

What can I provide to better understand what's happening?

Thank you,
A.



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5759855.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by Claus Ibsen <cl...@gmail.com>.
You can enable TRACE logging on the camel-mail component and it should
log that it copies the message.

  folder.copyMessages(new Message[]{mail}, destFolder);
                    LOG.trace("IMAP message {} copied to {}", mail, copyTo);

Can you see if you can see that?

On Fri, Nov 28, 2014 at 6:36 PM, A-Light <an...@outlook.com> wrote:
> Hi all,
> I'm using a route that gets new messages from an imap consumer. Something
> like this:
>
>   <from
> uri="imap://mailserver?username={{usr}}&amp;password={{pwd}}&amp;mapMailMessage=false"/>
>   <bean ref=emailSerializer">
>   <to uri="activemq:queue:mailQueue"/>
>
> The emails get processed and being sent to the queue, passing from unread to
> read (UNSEEN to SEEN) but what I would like to do is moving the processed
> email into a "processed" folder on the mailbox.
>
> I tried to get this in two ways, according to the documentation of the Camel
> Mail component:
> - added the copyTo=processed parameter to the imap uri, but it seems to have
> no effect (the folder processed exists in the mailbox)
> - adding the postProcessAction=myPostProcess where myPostProcess has to
> implement the org.apache.camel.component.mail.MailBoxPostProcessAction but:
>   1) the MailBoxPostProcessAction is not recognized as an existent interface
>   2) the postProcessAction is not recognized as a valid parameter
>
> I am using Camel 2.14.0.
>
> Can you please help me with this?
> Is there some configuration that I am missing?
>
> Thank you,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

Thanks for coming back and telling us the solution.

And also we now have an unit test for that functionality, so its only good.

On Thu, Feb 5, 2015 at 3:34 PM, A.Light <an...@axiossystems.com> wrote:
> Ok, at the end, I found what my problem was. I'm ashamed to admit, the
> problem was between the keyboard and the chair, thus me.
>
> This are the gotchas:
> - I created the folder "process" under inbox, but with the command
> "copyTo=process" I'm actually referring to a folder at the root of the email
> folder hierarchy, which means at the same level of inbox, so emails were not
> going to appear where I expected under "/inbox/processed" but instead under
> "/processed";
> - During my tests, the mail component created a new folder called "process"
> at the root of the hierarchy and diligently copied all my emails there...
> only I coudn't see it because Thunderbird/Outlook default server setting is
> "Show only subscribed folder" so that folder never showed up.
>
> So the feature works also for me! :)
>
> Thanks for your help,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5762417.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by "A.Light" <an...@axiossystems.com>.
Ok, at the end, I found what my problem was. I'm ashamed to admit, the
problem was between the keyboard and the chair, thus me.

This are the gotchas:
- I created the folder "process" under inbox, but with the command
"copyTo=process" I'm actually referring to a folder at the root of the email
folder hierarchy, which means at the same level of inbox, so emails were not
going to appear where I expected under "/inbox/processed" but instead under
"/processed";
- During my tests, the mail component created a new folder called "process"
at the root of the hierarchy and diligently copied all my emails there...
only I coudn't see it because Thunderbird/Outlook default server setting is
"Show only subscribed folder" so that folder never showed up.

So the feature works also for me! :)

Thanks for your help,
A.



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5762417.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

I added an unit test of the copyTo function
https://github.com/apache/camel/commit/5a4d715a1b065a3598ad0ef85b98da81f438c0b5

Not sure why it fails for you. Maybe its some permission issue or the
copyTo folder does not exists, and cannot be created or something.

Your best chance is to run with debug and then step through the code
in camel-mail and see what happens in the MailConsumer class.



On Tue, Jan 6, 2015 at 3:26 PM, A-Light <an...@outlook.com> wrote:
> Oh Claus,
> I see!!! I'm very sorry I didn't notice the release is different!!!
>
> Ok, so never mind about the postProcessAction issue, when the 2.15 camel
> release will be available on maven I'll consider upgrading.
>
> What remains open is why the copyTo parameter doesn't work in my route.
>
> Thanks a lot,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5761385.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by A-Light <an...@outlook.com>.
Oh Claus,
I see!!! I'm very sorry I didn't notice the release is different!!!

Ok, so never mind about the postProcessAction issue, when the 2.15 camel
release will be available on maven I'll consider upgrading.

What remains open is why the copyTo parameter doesn't work in my route.

Thanks a lot,
A.



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5761385.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

Ah also always check the documentation
http://camel.apache.org/mail

That options is a new option in Camel 2.15 onwards. So you cannot use
it with an older Camel release.

On Tue, Jan 6, 2015 at 2:37 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> See this unit test
> https://github.com/apache/camel/blob/master/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPostProcessActionTest.java
>
> On Tue, Jan 6, 2015 at 10:40 AM, A-Light <an...@outlook.com> wrote:
>> Hi Claus,
>> thanks for the info! But it looks like the problem is somewhere else.
>>
>> I tried to:
>> - create a class that implements
>> org.apache.camel.component.mail.MailBoxPostProcessAction but that interface
>> is not existent, so the compiler says
>> "org.apache.camel.component.mail.MailBoxPostProcessAction cannot be resolved
>> to a type";
>> - tried to enable the post process on an object that doesn't implement that
>> interface, called emailPostProcess, by adding the
>> postProcessAction=#emailPostProcess parameter but the compiler says:
>>
>> org.apache.camel.RuntimeCamelException:
>> org.apache.camel.FailedToCreateRouteException: Failed to create route
>> test-mail: Route(test-mail)[[From[{{as-props.in-protocol}}:/... because of
>> Failed to resolve endpoint:
>> imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
>> due to: Failed to resolve endpoint:
>> imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
>> due to: There are 1 parameters that couldn't be set on the endpoint. Check
>> the uri if the parameters are spelt correctly and that they are properties
>> of the endpoint. Unknown parameters=[{postProcessAction=#emailPostProcess}]
>>
>> Is this due to the missing interface implementation on my "emailPostProcess"
>> class or there is something else missing somewhere?
>>
>> Thank you for your help!
>> A.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5761363.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

See this unit test
https://github.com/apache/camel/blob/master/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPostProcessActionTest.java

On Tue, Jan 6, 2015 at 10:40 AM, A-Light <an...@outlook.com> wrote:
> Hi Claus,
> thanks for the info! But it looks like the problem is somewhere else.
>
> I tried to:
> - create a class that implements
> org.apache.camel.component.mail.MailBoxPostProcessAction but that interface
> is not existent, so the compiler says
> "org.apache.camel.component.mail.MailBoxPostProcessAction cannot be resolved
> to a type";
> - tried to enable the post process on an object that doesn't implement that
> interface, called emailPostProcess, by adding the
> postProcessAction=#emailPostProcess parameter but the compiler says:
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> test-mail: Route(test-mail)[[From[{{as-props.in-protocol}}:/... because of
> Failed to resolve endpoint:
> imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
> due to: Failed to resolve endpoint:
> imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
> due to: There are 1 parameters that couldn't be set on the endpoint. Check
> the uri if the parameters are spelt correctly and that they are properties
> of the endpoint. Unknown parameters=[{postProcessAction=#emailPostProcess}]
>
> Is this due to the missing interface implementation on my "emailPostProcess"
> class or there is something else missing somewhere?
>
> Thank you for your help!
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5761363.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

Posted by A-Light <an...@outlook.com>.
Hi Claus,
thanks for the info! But it looks like the problem is somewhere else.

I tried to:
- create a class that implements
org.apache.camel.component.mail.MailBoxPostProcessAction but that interface
is not existent, so the compiler says
"org.apache.camel.component.mail.MailBoxPostProcessAction cannot be resolved
to a type";
- tried to enable the post process on an object that doesn't implement that
interface, called emailPostProcess, by adding the
postProcessAction=#emailPostProcess parameter but the compiler says:

org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
test-mail: Route(test-mail)[[From[{{as-props.in-protocol}}:/... because of
Failed to resolve endpoint:
imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
due to: Failed to resolve endpoint:
imap://mailserver?mapMailMessage=false&password={{pwd}}&postProcessAction=%23emailPostProcess&username={{usr}}
due to: There are 1 parameters that couldn't be set on the endpoint. Check
the uri if the parameters are spelt correctly and that they are properties
of the endpoint. Unknown parameters=[{postProcessAction=#emailPostProcess}]

Is this due to the missing interface implementation on my "emailPostProcess"
class or there is something else missing somewhere?

Thank you for your help!
A.



--
View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776p5761363.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail - copyTo not working and MailBoxPostProcessAction not found

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

btw for postProcessAction=myPostProcess you should use
postProcessAction=#myPostProcess.

See referring beans from uris section at
http://camel.apache.org/how-do-i-configure-endpoints.html

On Fri, Nov 28, 2014 at 6:36 PM, A-Light <an...@outlook.com> wrote:
> Hi all,
> I'm using a route that gets new messages from an imap consumer. Something
> like this:
>
>   <from
> uri="imap://mailserver?username={{usr}}&amp;password={{pwd}}&amp;mapMailMessage=false"/>
>   <bean ref=emailSerializer">
>   <to uri="activemq:queue:mailQueue"/>
>
> The emails get processed and being sent to the queue, passing from unread to
> read (UNSEEN to SEEN) but what I would like to do is moving the processed
> email into a "processed" folder on the mailbox.
>
> I tried to get this in two ways, according to the documentation of the Camel
> Mail component:
> - added the copyTo=processed parameter to the imap uri, but it seems to have
> no effect (the folder processed exists in the mailbox)
> - adding the postProcessAction=myPostProcess where myPostProcess has to
> implement the org.apache.camel.component.mail.MailBoxPostProcessAction but:
>   1) the MailBoxPostProcessAction is not recognized as an existent interface
>   2) the postProcessAction is not recognized as a valid parameter
>
> I am using Camel 2.14.0.
>
> Can you please help me with this?
> Is there some configuration that I am missing?
>
> Thank you,
> A.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-copyTo-not-working-and-MailBoxPostProcessAction-not-found-tp5759776.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/