繁体   English   中英

使用nodemailer发送HTML gmail后,css缺少一些规则

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM