本文介绍了WSO2ESB 是否可以使用 Header 发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用 Header mediator 向我的客户发送电子邮件.有没有可能我的代理是这样的

i wish to send a e-mail to my client using Header mediator .Is it possible with that or notMy 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

对应的序列是

<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>

我们可以发送这样的电子邮件吗?我从这里得到了参考http://docs.wso2.org/wiki/display/ESB460/Sample+256%3A+Proxy+Services+with+the+Mail+Transport我以另一种方式发布了我的要求,也请参考这个我们可以在 wso2esb 中以相同的顺序发送多个邮件或动态设置一个邮件

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

推荐答案

只需按照以下 URL 中的步骤操作(但不要使用标题部分,请使用端点,如下所示.这对我有用)

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:[email protected]" />
</endpoint>
</send>

这篇关于WSO2ESB 是否可以使用 Header 发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:13