我终于使用了Spring的IMAP机制。
是否可以实际接收来自3个不同电子邮件帐户的电子邮件?
我的xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<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>
<prop key="mail.imaps.ssl.trust">*</prop> <!-- TODO change -->
</util:properties>
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://avita.nir%40gmail.com:myPass@imap.gmail.com:993/inbox"
channel="recieveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true"
java-mail-properties="javaMailProperties">
<int:poller fixed-delay="5" 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="messageFactory" method="receive"/>
<bean id="messageFactory" class="src.com.plantaware.service.factories.MessageFactory">
</bean>
是否可以创建另一个imapAdapter?多账户还有其他方法吗?它甚至可能吗?
再次感谢!
尼尔
答案 0 :(得分:0)
我只是创建了另一个imapAdapter#2
它工作正常。