Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Mule esb发送电子邮件_Java_Mule_Esb - Fatal编程技术网

Java 使用Mule esb发送电子邮件

Java 使用Mule esb发送电子邮件,java,mule,esb,Java,Mule,Esb,我必须对“sent”变量进行测试,如果它为false,那么我必须发送电子邮件,这是我的代码: <http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="gist.githubusercontent.com" port="443" doc:name="HTTP Request Configuration"/> <smtp:gmail-connector name="Gmail" va

我必须对“sent”变量进行测试,如果它为false,那么我必须发送电子邮件,这是我的代码:

<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="gist.githubusercontent.com" port="443" doc:name="HTTP Request Configuration"/>
<smtp:gmail-connector name="Gmail" validateConnections="true" doc:name="Gmail"/>
<flow name="push3Flow">
    <quartz:inbound-endpoint jobName="HTTP-Puller-Scheduler" repeatInterval="5000" responseTimeout="10000" doc:name="Quartz" repeatCount="0">
        <quartz:event-generator-job/>
    </quartz:inbound-endpoint>
    <http:request config-ref="HTTP_Request_Configuration" path="Rajeun/b550fe17181610f5c0f0/raw/9cf0940d1b534220a4e50493f42a70e2f4a20584/file.json" method="GET" doc:name="HTTP"/>
    <json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object"/>
    <choice doc:name="Choice">
        <when expression="#[(message.payload.sent) &amp;&amp; (message.payload.email != &quot;&quot;)]">
            <logger level="INFO" doc:name="Logger" message="its ok"/>
        </when>
        <otherwise>
            <component doc:name="Java" class="Component1"/>
          <smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
    user="myemail%40gmail.com" password="pass" to= "<Json-email>@gmail.com"
    from="Rajeun" subject="Testing mule" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>
        </otherwise>
    </choice>
</flow>
我的json文件:

https://gist.githubusercontent.com/Rajeun/b550fe17181610f5c0f0/raw/3f5eaeea955b6eb56bc4715f535fa8bb6d7ab798/file.json
我想做的是从json文件(与我指定的令牌相关联的电子邮件)中自动获取电子邮件。当我尝试这个:

 <smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
        user="myemail%40gmail.com" password="pass" to= "#[payload.email]"
        from="Rajeun" subject="Testing mule" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>

它表示“电子邮件地址”为空 我怎么能这么做?!提前谢谢。

不要使用
#[payload.email]
使用
#[message.payload.email]
如下:-

<smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
        user="myemail%40gmail.com" password="pass" to= "#[message.payload.email]"
        from="Rajeun" subject="Testing mule" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>

在名为email的变量中设置
#[message.payload.email]
,然后在smtp组件中使用变量email,如上所述

感谢您的回复,我尝试了这两种方法,但仍然会出现相同的错误。使用此表达式#[message.payload.email]告诉我你得到了什么明白了吗。。。由于您在smtp之前使用java组件,因此有效负载将被覆盖。。因此,请将表达式#[message.payload.email]保存到java componentINFO 2015-03-26 11:48:24056[[push3].push3Flow.stage1.02]org.mule.api.processor.LoggerMessageProcessor:null之前的变量中。是的,您能指导我这样做吗。如何保存此变量?我对骡子不熟悉。
<smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
        user="myemail%40gmail.com" password="pass" to= "#[message.payload.email]"
        from="Rajeun" subject="Testing mule" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>
<set-variable variableName="email" value="#[message.payload.email]" doc:name="Variable"/>
 <component doc:name="Java" class="Component1"/>
 <smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
            user="myemail%40gmail.com" password="pass" to= "#[flowVars['email']]"
            from="Rajeun" subject="Testing mule" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>