我已经配置了以下imap-inbound-adapter来接收来自收件箱的邮件。
@Bean
public IntegrationFlow incomingMailFlow(MailProperties properties,
MimeMessageToMailMessageTransformer mimeMessageToMailMessageTransformer,
SubscribableChannel errorChannel,
SubscribableChannel notificationChannel
) {
return IntegrationFlows
.from(Mail.imapIdleAdapter(properties.getImapUrl())
.javaMailProperties(p -> p
.put("mail.imap.starttls.enable", "true")
.put("mail.imap.ssl.trust", "*"))
.errorChannel(errorChannel)
.shouldDeleteMessages(properties.getDeleteMessages())
)
.transform(mimeMessageToMailMessageTransformer)
.channel(notificationChannel)
.get();
}
要启用集成测试,我更改了配置(为了进行测试,我想用测试配置替换imapIdleAdapter):
@Bean
public SubscribableChannel incomingMailChannel() {
return MessageChannels
.publishSubscribe("incomingMailChannel")
.get();
}
@Bean
public IntegrationFlow imapAdapter(MailProperties properties, SubscribableChannel errorChannel,
SubscribableChannel incomingMailChannel) {
return from(Mail.imapIdleAdapter(properties.getImapUrl())
.javaMailProperties(p -> p
.put("mail.imap.starttls.enable", "true")
.put("mail.imap.ssl.trust", "*"))
.errorChannel(errorChannel)
.channel(incomingMailChannel)
.get();
}
@Bean
public IntegrationFlow incomingMailFlow(SubscribableChannel incomingMailChannel,
MimeMessageToMailMessageTransformer mimeMessageToMailMessageTransformer,
SubscribableChannel notificationChannel
) {
return IntegrationFlows
.from(incomingMailChannel)
.transform(mimeMessageToMailMessageTransformer)
.channel(notificationChannel)
.get();
}
更新:我可以运行JavaMail调试,但是必须删除一些内容才能发布日志文件输出(最多30_000个字符)
javax.mail : Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
javax.mail : successfully loaded resource: /META-INF/javamail.default.address.map
o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'taskScheduler'
javax.mail : getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
com.sun.mail.imap : mail.imap.fetchsize: 16384
com.sun.mail.imap : mail.imap.ignorebodystructuresize: false
o.s.b.w.s.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully
com.sun.mail.imap : mail.imap.statuscachetimeout: 1000
.b.w.s.f.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter'
.b.w.s.f.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully
.s.b.w.s.f.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter'
.s.b.w.s.f.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully
com.sun.mail.imap : mail.imap.appendbuffersize: -1
s.b.w.s.f.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter'
s.b.w.s.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully
com.sun.mail.imap : mail.imap.minidletime: 10
com.sun.mail.imap : enable STARTTLS
com.sun.mail.imap : peek
com.sun.mail.imap : closeFoldersOnStoreFailure
o.s.integration.mail.ImapMailReceiver : connecting to store [imap://user:*****@mailserver:143/INBOX]
com.sun.mail.imap : trying to connect to host "mailserver", port 143, isSSL false
io.undertow : starting undertow server io.undertow.Undertow@7c3ebc6b
io.undertow : Configuring listener with protocol HTTP for interface 0.0.0.0 and port 8080
com.sun.mail.imap : AUTH: PLAIN
com.sun.mail.imap : protocolConnect login, host=mailserver, user=user, password=<non-null>
o.s.b.w.e.u.UndertowServletWebServer : Undertow started on port(s) 8080 (http) with context path ''
d.e.m.applicationApplication : Started applicationApplication in 20.603 seconds (JVM running for 21.067)
com.sun.mail.imap.connectionpool : getStoreProtocol() borrowing a connection
com.sun.mail.imap.connectionpool : getStoreProtocol() - connection available -- size: 1
com.sun.mail.imap.connectionpool : getStoreProtocol() -- storeConnectionInUse
com.sun.mail.imap.connectionpool : releaseFolderStoreProtocol()
o.s.integration.mail.ImapMailReceiver : opening folder [imap://user:*****@mailserver:143/INBOX]
com.sun.mail.imap : connection available -- size: 1
com.sun.mail.imap.messagecache : create cache of size 0
o.s.integration.mail.ImapMailReceiver : This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch. This receiver instance uses flag: spring-integration-mail-adapter
com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
com.sun.mail.imap.messagecache : add 1 messages
com.sun.mail.imap.messagecache : create message number 1
com.sun.mail.imap : IMAPProtocol noop
com.sun.mail.imap.connectionpool : getStoreProtocol() - no connections in the pool, creating a new one
com.sun.mail.imap : AUTH: PLAIN
com.sun.mail.imap.connectionpool : getStoreProtocol() -- storeConnectionInUse
com.sun.mail.imap : IMAPProtocol noop
com.sun.mail.imap.connectionpool : releaseStoreProtocol()
o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]
o.s.integration.mail.ImapMailReceiver : This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch. This receiver instance uses flag: spring-integration-mail-adapter
p.s.integration.mail.ImapMailReceiver : found 1 new messages
o.s.integration.mail.ImapMailReceiver : Received 1 messages
o.s.integration.mail.ImapMailReceiver : USER flags are supported by this mail server. Flagging message with 'spring-integration-mail-adapter' user flag
javax.activation : MailcapCommandMap: load HOME
javax.activation : new MailcapFile: file /home/mailAppUser/.mailcap
javax.activation : MailcapCommandMap: load SYS
javax.activation : new MailcapFile: file /usr/lib/jvm/java-8-oracle/jre/lib/mailcap
javax.activation : MailcapCommandMap: load JAR
javax.activation : MailcapCommandMap: getResources
javax.activation : MailcapCommandMap: URL jar:file:/var/application/application_customer_1.0.0.jar!/BOOT-INF/lib/javax.mail-1.5.5.jar!/META-INF/mailcap
javax.activation : new MailcapFile: InputStream
javax.activation : parse: text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain
javax.activation : Type: text/plain
javax.activation : Command: content-handler, Class: com.sun.mail.handlers.text_plain
...more conten parser ...
javax.activation : Merging commands for type text/*
javax.activation : MailcapCommandMap: successfully loaded mailcap file: /META-INF/mailcap.default
javax.activation : MailcapCommandMap: createDataContentHandler for multipart/alternative
javax.activation : search DB #1
javax.activation : search DB #2
javax.activation : search fallback DB #1
javax.activation : got content-handler
javax.activation : class com.sun.mail.handlers.multipart_mixed
com.sun.mail.imap.connectionpool : connection pool current size: 1 pool size: 1
com.sun.mail.imap : pool is full, not adding an Authenticated connection
o.s.i.mail.ImapIdleChannelAdapter : received 1 mail messages
o.s.i.mail.ImapIdleChannelAdapter : Task completed successfully. Re-scheduling it again right away.
o.s.i.mail.ImapIdleChannelAdapter : waiting for mail
com.sun.mail.imap.connectionpool : getStoreProtocol() - connection available -- size: 1
com.sun.mail.imap.connectionpool : getStoreProtocol() -- storeConnectionInUse
com.sun.mail.imap : IMAPProtocol noop
com.sun.mail.imap.connectionpool : releaseStoreProtocol()
com.sun.mail.imap.connectionpool : getStoreProtocol() borrowing a connection
com.sun.mail.imap.connectionpool : getStoreProtocol() - connection available -- size: 1
com.sun.mail.imap.connectionpool : getStoreProtocol() -- storeConnectionInUse
o.s.integration.channel.DirectChannel : preSend on channel 'incomingMailFlow.channel#0', message: GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
com.sun.mail.imap.connectionpool : releaseFolderStoreProtocol()
o.s.integration.mail.ImapMailReceiver : opening folder [imap://user:*****@mailserver:143/INBOX]
com.sun.mail.imap : connection available -- size: 1
com.sun.mail.imap.messagecache : create cache of size 0
o.s.integration.mail.ImapMailReceiver : This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch. This receiver instance uses flag: spring-integration-mail-adapter
o.s.integration.filter.MessageFilter : incomingMailFlow.org.springframework.integration.filter.MessageFilter#0 received message: GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
d.e.m.i.n.i.m.UniqueMimeMessageIdFilter : Storing the message id <<1dacefec9d29bcaeda907d98@customer-cust.com>>
o.hibernate.internal.util.EntityPrinter : Listing entities:
o.hibernate.internal.util.EntityPrinter : de.company.application.mail.domain.MailIdEntity{messageId=<1dacefec9d29bcaeda907d98@customer-cust.com>, id=1266391}
o.s.integration.channel.DirectChannel : preSend on channel 'incomingMailFlow.channel#1', message: GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
o.s.i.t.MessageTransformingHandler : incomingMailFlow.org.springframework.integration.transformer.MessageTransformingHandler#0 received message: GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
i.m.MimeMessageToMailMessageTransformer : transforming mail: org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c
javax.activation : MailcapCommandMap: createDataContentHandler for text/plain
javax.activation : search DB #1
javax.activation : got content-handler
javax.activation : class com.sun.mail.handlers.text_plain
com.sun.mail.imap : IMAPProtocol noop
o.s.i.channel.PublishSubscribeChannel : preSend on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], headers={id=e015fc76-8c9c-f8b8-9d3f-b4775569ee11, timestamp=1551259380881}] for original GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
o.s.i.router.MethodInvokingRouter : errorRouterFlow.org.springframework.integration.router.MethodInvokingRouter#0 received message: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], headers={id=e015fc76-8c9c-f8b8-9d3f-b4775569ee11, timestamp=1551259380881}] for original GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
d.e.m.integration.error.ErrorRouter : Routing org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}] to channel unknownErrorChannel
o.s.i.channel.PublishSubscribeChannel : preSend on channel 'unknownErrorChannel', message: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], headers={id=e015fc76-8c9c-f8b8-9d3f-b4775569ee11, timestamp=1551259380881}] for original GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
o.s.integration.handler.LoggingHandler : unknownErrorLogger received message: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], headers={id=e015fc76-8c9c-f8b8-9d3f-b4775569ee11, timestamp=1551259380881}] for original GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
WARN o.s.integration.handler.LoggingHandler : org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}], failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:95)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:203)
at org.springframework.integration.mail.ImapIdleChannelAdapter.lambda$createMessageSendingTask$0(ImapIdleChannelAdapter.java:216)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d, timestamp=1551259380290}]
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:107)
at org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:90)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:89)
... 32 more
Caused by: de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message
at de.company.application.integration.notification.incoming.mail.MimeMessageToMailMessageTransformer.transform(MimeMessageToMailMessageTransformer.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at org.springframework.integration.util.MessagingMethodInvokerHelper.invokeHandlerMethod(MessagingMethodInvokerHelper.java:574)
at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:312)
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:104)
... 34 more
Caused by: de.company.application.integration.notification.incoming.exception.CreateMimeParserException: Parser for mime message could not be created
at de.company.application.integration.notification.incoming.mail.IncomingMailParser.getMimeMessageParser(IncomingMailParser.java:47)
at de.company.application.integration.notification.incoming.mail.MimeMessageToMailMessageTransformer.transform(MimeMessageToMailMessageTransformer.java:38)
... 45 more
Caused by: java.io.IOException: A7 BAD Error in IMAP command FETCH: Invalid messageset (0.000 + 0.000 secs).
at com.sun.mail.imap.IMAPInputStream.fill(IMAPInputStream.java:159)
at com.sun.mail.imap.IMAPInputStream.read(IMAPInputStream.java:192)
at java.io.FilterInputStream.read(FilterInputStream.java:83)
at java.io.PushbackInputStream.read(PushbackInputStream.java:139)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at com.sun.mail.handlers.text_plain.getContent(text_plain.java:98)
at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795)
at javax.activation.DataHandler.getContent(DataHandler.java:542)
at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:657)
at org.apache.commons.mail.util.MimeMessageParser.parse(MimeMessageParser.java:96)
at de.company.application.integration.notification.incoming.mail.IncomingMailParser.getMimeMessageParser(IncomingMailParser.java:45)
... 46 more
o.s.i.channel.PublishSubscribeChannel : postSend (sent=true) on channel 'unknownErrorChannel', message: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is de.company.application.integration.notification.incoming.exception.MailMessageTransformerException: Failed to parse mail message data from mime message, failedMessage=GenericMessage [payload=org.springframework.integration.mail.AbstractMailReceiver$IntegrationMimeMessage@5905215c, headers={id=49d23354-389d-e998-83f6e0a5bb3d,
com.sun.mail.imap.connectionpool : getStoreProtocol() - no connections in the pool, creating a new one
com.sun.mail.imap : AUTH: PLAIN
com.sun.mail.imap.connectionpool : getStoreProtocol() -- storeConnectionInUse
com.sun.mail.imap : IMAPProtocol noop
com.sun.mail.imap.connectionpool : releaseStoreProtocol()
o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]
o.s.integration.mail.ImapMailReceiver : This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch. This receiver instance uses flag: spring-integration-mail-adapter
o.s.integration.mail.ImapMailReceiver : found 0 new messages
o.s.integration.mail.ImapMailReceiver : Received 0 messages
com.sun.mail.imap.connectionpool : connection pool current size: 1 pool size: 1
com.sun.mail.imap : pool is full, not adding an Authenticated connection
com.sun.mail.imap.connectionpool : releaseFolderStoreProtocol()
o.s.integration.mail.ImapMailReceiver : opening folder [imap://user:*****@mailserver:143/INBOX]
com.sun.mail.imap : connection available -- size: 1
com.sun.mail.imap.messagecache : create cache of size 0
o.s.integration.mail.ImapMailReceiver : This email server does not support RECENT flag, but it does support USER flags which will be used to prevent duplicates during email fetch. This receiver instance uses flag: spring-integration-mail-adapter
com.sun.mail.imap.messagecache : add 4 messages
com.sun.mail.imap.messagecache : create message number 1
com.sun.mail.imap.messagecache : create message number 2
com.sun.mail.imap.messagecache : create message number 3
com.sun.mail.imap.messagecache : create message number 4
更新2:我检查了邮件服务器日志文件,发现一种模式,该模式在应用程序无法读取邮件时发生。有两个imap登录名时,应用程序失败
Feb 27 10:22:59 Ubuntu postfix/smtpd[3947]: connect from unknown[host-ip]
Feb 27 10:22:59 Ubuntu postfix/smtpd[3947]: A7D87C2074: client=unknown[host-ip]
Feb 27 10:22:59 Ubuntu postfix/cleanup[3949]: A7D87C2074: message-id=<1dace980154b4fec9d29bcaed@customer.com>
Feb 27 10:22:59 Ubuntu postfix/qmgr[1380]: A7D87C2074: from=<sender@customer.com>, size=5941, nrcpt=1 (queue active)
Feb 27 10:22:59 Ubuntu postfix/smtpd[3947]: disconnect from unknown[host-ip] helo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Feb 27 10:22:59 Ubuntu postfix/local[3950]: A7D87C2074: to=<inbox@domain.com>, orig_to=<recipient@customer.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 27 10:22:59 Ubuntu postfix/qmgr[1380]: A7D87C2074: removed
Feb 27 10:23:00 Ubuntu dovecot: imap-login: Login: user=<inbox>, method=PLAIN, rip=spring-application-ip, lip=spring-application-ip, mpid=3954, secured, session=<mgBQuNyCOtIKOi7N>
Feb 27 10:23:00 Ubuntu dovecot: imap(inbox): Logged out in=516 out=8630
Feb 27 10:23:00 Ubuntu dovecot: imap-login: Login: user=<inbox>, method=PLAIN, rip=spring-application-ip, lip=spring-application-ip, mpid=3959, secured, session=<8z5auNyCPNIKOi7N>
Feb 27 10:23:00 Ubuntu dovecot: imap(inbox): Logged out in=352 out=1305
如果邮件处理成功,则日志文件条目看起来像
Feb 27 10:24:18 Ubuntu postfix/smtpd[3964]: connect from unknown[host-ip]
Feb 27 10:24:18 Ubuntu postfix/smtpd[3964]: 49C78C2074: client=unknown[host-ip]
Feb 27 10:24:18 Ubuntu postfix/cleanup[3949]: 49C78C2074: message-id=<00014af9-91a9-441a-a0a@customer.com>
Feb 27 10:24:18 Ubuntu postfix/qmgr[1380]: 49C78C2074: from=<sender@customer.com>, size=3023, nrcpt=1 (queue active)
Feb 27 10:24:18 Ubuntu postfix/local[3950]: 49C78C2074: to=<inbox@domain.com>, orig_to=<recipient@customer.com>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 27 10:24:18 Ubuntu postfix/qmgr[1380]: 49C78C2074: removed
Feb 27 10:24:18 Ubuntu postfix/smtpd[3964]: disconnect from unknown[host-ip] helo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Feb 27 10:24:18 Ubuntu dovecot: imap-login: Login: user=<inbox>, method=PLAIN, rip=spring-application-ip, lip=spring-application-ip, mpid=3971, secured, session=<Z1v9vNyCPtIKOi7N>
Feb 27 10:24:18 Ubuntu dovecot: imap(inbox): Logged out in=1137 out=18905
Feb 27 10:24:51 Ubuntu postfix/qmgr[1380]: 9578BC1FDE: from=<>, size=2044, nrcpt=1 (queue active)
Update3:在将deleteMessage标志更改为false之后,该错误不再发生。因此,如果使用ImapIdleChannelAdapterSpec.shouldDeleteMessages(true)删除邮件,则偶尔会发生错误。如果将其设置为false,则永远不会发生错误。