我们使用 node.js 来格式化 SendGrid 发送给用户的 html 电子邮件,以确认帐户创建或其他类似的事情。电子邮件已正确发送。所有内容都正确显示。但是,在 Gmail 中,即使所有内容都正确显示,最后还是会出现一条消息,说电子邮件已被截断并单击链接以显示所有内容。如果我们点击,我们会得到相同的内容,但缺少一些样式。其他语言的同一电子邮件不会显示此消息。但所有电子邮件都具有相同的结构。邮件小于30KB(代码+图片)
您会在上面找到扩展的代码。(内容已更改)其后是在 ejs 文件中生成的内容。
我多次阅读代码以找到任何问题(缺少标签)。我尝试手动发送,但没有出现通知。我计算了重量以确保它超过 102KB。结果:最大 30KB。我将代码与另一个没有这个问题的代码进行了比较。结构上没有什么不同。只是内容不同。
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<style>
body{
font-family:Tahoma,Verdana,sans-serif;
font-size:14px;
color:#000;
margin:0
}
a{
text-decoration:none
}
a.link{
color:#EB3052;
font-weight:700
}
a.button{
background-color:#EB3052;
color:#fff;
padding:10px;
border-radius:5px;
text-transform:uppercase;
font-size:12px;
font-weight:700;
letter-spacing:1px
}
a.button.decline{
background-color:#f5f7f7;
color:#EB3052;
font-weight:400
}
ul{
line-height:24px
}
</style>
</head>
<body>
<div
style="
width:100%;
height: 100%;
text-align:center;
font-family: Tahoma, Verdana, sans-serif;
background-color: #F5F7F6;
"
align="center"
>
<table
width="600px"
cellspacing="0"
cellpadding="0"
border="0"
align="center" …Run Code Online (Sandbox Code Playgroud)