2
我需要獲取未刪除,但不會發生所有發送的郵件,但只顯示郵件總數,最近在控制檯mail.debug真正取從IMAP適配器Spring集成所有發送的郵件
<int:channel id="receiveChannel" />
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://[email protected]:[email protected]:993/INBOX.Sent"
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>
<prop key="mail.debug">true</prop>
</util:properties>
public static void main (String[] args) throws Exception {
ApplicationContext ac = new ClassPathXmlApplicationContext("spring/gmail-imap-idle-config.xml");
DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class);
inputChannel.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message) throws MessagingException {
MimeMessage mimeMessage = (MimeMessage) message.getPayload();
}
});
}
非常感謝您分享您寶貴的信息。 – rupak