发送到动态地址端点

时间:2017-02-06 09:22:56

标签: wso2 wso2esb

如何将电子邮件发送到动态地址? 地址端点的URI似乎是静态的。 有没有办法在地址端点中注入属性?

这是我到目前为止所做的:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="sendMail" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <property expression="//email" name="email" scope="default" type="STRING"/>
    <log level="custom">
        <property expression="fn:concat('Sending mail to - ',get-property('mail'))" name="mail"/>
    </log>
    <property name="messageType" value="text/html" scope="axis2"/>
    <property name="ContentType" value="text/html" scope="axis2"/>
    <property name="Subject" value="File Received" scope="transport"/>
    <property name="OUT_ONLY" value="true"/>
    <send>
        <endpoint name="mail2user">
            <address uri="mailto:username@gmail.com"/>
        </endpoint>
    </send>
</sequence>

感谢。

2 个答案:

答案 0 :(得分:1)

定义标题&#34; To&#34;并使用不带端点的发送:

<header name="To"expression="fn:concat('mailto:', get-property('senderAddress'))"/>
<property name="OUT_ONLY" value="true"/>
<send/>

别忘了定义transportSender&#34; mailto&#34;与班级&#34; org.apache.axis2.transport.mail.MailTransportSender&#34;在axis2.xml中

答案 1 :(得分:0)

以下是jean-michel建议之后的最终代码:

uint16_t R_value, G_value ,B_value;