WSO2 EI6.6:发送带有附件和HTML身体的电子邮件
我正在尝试发送带有WSO2EI6.6附件的电子邮件。当我尝试使用一些文本作为电子邮件主体时,该代码正常工作。当我尝试发送HTML内容时,它无法正常工作。 HTML代码适用于表,我希望在电子邮件正文中看到表格,但HTML代码在电子邮件正文中显示为文本。
序列
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="EmailSend_SEQ" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<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('emailBodyWithRec')"/>
</args>
</payloadFactory>
<property value="Sample Email" name="Subject" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="messageType" scope="axis2" type="STRING" value="text/html"/>
<property name="ContentType" scope="default" type="STRING" value="text/html"/>
<property name="transport.mail.Format" scope="axis2" type="STRING" value="Attachment"/>
<property expression="get-property('sAttachmentFileName')" name="AttachmentFile" scope="axis2" type="STRING"/>
<header expression="fn:concat('mailto:', get-property('primaryEmail'))" name="To" scope="default"/>
<call/>
<property name="OUT_ONLY" scope="default" type="STRING" value="false"/>
<payloadFactory media-type="xml">
<format>
<EmailNotificationResponse>
<Status xmlns="">SUCCESS</Status>
</EmailNotificationResponse>
</format>
<args/>
</payloadFactory>
</sequence>
html含量:
<html xmlns="http://ws.apache.org/ns/synapse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/><style>table, td, th { border: 1px solid black;}table { text-align: center; border-collapse: collapse; font-weight:bold}td { width: 140px;}</style></head>
<body>
<table>
<tr>
<th>Transactions Processed</th>
<td>1111110</td>
</tr>
<tr>
<th>Success</th>
<td>0</td>
</tr>
<tr>
<th>Expired</th>
<td>0</td>
</tr>
<tr>
<th>Failed</th>
<td>0</td>
</tr>
</table>
</body>
</html>
I am trying to send an email with attachment from WSO2EI6.6. The code is working as expected when I tried with some text as email body. When I tried to send HTML content, it is not working as expected. The HTML code is for a table and I am expecting to see the table in email body but the HTML code is displayed in email body as text.
Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="EmailSend_SEQ" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<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('emailBodyWithRec')"/>
</args>
</payloadFactory>
<property value="Sample Email" name="Subject" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="messageType" scope="axis2" type="STRING" value="text/html"/>
<property name="ContentType" scope="default" type="STRING" value="text/html"/>
<property name="transport.mail.Format" scope="axis2" type="STRING" value="Attachment"/>
<property expression="get-property('sAttachmentFileName')" name="AttachmentFile" scope="axis2" type="STRING"/>
<header expression="fn:concat('mailto:', get-property('primaryEmail'))" name="To" scope="default"/>
<call/>
<property name="OUT_ONLY" scope="default" type="STRING" value="false"/>
<payloadFactory media-type="xml">
<format>
<EmailNotificationResponse>
<Status xmlns="">SUCCESS</Status>
</EmailNotificationResponse>
</format>
<args/>
</payloadFactory>
</sequence>
HTML Content :
<html xmlns="http://ws.apache.org/ns/synapse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/><style>table, td, th { border: 1px solid black;}table { text-align: center; border-collapse: collapse; font-weight:bold}td { width: 140px;}</style></head>
<body>
<table>
<tr>
<th>Transactions Processed</th>
<td>1111110</td>
</tr>
<tr>
<th>Success</th>
<td>0</td>
</tr>
<tr>
<th>Expired</th>
<td>0</td>
</tr>
<tr>
<th>Failed</th>
<td>0</td>
</tr>
</table>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论