Office 365的EmailOnAcid代码分析说,不支持速记(background: url("foo.png");
)或显式(background-image: url("foo.png");
)格式的背景图像,也不支持TD
元素上的background属性。除了这些样式,我还有针对[if gte mso 9]
的VML代码。
在一些测试中,我看到了背景图像,但是当我从图像/ VML切片切换到线性渐变/ VML渐变时却看不到。这是Office 365最近添加某种类型的图像支持的问题,还是Office 365不支持VML渐变?
带有图片的电子邮件代码:(注意:此处显示带有cid
引用的附加图片;测试结果主要使用imgr.com上托管的图片)
<head>
<style>
table.with-bg {
width: 570px;
min-height: 717px;
}
table.with-bg td.image-container {
padding: 10px;
background: url("cid:mailing_footer") repeat-x;
}
</style>
</head>
<body link="#497cbe" vlink="#497cbe" alink="#497cbe">
<table class="with-bg" cellpadding="10" cellspacing="0" border="0" width="570" height="717">
<tbody>
<tr>
<td class="image-container" background="cid:mailing_footer" bgcolor="transparent" valign="top" width="570" height="717">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:570px;height:717px;">
<v:fill type="tile" src="cid:mailing_footer" color="#ffffff" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
<table cellpadding="0" cellspacing="0" border="0" width="570" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="10"> </td>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="550">
<tbody>
<tr>
<td colspan="2" align="left" bgcolor="transparent">
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="transparent"><img id="headerpic" src="cid:mailing_header" width="468" height="71" alt=" " title=" " style="width:468px; height: 71px;"></td>
</tr>
<tr>
<td colspan="2" class="body" style="min-height:200px;">
CONTENT GOES HERE
</td>
</tr>
</tbody>
</table>
</td>
<td width="10"> </td>
</tr>
</tbody>
</table>
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
</tr>
</tbody>
</table>
</body>
更改了渐变:
<head>
<style>
...
table.with-bg td.image-container {
padding: 10px;
background-color: white;
background-image: -webkit-linear-gradient(left, #b6cae8, #ffffff);
background-image: -moz-linear-gradient(left, #b6cae8, #ffffff);
background-image: -o-linear-gradient(left, #b6cae8, #ffffff);
background-image: linear-gradient(#b6cae8, white);
background: linear-gradient(#b6cae8, white);
}
</style>
</head>
<body link="#497cbe" vlink="#497cbe" alink="#497cbe">
...
<td class="image-container" background="linear-gradient(#b6cae8, white);" bgcolor="transparent" valign="top" width="570" style="background-color: white; background-image: -webkit-linear-gradient(left, #b6cae8, #ffffff); background-image: -moz-linear-gradient(left, #b6cae8, #ffffff); background-image: -o-linear-gradient(left, #b6cae8, #ffffff); background-image: linear-gradient(#b6cae8, white); background: linear-gradient(#b6cae8, white);">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:570px;">
<v:fill type="gradient" color="#ffffff" color2="#b6cae8" />
<v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">
<![endif]-->
...
</body>
最佳答案
他们还直接通过Email On Acid提出了这一点,他们回答说Office 365似乎增加了对TD背景属性的支持,并且他们更新了代码分析以反映这一点。
目前似乎不支持渐变,CID图像路径也不支持。图片的绝对URL有效,例如<td background="http://foo.com/bar.jpg">
。通过ZIP文件上传在EOA上进行手动测试时,相对路径也起作用(<td background="bar.jpg">
),尽管我尚不清楚这是否/如何在正常发送的电子邮件中起作用。
注意:Office 365和OWA不使用VML,更重要的是,它们与mso
条件注释不匹配!