以下是我用于 pop3 连接的 spring 配置 bean,
@Bean
public IntegrationFlow mailListener() {
return IntegrationFlows.from(Mail.pop3InboundAdapter("pop3://sample.test:Sample2test_1@xxx.xx.x.xx/INBOX")
.shouldDeleteMessages(true).get(),
e -> e.poller(Pollers.fixedRate(5000).maxMessagesPerPoll(1)))
.<Message>handle((payload, header) -> logMail(payload))
.get();
}
还仔细检查了看起来不错的凭据。得到以下异常,
2018-06-22 19:27:54.351 错误 2092 --- [ask-scheduler-2] osintegration.handler.LoggingHandler:org.springframework.messaging.MessagingException:轮询邮件时发生故障;嵌套异常是 javax.mail.AuthenticationFailedException: 在 org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:224) 在org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:245) 在 org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58) 在 org.springframework.integration.endpoint.AbstractPollingEndpoint$1。