Please help me resolve this exception. I am running this IMAP email listener in my Spring Boot Java application to retrieve emails from my gmail inbox
return IntegrationFlows
.from(Mail.imapIdleAdapter(imapUrl())
.autoStartup(true)
.javaMailProperties(p -> p.put("mail.imap.ssl.trust", "*")
.put("mail.imap.ssl.enable", "true"))
.shouldMarkMessagesAsRead(false)
.shouldDeleteMessages(false)
.shouldReconnectAutomatically(true)
.autoCloseFolder(false))
.handle(m-> myService.process(MimeMessage))
.get();
Occasionally I am getting the follow exception in a higher environment
javax.mail.FolderClosedException: * BYE JavaMail Exception:
javax.net.ssl.SSLException: Connection timed out (Read failed)
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3316)
leading to
2020-05-20 18:06:27.264 WARN 1 --- [ask-scheduler-1] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.
I was wondering how you would recommend handling this issue? by poking the gmail server with a 'mail.timeout' property? Or is there another recommended method? Thanks again!