1
我正在使用Spring集成郵件接收傳入消息給我的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:[email protected]: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>
</
我加了一個參數應該標記的消息,如閱讀=「假」但所有接收消息仍標記爲只讀。 我使用Spring Integration的4.2.9.RELEASE版本。 這是我的Java代碼:之後我收到他們到我的應用程序
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);
}
});
}
我該怎麼做離開的消息標誌着在Gmail帳戶爲未讀?
它需要使用FETCH.PEEK,而不是FETCH或EXAMINE,而不是SELECT。 – Max
感謝您的快速響應。上傳的日誌,你不能看到他們說,有什麼不對? –
你需要顯示更多的日誌;只顯示搜索。你不能把整個東西作爲文本文件上傳嗎? –