我已经尝试了所有我能想到的字符串到字节数组变换器,没有字符串到字节数组变换器,我仍然收到以普通/文本格式发送的电子邮件。
当我显示原始消息时,这是我的gmail版本:
主题:为什么没有加价?
MIME版本:1.0
内容类型: text / plain; charset =“us-ascii”
内容传输编码:7位
返回路径:rufus@abc.com
<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>
请对我做错的事情发光 谢谢,唐
以下是一个简单的测试用例:
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans"
version="EE-3.5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd">
<flow name="htmlemailtestFlow1" doc:name="htmlemailtestFlow1">
<quartz:inbound-endpoint jobName="Q1" repeatInterval="60000" responseTimeout="10000" doc:name="Quartz">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<scripting:text><![CDATA[return '<html><head><meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/></head><body><p>An HTML paragraph</p></body></html>']]></scripting:text>
</scripting:script>
</scripting:component>
<string-to-byte-array-transformer mimeType="text/html" doc:name="String to Byte Array" />
<smtp:outbound-endpoint host="mail.abc.com" to="dharrington@abc.com" from="rufus@abc.com" subject="Why no markup?"
responseTimeout="10000" doc:name="AsnEmail" mimeType="text/html" />
</flow>
</mule>