2013-07-19 44 views
0

我是wso2中的新成员。我使用this代码,它发送电子邮件好,但我怎样才能修改电子邮件的正文? ESB发送带有主题的电子邮件,但是具有空的主体并且没有附件。我一直在查看wso2文档中有关如何设置电子邮件正文的信息,但我没有发现任何内容。使用wso2发送包含身体的电子邮件

我试图this样品中使用脚本中介,像但它给了我一个异常:

Caused by: org.mozilla.javascript.EvaluatorException: Can't find method org.apache.synapse.mediators.bsf.ScriptMessageContext.setPayloadXML(). (<Unknown Source>#1) 
    at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109) 
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1030) 
    at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1086) 
    at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:1049) 
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:162) 
    at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119) 
    at org.mozilla.javascript.gen.c4._c0(<Unknown Source>:1) 
    at org.mozilla.javascript.gen.c4.call(<Unknown Source>) 
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393) 
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834) 
    at org.mozilla.javascript.gen.c4.call(<Unknown Source>) 
    at org.mozilla.javascript.gen.c4.exec(<Unknown Source>) 
    at com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:55) 
    ... 15 more 

我使用WSO2 4.7.0。谁能帮我?谢谢。

回答

0

在以下代理我有参数化身体。它对我来说工作的很好

<?xml version="1.0" encoding="UTF-8"?> 
<proxy xmlns="http://ws.apache.org/ns/synapse" 
     name="MailToTransportSenderBCC" 
     transports="https,http" 
     statistics="disable" 
     trace="disable" 
     startOnLoad="true"> 
    <target> 
     <inSequence> 
     <property name="emailSubjectToSent" 
        expression="//emailSubject" 
        scope="default" 
        type="STRING"/> 
     <property name="emailMassegeToSent" 
        expression="//emailMassege" 
        scope="default" 
        type="STRING"/> 
     <property name="Subject" 
        expression="get-property('emailSubjectToSent')" 
        scope="transport"/> 
     <property name="OUT_ONLY" value="true" scope="default" type="STRING"/> 
     <property name="ContentType" value="text/plain" scope="axis2"/> 
     <property name="messageType" value="text/plain" scope="axis2"/> 
     <payloadFactory media-type="xml"> 
      <format> 
       <ns:text xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:text> 
      </format> 
      <args> 
       <arg evaluator="xml" expression="get-property('emailMassegeToSent')"/> 
      </args> 
     </payloadFactory> 
     <send> 
      <endpoint> 
       <address uri="mailto:[email protected]"/> 
      </endpoint> 
     </send> 
     <header name="To" action="remove"/> 
     <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/> 
     <property name="RESPONSE" value="true" scope="default" type="STRING"/> 
     <send/> 
     </inSequence> 
     <outSequence> 
     <send/> 
     </outSequence> 
    </target> 
    <description/> 
</proxy> 

相关问题