[英]css is missing some rules after sending a html gmail with nodemailer
我正在嘗試通過nodemailer將我擁有的一些html作為電子郵件發送到我的gmail帳戶。
因此,起初,我以純文本形式發送了這樣的電子郵件,以檢查是否所有內容都存在...
const email =
{
from: emailAddress,
to: sendTo,
subject: title,
text: emailBody
};
//Send the email
transporter.sendMail(email, function(error, info)
{
//If there was an error, return false as it failed to send, else true
const emailSent = (error) ? false : true;
return resolve(emailSent);
});
這很好,我的所有html都以純文本格式存在,而我的所有CSS規則均完整無缺。
然后我改變
text: emailBody
至
html: emailBody
這會將我的正文字符串解析為html,當我打開電子郵件時,缺少某些CSS規則。
例如我有一個開頭的li標簽,這是我的js中的字符串,是電子郵件正文的一部分...
'<li style="-webkit-box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.3); -moz-box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.3); box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.3); border-radius: 10px; padding: 20px; display: flex; justify-content: center; height: 90px; margin: 10px 0;">'
但是在我的電子郵件中就是這樣...
<li style="border-radius:10px;padding:20px;display:flex;height:90px;margin:10px 0">
因此,您可以看到我的盒子陰影消失了,我的理由-內容規則也消失了,其余的都完好無損。
有人知道為什么這樣做嗎? gmail是否不喜歡框陰影和一些flex屬性? 節點郵件程序可能有問題嗎? 任何信息表示贊賞
我認為這是因為gmail支持這些屬性。 郵件服務不支持許多現代功能,這就是為什么仍然使用表格的原因。 您可以在這里咨詢gmail支持的內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.