【问题标题】:wso2 JMS JSON to html email without soap enveloppe or with non-xml htmlwso2 JMS JSON 到没有肥皂信封或非 xml html 的 html 电子邮件
【发布时间】:2019-01-01 02:02:35
【问题描述】:

我想从 JMS JSON 消息中使用 wso2 4.9.0 发送适当的完全动态(收件人、发件人、正文、主题)html 电子邮件。

这是我想要的 SMTP 交换,所有值都来自 json 消息:

From: foo <noreply@bar>
Reply-To: foo <noreply@bar>
To: foobar@bar
Cc: bar@bar
Subject: =?UTF8?Q?test;_eacute:_=C3=A9?=
MIME-Version: 1.0
Content-Type: text/html; charset=UTF8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html><html><body>Hello =C3=A9<br> and a=
long line is split before 76 chars</body></html>

我试过(为了清楚起见缩写):

mc.setPayloadXML(<ns:text xmlns:ns="http://ws.apache.org/commons/ns/payload">{message}</ns:text>);
// Almost OK but with 4.9.0, the PlainTextFormatter forces the Content-Type to text/plain (I think this is solved in wso2esb 5+)

我也试过了:

//Using in axis2.xml :  <messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>  
mc.setPayloadXML(<html><body>{message}</body></html>)
// Not ok: Escapes the message
// if it didn't escape the message, it would result in invalid xml anyway

我还尝试了十几种其他组合,但都没有奏效。

是否可以接收 JSON JMS 消息,对其进行解析并从值发送正确的 html 电子邮件?

【问题讨论】:

    标签: json email wso2 jms wso2esb


    【解决方案1】:

    以下步骤将帮助您实现您的要求

    1. 一旦 JSON 消息被读入 ESB,它将是 SOAP 格式。因此,使用 xslt 调解器将内容更改为您想要的输出 html
    2. 设置messageType和ContentType为text/html
    3. 在 /repository/conf/axis2/axis2.xml 中启用 text/html 消息格式化程序

    4. 发送电子邮件

    此博客包含使用上述方法的电子邮件功能示例实现 https://medium.com/@Jenananthan/wso2-esb-sending-email-notification-2150f8dca2aa

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多