I am trying to consume email messages from a folder on a gmail.com account
using the following URI.

imaps://imap.gmail.com?consumer.delay=60000&delete=false&folderName=camel&mapMailMessage=true&password=xxxxxx&peek=true&unseen=true&username=myu...@gmail.com

And I'm getting the following error:

WARN MailConsumer - Consumer
Consumer[imaps://imap.gmail.com?consumer.delay=60000&delete=false&folderName=camel&mapMailMessage=true&password=xxxxxx&peek=true&unseen=true&username=myu...@gmail.com
failed polling endpoint:
Endpoint[imaps://imap.gmail.com?consumer.delay=60000&delete=false&folderName=camel&mapMailMessage=true&password=xxxxxx&peek=true&unseen=true&username=myu...@gmail.com
[^]]. Will try again at next poll. Caused by:
[javax.mail.AuthenticationFailedException - [ALERT] Please log in via your
web browser: https://support.google.com/mail/accounts/answer/78754 [^]
(Failure)]
javax.mail.AuthenticationFailedException: [ALERT] Please log in via your web
browser: https://support.google.com/mail/accounts/answer/78754 [^] (Failure)
        at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:661)
        at javax.mail.Service.connect(Service.java:317)
        at
org.apache.camel.component.mail.MailConsumer.ensureIsConnected(MailConsumer.java:497)
        at
org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:95)
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)

If I go into the Settings of the myu...@gmail.com account and change the
security setting to allow less secure apps to read the emails it works fine.
Obviously I really don't want to do that.

I suspect it is possible to *programmatically* bump up the security for the
consumer using the JSSE utility and the uri parameter sslContextParameters=,
but I have no idea how. All the examples with JSSE and mail appear to be for
producing emails, not consuming them. 

Has anyone else run into this issue? Is there a code snippet (not xml) you
could point me at that works with consuming emails?




--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-javax-mail-AuthenticationFailedException-when-trying-to-consume-a-gmail-com-account-folder-w-tp5770711.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to