使用Spring Integration Mail连接到Microsoft Exchange Server [英] Connect to Microsoft Exchange Server with Spring Integration Mail
问题描述
我想使用Spring Integration Mail通过IMAP连接到Microsoft Exchange 2010. 我的问题是连接字符串的样子如何.
I want to connect to Microsoft Exchange 2010 with IMAP using Spring Integration Mail. My question is how the connection string exactly look like.
让我们说:
domain=earth
user=jdoe
email=jon.doe@earth.com
Folder=inbox
据我所知,MS Exchange仅支持imaps进行连接.
As far as I know, MS Exchange only supports imaps for connection to.
我的Spring集成配置如下:
My Spring integration config looks like this:
<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" />
推荐答案
现在发现了.它不必对连接字符串做任何事情. 对于那些想要连接到Exchange的人,这里有一些提示.
Found it out now. It doesn't has to do something with the connection string. For those who want to connect to Exchange, here some hints.
这是我的配置:
<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.
Typically Exchange uses Imaps with STARTTLS connection.
要执行SSL握手,可以使用InstallCert Java程序: http ://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java
To perform the SSL handshake, you can use the InstallCert Java program: http://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java
这篇关于使用Spring Integration Mail连接到Microsoft Exchange Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!