2

Spring Integration Mail を使用して IMAP で Microsoft Exchange 2010 に接続したいと考えています。私の質問は、接続文字列がどのように見えるかです。

まあ言ってみれば:

domain=earth
user=jdoe
email=jon.doe@earth.com
Folder=inbox

私の知る限り、MS Exchange は接続用に imap のみをサポートしています。

私のSpring統合構成は次のようになります:

<util:properties id="javaMailProperties">
    <prop key="mail.imaps.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    <prop key="mail.imaps.socketFactory.fallback">false</prop>
    <prop key="mail.store.protocol">imaps</prop>
    <prop key="mail.debug">true</prop>
</util:properties>

<mail:inbound-channel-adapter id="imapAdapter"
    store-uri="imaps://earth/jdoe/jon.doe:jdoespw@example.mailhost.com/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:service-activator input-channel="recieveEmailChannel"
    ref="mailReceiver" method="receive" />

<bean id="mailReceiver"
    class="com.earth.MailReceiver" />
4

2 に答える 2

2

今見つけた。接続文字列で何かをする必要はありません。Exchangeに接続したい人のために、ここにいくつかのヒントがあります.

これが私の設定です:

<util:properties id="javaMailProperties">
    <prop key="mail.imaps.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    <prop key="mail.imap.starttls.enable">true</prop>
    <prop key="mail.imaps.socketFactory.fallback">false</prop>
    <prop key="mail.store.protocol">imaps</prop>
    <prop key="mail.debug">true</prop>
</util:properties>

<mail:inbound-channel-adapter id="imapAdapter"
    store-uri="imap://<username>:<password>@<exchange-url>/INBOX" channel="recieveEmailChannel"
    should-delete-messages="false" should-mark-messages-as-read="false"
    auto-startup="true" java-mail-properties="javaMailProperties">
    <int:poller fixed-delay="5"
    time-unit="SECONDS" />
</mail:inbound-channel-adapter>

<int:channel id="recieveEmailChannel" />

<int:service-activator input-channel="recieveEmailChannel"
    ref="reviewMailService" method="receive" />

通常、Exchange は STARTTLS 接続で Imap を使用します。

SSL ハンドシェークを実行するには、InstallCert Java プログラム ( http://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert) を使用できます。ジャワ

于 2012-05-04T11:00:06.050 に答える
0
  1. imaps:// の後の最初のノードは、ドメインではなく、サーバーの fqdn である必要があります (email.earth.com など)。
  2. ここに資格情報の交換に関する FAQ がありますhttp://www.oracle.com/technetwork/java/faq-135477.html
  3. IIRC、IMAP はExchange ではデフォルトで有効になっておらず、管理者が有効にする必要があります。
于 2012-05-02T15:39:25.660 に答える