0

我正在尝试使用 Spring Integration 连接到 MS Exchange Server,但找不到正确的配置示例来执行此操作。

我玩过 Spring Integration github repo,并且我已经成功地创建了使用 Spring Integration 从我的 gmail 帐户读取和发送电子邮件的应用程序。我现在正尝试对我的 hotmail 帐户做同样的事情,这就是我遇到问题的地方。

我在网上进行了广泛搜索,发现了用于连接到 Exchange 服务器的 EWS 配置,我已经成功复制了我的应用程序,并且它正在与 EWS 一起使用。

然而,我真正想做的是在我的应用程序中使用 Spring Integration 来阅读我的 hotmail 电子邮件。我找到了这个页面: 使用 Spring Integration Mail 连接到 Microsoft Exchange Server,但是在尝试了页面上指定的配置后,我无法获得有效的连接。

任何人都可以帮助通道适配器的正确 store-uri 吗?我相信我可能对hotmail有误。我正在使用:outlook.office365.com 作为我的网址,但一直失败。

我使用了这个配置:

<int-mail:imap-idle-channel-adapter id="customAdapter"
            store-uri="imaps://MYHOTMAILEMAILID:MYPASSWORD@outlook.office365.com/ews/exchange.asmx/inbox"
            channel="receiveChannel"
            auto-startup="true"
            should-delete-messages="false"
            should-mark-messages-as-read="false"
            java-mail-properties="javaMailProperties"/>

我还根据我在网上找到的建议尝试了很多变体,但没有一个配置有效。

11:47:30.573 WARN  [task-scheduler-1][org.springframework.integration.mail.ImapIdleChannelAdapter] error occurred in idle task
javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732) ~[javax.mail-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:246) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:195) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:332) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:339) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:170) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:289) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:254) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_192]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
11:47:30.582 WARN  [task-scheduler-1][org.springframework.integration.mail.ImapIdleChannelAdapter] Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.
java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:305) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:254) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_192]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
Caused by: javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732) ~[javax.mail-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:246) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:195) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:332) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:339) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:170) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:289) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    ... 10 more
11:47:41.717 WARN  [task-scheduler-1][org.springframework.integration.mail.ImapIdleChannelAdapter] error occurred in idle task
javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732) ~[javax.mail-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:246) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:195) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:332) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:339) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:170) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:289) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:254) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_192]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
11:47:41.718 WARN  [task-scheduler-1][org.springframework.integration.mail.ImapIdleChannelAdapter] Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.
java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:305) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:254) [spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.0.M2.jar:5.2.0.M2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_192]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_192]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
Caused by: javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732) ~[javax.mail-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:246) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at javax.mail.Service.connect(Service.java:195) ~[javax.mail-api-1.6.2.jar:1.6.2]
    at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:332) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:339) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:170) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:289) ~[spring-integration-mail-5.2.0.M2.jar:5.2.0.M2]
    ... 10 more
4

0 回答 0