Html 表(有效负载)
你可以在@()中自定义你的CSS。我只是保留了一个对你有用的样本
%dw 2.0
output application/xml writeDeclaration=false
---
{
table @(style: "width: 50%; border: 1px solid grey; font-family: Monospace" ): {
tr @(bgcolor: "#6c7ae0",style: "color: white !important; font-size:14px; "): {
th @() : "templateId",
th @() : "houseNumber",
th @() : "dataMigrationSourceId",
th @() : "errorDescription"
},
(payload map (item, index) -> {
tr @(align:"center", style: "color: #666666; font-size:12px; font-weight: 500; width:10%"): {
td @(): item.templateID,
td @(): item.houseNumber,
td @(): item.dataMigrationSourceId,
td @(): item.errorDescription
}
})
}
}
解析器模板
我进一步使用了解析器模板连接器写入 html 内容,因为上面的表格我们将作为嵌入邮件中的 html 表格发送。
<html>
<head></head>
<body>
<p>Hello XYZ,</p>
<p>Please find the error report for today's run. </p>
<br />
#[payload]
<br /><br />
<p>This is an automated mail, please do not reply.</p>
<br />
<p>Thanks and Regards,</p>
</body>
</html>
这里的payload表示我们上面创建的html表。
最后,在邮件(发送)连接器中,您可以将此 html 表引用为payload在正文的内容中。
Note- 确保将 ContentType 更改为文本/html在邮件正文发送连接器中