Spring integration - imap - credentials issue

核能气质少年 提交于 2021-02-08 10:20:17

问题


Here is my xml:

<mail:inbound-channel-adapter id="imapAdapter"
                                  store-uri="imaps://[avita.nir@gmail.com]:[secretPass]@imap.gmail.com/INBOX"                                   
                                  channel="recieveEmailChannel"                                         
                                  should-delete-messages="false"
                                  should-mark-messages-as-read="true"                                     
                                  auto-startup="true"                                                                           
                                  java-mail-properties="javaMailProperties">

For some reason when i type this "store-uri" i get this exception (null password):

    DEBUG: protocolConnect returning false, host=gmail.com], user=[avita.nir, password=<null>
21 יול 2013 15:32:05 ERROR LoggingHandler - org.springframework.integration.MessagingException:      failure occurred while polling for mail
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:73)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:145)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:143)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:206)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:201)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
at              org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at         java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolE  xecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.integration.MessagingException: failure occurred while receiving from folder
at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:240)
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:59)
... 18 more
Caused by: javax.mail.AuthenticationFailedException: failed to connect, no password specified?

回答1:


Remove the [ ] and you should be good - also if the username or password contains special characters you will have to escape them.

It's always useful to set mail.debug to true for these issues and you'll get more information on the console.



来源:https://stackoverflow.com/questions/17772435/spring-integration-imap-credentials-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!