0

I've managed finally to use Spring's IMAP mechanism.

Is it possible to actually receive emails from 3 different email accounts?

My xml looks like this:

   <?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>

Is it possible to create another imapAdapter? is there any other way for multiple accounts? Is it even possible?

Thanks again!

Nir

4

1 回答 1

0

我只是创建了另一个 imapAdapter#2

它工作正常。

于 2013-07-21T14:32:50.893 回答