我正在尝试使用 Express-mailer 在 NodeJS 应用程序中发送电子邮件,并且想使用 Jade 撰写响应式电子邮件,但在呈现此电子邮件时遇到问题:我添加到电子邮件模板的样式未应用于其模板。例如,对于以下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html
head
meta(http-equiv = 'Content-Type', content = 'text/html; charset=UTF-8')
style.
body {
background-color: #dfdfdf;
width: 320px;
height: 620px;
}
.container {
width: 90%;
height: 90%;
margin: auto;
display: flex;
flex-deirection: column;
background-color: white;
border-radius: 4px;
}
body
.container Hello
那么,我在撰写此类电子邮件时可能会犯哪些错误?我应该如何做才能使某些内容发挥作用?
最佳答案
许多电子邮件客户端希望样式内联并去掉 CSS header :
https://github.com/RGBboy/express-mailer/issues/28
有些工具可以将带有模板的 CSS 文件转换为内联 CSS,例如 https://github.com/crocodilejs/node-email-templates
关于javascript - Jade 电子邮件模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39024516/