我想在填充了 SQL Server 表数据的表的列中添加一个图标/图像,并将结果通过电子邮件发送出去。
就目前而言,我在电子邮件中得到的只是
<img src="cid:RedTL.gif"/>
我的代码:
--Full path set within attachments
@file_attachments='E:\RedTL.gif',
SET @TBLHTML=
N'<STYLE type="text/css">' +
N'.Table { background-color:#D8E7FB;border-collapse:separate;color:#000;font-size:18px; }' +
N'.Table th { background-color:#0E0355;color:white; }' +
N'.Table td, .Table th { padding:5px;border:0; }' +
N'.Table td { border: 1px dotted white; }' +
N'</STYLE>' +
N'<table class="Table">' +
N'<th><font face="calibri" size="2">Column1</th>' +
N'<th><font face="calibri" size="2">Image Column</font></th>' +
N'<th><font face="calibri" size="2">Column3</font></th>' +
N'<th><font face="calibri" size="2">Column4</font></th>' +
N'<th><font face="calibri" size="2">Column5</font></th>' +
N'<th><font face="calibri" size="2">Column6</font></th>' +
CAST ( ( SELECT td=[Column1],'',
--filename is referenced
td='<img src="RedTL.gif"/>','',
td=[Column2],'',
td=[Column3],'',
td=[Column4],'',
td=[Column5],''
FROM [Table1]
ORDER BY [Column1]
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>'
我嵌入了其他图像,只是在表格中嵌入了一个问题。
电子邮件将在 Outlook 中查看,不会离开内部网络。
任何指针都会很棒!
谢谢