繁体   English   中英

Spring Boot Integration Mail-授权失败错误

[英]Spring boot integration mail - authorization failed error

以下是我的用于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.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:131)处失败org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:245)at org.springframework.integration.endpoint.AbstractPollingEndpoint.access $ 000(AbstractPollingEndpoint.java:58)at org.springframework.integration.endpoint.AbstractPollingEndpoint $ 1。在org.springframework.integration.endpoint.AbstractPollingEndpoint $ 1.call(AbstractPollingEndpoint.java:190)在org.springframework.integration.endpoint.AbstractPollingEndpoint $ Poller $ 1.run(AbstractPollingEndpoint.java:353)处调用(AbstractPollingEndpoint.java:186)在org.springframew上的org.springframework.integration.util.ErrorHandlingTaskExecutor $ 1.run(ErrorHandlingTaskExecutor.java:55) org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)上的ork.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)org.springframework.integration.endpoint.AbstractPollingEndpoint $ Poller.run( org.springframework.scheduling.concurrent的org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)的AbstractPollingEndpoint.java:344)java.util。 .Executors $ RunnableAdapter.call(未知源),java.util.concurrent.FutureTask.run(未知源),java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201(未知源),java.util.concurrent.ScheduledThreadPoolExecutor $ java.util.concurrent.ThreadPoolExecutor.run的ScheduledFutureTask.run(未知源)java.lang.Thread.run(未知源)的java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知源) )由以下原因引起:javax.mail.AuthenticationFailedException:com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:208)的授权在javax.mail.Service.connect(Service.java:295)处失败org.springframework.java.mail.Service.connect(Service.java:125)的org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:286)的.Service.connect(Service.java:176)。 org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:319)处的integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:293) 112)...还有19个

有一个这样的选项:

/**
 * The Java Mail properties.
 * @param javaMailProperties the javaMailProperties.
 * @return the spec.
 * @see AbstractMailReceiver#setJavaMailProperties(Properties)
 */
public S javaMailProperties(Properties javaMailProperties) {

您可以在那里指定mail.debug = true来跟踪交互过程中邮件协议的状况。

更新

我们在您的日志中有这个:

DEBUG POP3: connecting to host "172.16.1.45", port 995, isSSL false
19:54:46.746 [task-scheduler-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'errorChannel'
19:54:46.753 [task-scheduler-1] DEBUG org.springframework.integration.channel.PublishSubscribeChannel - preSend on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessagingException: failure occurred while polling for mail; nested exception is javax.mail.MessagingException: Connect failed;
  nested exception is:
    java.net.ConnectException: Connection refused: connect, headers={id=290f4c5a-2dfe-d7cb-0637-a0e9f0394daa, timestamp=1529677486753}]

因此,它不能仅连接到172.16.1.45:995 尚无身份验证握手。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM