Spring XD-outlook的邮件接收器配置
我正在尝试配置SpringXD的邮件接收器,以便将邮件发送到outlook帐户。这是我的流定义:Spring XD-outlook的邮件接收器配置,outlook,spring-xd,Outlook,Spring Xd,我正在尝试配置SpringXD的邮件接收器,以便将邮件发送到outlook帐户。这是我的流定义: stream create outlookMailSink --definition "http | mail --to='\"email@address.com\"' --host=outlook.office365.com --subject=payload+' world'" --deploy 我正在使用以下shell命令进行测试: http post --data Hello 我收到以下
stream create outlookMailSink --definition "http | mail --to='\"email@address.com\"' --host=outlook.office365.com --subject=payload+' world'" --deploy
我正在使用以下shell命令进行测试:
http post --data Hello
我收到以下错误消息:
Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84)
我在SpringXD文档和互联网搜索中对此进行了调查,但还没有找到一个有效的解决方案。有人能帮我吗?我找到了一个解决方案,其中包括创建一个新的邮件接收模块,这是对spring XD提供的邮件接收模块的一个轻微修改。流还必须包括到、从、主机、端口、用户名和密码选项
。\spring xd-\xd\modules\sink\mail
文件夹并重命名为secure mail。\spring xd-\xd\modules\sink\secure mail
中,分别将mail.properties
和mail.xml
重命名为secure mail.properties
和secure mail.xml
secure mail.xml
的内容替换为以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<channel id="input" />
<int-mail:header-enricher input-channel="input" output-channel="send">
<int-mail:to expression="${to:null}" />
<int-mail:from expression="${from:null}" />
<int-mail:subject expression="${subject:null}" />
<int-mail:cc expression="${cc:null}" />
<int-mail:bcc expression="${bcc:null}" />
<int-mail:reply-to expression="${replyTo:null}" />
<int-mail:content-type expression="${contentType:null}" />
</int-mail:header-enricher>
<channel id="send" />
<int-mail:outbound-channel-adapter
channel="send" host="${host}" port="${port}" username="${username:}"
password="${password:}" java-mail-properties="javaMailProperties"/>
<util:properties id="javaMailProperties">
<beans:prop key="mail.smtp.starttls.enable">true</beans:prop>
</util:properties>
</beans:beans>
httppost--data Hello
mail.smtp.starttls.enable
设置为true,以便为通过端口587的通信启用TLS加密。当然,您可以直接修改SpringXD的邮件接收模块并使用它——这取决于您自己
我很想知道是否有人有更好的解决方案?例如,是否可以在启动Spring XD时设置mail.smtp.starttls.enable
属性,从而允许您使用原始邮件接收模块?我试图通过修改xd singlenode启动脚本来实现这一点——设置了属性,但它不会影响邮件接收模块
参考文献:
stream create outlookMailSink --definition "http | secure-mail --to='\"email@address.com\"' --from='\"email@address.com\"' --host=outlook.office365.com --port=587 --username=email@address.com --password=password --subject=payload+' world'" --deploy