Is it possible with WSO2ESB to send E-Mail Using H

2019-02-27 12:48发布

i wish to send a e-mail to my client using Header mediator . Is it possible with that or not My proxy like this

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="Mail"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <log/>
         <property name="workpartybranchid"
                   expression="//workpartybranchid/text()"
                   scope="default"
                   type="STRING"/>
         <payloadFactory>
            <format>
               <p:SelectMail_Op xmlns:p="http://ws.wso2.org/dataservice">
                  <p:workpartybranchid>$1</p:workpartybranchid>
               </p:SelectMail_Op>
            </format>
            <args>
               <arg expression="get-property('workpartybranchid')"/>
            </args>
         </payloadFactory>
         <send receive="Mailseq">
            <endpoint>
               <address uri="http://192.168.1.4:9773/services/muser_DataService/"
                        format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
   </target>
</proxy

and corresponding sequence is

<sequence xmlns="http://ws.apache.org/ns/synapse" name="Mailseq" onError="fault">
   <property name="CONTENT_TYPE"
             value="application/json"
             scope="axis2"
             type="STRING"/>
   <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
 <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:s="http://ws.wso2.org/dataservice"
             name="primarymail"
             expression="//s:primarymail/text()"
             scope="axis2"
             type="STRING"/>
<log>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:s="http://ws.wso2.org/dataservice"
             name="primarymail"
             expression="//s:primarymail/text()"
             scope="axis2"
             type="STRING"/>
   </log>

<header name="To" expression="fn:concat('mailto:', get-property('primarymail'))"/>
<send/>
<log>
<property name="mail" value="ts working"/></log>
</sequence>

can we send a email like this i have got reference from this http://docs.wso2.org/wiki/display/ESB460/Sample+256%3A+Proxy+Services+with+the+Mail+Transport i am posted my requirement in another way also please refer this Can we send Multiple Mail in wso2esb in same sequence or dynamically set a mail

1条回答
老娘就宠你
2楼-- · 2019-02-27 13:27

Just follow the step in below URL ( but rather than header part, use endpoint for this as below.. this worked for me)

http://docs.wso2.org/wiki/display/ESB460/Sample+256%3A+Proxy+Services+with+the+Mail+Transport

Add Send for mail as below...( no need header mediator)

 <send> <endpoint>
<address uri="mailto:yourmailaddr@gmail.com" />
</endpoint>
</send>
查看更多
登录 后发表回答