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

谁说我不能喝 提交于 2019-12-02 03:55:03

问题


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:


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>


来源:https://stackoverflow.com/questions/17441849/is-it-possible-with-wso2esb-to-send-e-mail-using-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!