Java Spring集成始终将收到的消息标记为已读

Java Spring集成始终将收到的消息标记为已读,java,gmail,spring-integration,imap,Java,Gmail,Spring Integration,Imap,我正在使用SpringIntegrationMail向我的gmail帐户接收传入消息。邮件接收时没有问题,但在我的gmail帐户中总是标记为已读。以下是我的XML配置: <int:channel id="receiveChannel"/> replace 'userid and 'password' with the real values <int-mail:imap-idle-channel-adapter id="customAdapter"

我正在使用SpringIntegrationMail向我的gmail帐户接收传入消息。邮件接收时没有问题,但在我的gmail帐户中总是标记为已读。以下是我的XML配置:

<int:channel id="receiveChannel"/>
replace 'userid and 'password' with the real values
<int-mail:imap-idle-channel-adapter id="customAdapter"
                                    store-uri="imaps://proximahaiz%40gmail.com:myPassword@imap.gmail.com:993/inbox"
                                    channel="receiveChannel"
                                    auto-startup="true"
                                    should-delete-messages="false"
                                    should-mark-messages-as-read="false"
                                    java-mail-properties="javaMailProperties"
/>


<util:properties id="javaMailProperties">
    <prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    <prop key="mail.imap.socketFactory.fallback">false</prop>
    <prop key="mail.store.protocol">imaps</
    <prop key="mail.debug">false</prop>
</

将“userid”和“password”替换为实际值
javax.net.ssl.SSLSocketFactory
假的

imaps将
mail.debug
java属性更改为
true

当应标记消息读取标志设置为false时,适配器不应设置可通过查看调试输出确认的
\Seen
标志


如果是这样,Gmail可能不遵守IMAP协议,并使用其他一些标准将邮件标记为已读。

mail.debug
java属性更改为
true

当应标记消息读取标志设置为false时,适配器不应设置可通过查看调试输出确认的
\Seen
标志


如果是这种情况,Gmail可能不遵守IMAP协议,并使用其他一些标准将邮件标记为已读。

并且需要使用FETCH.PEEK、not FETCH或EXAMINE,而不是SELECT。感谢您的快速响应。上传的日志,难道你看不到它们并说,怎么了?你需要显示更多的日志;这只显示搜索结果。您不能将整个内容作为文本文件上载吗?它需要使用FETCH.PEEK,而不是FETCH,或者检查,而不是SELECT。感谢您的快速响应。上传的日志,难道你看不到它们并说,怎么了?你需要显示更多的日志;这只显示搜索结果。你不能把整个东西作为文本文件上传吗?
public class GmailInboundImapIdleAdapterServiceImpl implements GmailInboundImapIdleAdapterService {
private static Logger logger = Logger.getLogger(GmailInboundImapIdleAdapterServiceImpl.class);
private static String MAIL_SUBJECT = "mail_subject";
private static String MAIL_FROM = "mail_from";
private static EmailParser emailParser = new EmailParser();
@Autowired
private EmailReceiverService emailReceiverService;


@Override
public void startReceiveEmails() {
    ApplicationContext acProxy = new ClassPathXmlApplicationContext("/integration/gmail-imap-idle-config-proxytest.xml");
    DirectChannel inputChannelProxy = acProxy.getBean("receiveChannel", DirectChannel.class);

    inputChannelProxy.subscribe(new MessageHandler() {
        @Override
        public void handleMessage(Message<?> message) throws MessagingException {
            initMessageReceiving(message);
        }
    });
}