添加图像以通过SQL发送电子邮件

时间:2010-11-24 00:42:40

标签: html sql-server

我正在尝试通过SQL存储过程发送一个简单的HTML电子邮件。 是否可以为电子邮件结果添加公司徽标等图像?

这是存储过程的一部分。

/*Create HTML*/

SET @TableHTML = 
    N'<H4>Production Alert (' + CONVERT(VARCHAR(10),GETDATE(),101) + ')</H4>' +
    N'<table border="1">' +
    N'<tr>' +
    N'  <td>Company</td>' +
    N'  <td width="70" align="CENTER">Department</td>' +
    N'  <td width="70" align="CENTER">Target</td>' +
    N'  <td width="70" align="CENTER">Shipped</td>' +
    N'  <td width="70" align="CENTER">Achievement by Yesterday</td>' +
    N'  <td width="70" align="CENTER">Achievement for this month</td>' +
    N'  <td width="70" align="CENTER">Difference</td>' +
    N'  <td width="70" align="CENTER">Catch Up QTY</td>' +
    N'</tr>' +

    CAST ( ( SELECT td = a.CompanyName,    '', 'Right' AS "td/@align",
                    td = DepartmentName,   '', 'Left' AS "td/@align",
                    td = ForecastQtyAcc,   '', 'Right' AS "td/@align",
                    td = ShippedQtyAcc,    '', 'Right' AS "td/@align",
                    td = ThePercentage,    '', 'Right' AS "td/@align",
                    td = ThePercentageAll, '', 'Right' AS "td/@align",
                    td = TheDiff,          '', 'Right' AS "td/@align",
                    td = CatchUpQTY,       ''

              FROM #Monthdata a
              FOR XML PATH('tr'), TYPE 
    ) AS NVARCHAR(MAX) ) +
    N'</table>' ;

DROP TABLE #Monthdata

/ 通过电子邮件发送 /     SET @TableHTML = @TableHTML +                      N''+                      N ''

1 个答案:

答案 0 :(得分:1)