我想从JMS JSON消息中使用wso2 4.9.0发送一封适当的全动态(to,from,body,subject(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
我还尝试了十几种其他组合,但都不起作用。
是否可以接收JSONJMS消息,对其进行解析,并从值中发送正确的html电子邮件?
以下步骤将帮助您实现所需的
- 一旦JSON消息被读入ESB,它将是SOAP格式。因此,使用xslt中介器将内容更改为所需的输出html
- 将messsageType和ContentType设置为text.html
-
在/repository/conf/axis2/axis2.xml 中启用text/html消息格式化程序
-
发送电子邮件
此博客包含使用上述方法实现电子邮件功能的示例https://medium.com/@Jenananthan/wso2-电子邮件通知-2150f8dca2aa