我需要轮询邮件服务器。由于我的项目已经在 Spring 中,我使用 Spring-Integration 来轮询邮件服务器。我在这方面很成功。但现在我必须轮询多封电子邮件。一些机构可以让我知道该怎么做。
这是我用来轮询单个邮件的示例代码。
<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">false</prop>
</util:properties>
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="${imap.uri}"
channel="recieveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true"
java-mail-properties="javaMailProperties">
<int:poller fixed-delay="${imap.poolerSecondsDelay}" time-unit="SECONDS"/>
</mail:inbound-channel-adapter>
<int:channel id="recieveEmailChannel">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="logger" level="DEBUG"/>
<int:service-activator input-channel="recieveEmailChannel" ref="emailReceiverService" method="receive"/>
<bean id="emailReceiverService" class="com.usbank.hermes.serviceimpl.EmailReceiverService">
</bean>