gpt4 book ai didi

spring-integration - 从 imap 适配器 spring 集成中获取所有已发送的邮件

转载 作者:行者123 更新时间:2023-12-04 07:57:03 25 4
gpt4 key购买 nike

我需要获取所有未删除但未发生的已发送邮件,但只显示邮件总数,最近在 mail.debug true 的控制台

<int:channel id="receiveChannel" />
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://rupak@domain.com:pass@domain.com: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();



}
});
}

最佳答案

参见 the documentation ,您需要使用自定义 SearchTermStrategy

By default, the ImapMailReceiver will search for Messages based on the default SearchTerm which is All mails that are RECENT (if supported), that are NOT ANSWERED, that are NOT DELETED, that are NOT SEEN and have not been processed by this mail receiver (enabled by the use of the custom USER flag or simply NOT FLAGGED if not supported). The custom user flag is spring-integration-mail-adapter but can be configured. Since version 2.2, the SearchTerm used by the ImapMailReceiver is fully configurable via the SearchTermStrategy which you can inject via the search-term-strategy attribute. SearchTermStrategy is a simple strategy interface with a single method that allows you to create an instance of the SearchTerm that will be used by the ImapMailReceiver.

关于spring-integration - 从 imap 适配器 spring 集成中获取所有已发送的邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39591540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com