我正在尝试在甲骨文中的表上添加背景图像。这是我的代码。 发送电子邮件时,图像不会显示在表格的背景中。 这存储在过程中。
<table width="100%" style="background:url(http://linktomyimage.png); background-repeat:no-repeat;">
<tr>
for i in (select doc, source, title from table)
loop
msg_html := msg_html ||'<td>'||'i.doc||'</td><td>'||'i.source||'</td><td>'||'i.title||'</td>
end loop;
msg_html := msg_html ||'</tr></table>';
我知道存在一些验证问题,但我认为问题是电子邮件客户端对背景图像的支持不一致。 http://www.campaignmoniter.com/css
现在,有一种方法可以获取它,因此大多数电子邮件客户端都会接受这一点,但它需要相当多的代码并且可能会变得复杂。
背景必须在 HTML 属性 ("background=") 和 CSS(background-image:url(http://) 中声明。它还需要在VBA for Outlook中完成。
开始使用这些的好地方是: https://backgrounds.cm/
他们为您完成大部分基本工作,包括设置背景图像和回退颜色等。
例:
<td background="https://i.imgur.com/YJOX1PC.png" bgcolor="#7bceeb" width="120" height="92" valign="top" style="background-image: url(https://i.imgur.com/YJOX1PC.png); background-color:#7bceeb;" >
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
<v:fill type="tile" src="https://i.imgur.com/YJOX1PC.png" color="#7bceeb" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
INSERT CONTENT HERE
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
根据您提供的代码:
<td background="https://i.imgur.com/YJOX1PC.png" bgcolor="#7bceeb" width="120" height="92" valign="top" style="background-image: url(https://i.imgur.com/YJOX1PC.png); background-color:#7bceeb;" >
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
<v:fill type="tile" src="https://i.imgur.com/YJOX1PC.png" color="#7bceeb" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
msg_html := msg_html || '<table width="100%">
<tr>
<td nowrap style="font-weight: bold;">Document</td>
<th nowrap style="font-weight: bold; text-align:left;">Collections</td>
<th nowrap style="font-weight: bold; text-align:left;">Title</td>
</tr>
<tr style="background-color: #ffffff;">';
for i in (select DOCNO, SOURCE, TITLE, GUIDE from tablename)
loop
msg_html := msg_html || '<td nowrap class="leftAlignment"><a href="http://mywebsite.com?guideURL='''||i.guide||'''&docnum='''||i.docno||'''">DocNum</a></td>
<td nowrap class="leftAlignment">'||i.source|| '</td>
<td nowrap class="leftAlignment">'||i.title|| '</td>
<td nowrap class="leftAlignment">'||i.source||'</td>
<td class="leftAlignment"></td></tr><tr class="read">';
end loop;
msg_html :=msg_html ||'<td class="leftAlignment"></td></tr>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</div>
</table>
</td>
看起来问题是您忘记关闭脚本中的表标签和保存脚本的div 标签。 如果你关闭这些,我相信它应该有效。