我想使用 SQL 服务器将图像嵌入到 HTML 电子邮件中。电子邮件正在发送,但图像未显示。我的代码如下:
DECLARE @body_custom VARCHAR(MAX)
SET @body_custom = '<head>
<title> Embedded Logo Example</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<table>
<tr>
<td valign="top" align="left">MyHeader</td>
</tr>
<tr>
<td valign="top" align="left">
<img src="image_1.jpg" width="235" height="70" alt="">
</td>
<tr>
<td valign="top" align="left">
<img src="image_2.png" width="235" height="70" alt="">
</td>
</tr>
<tr>
<td valign="top" align="left">
<img src="image_3.gif" width="235" height="70" alt="">
</td>
</tr>
</tr>
</table>
</body>'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Google_Gmail_Account'
, @recipients = '???@gmail.com'
, @subject = 'SQl 2008 R2 Email Test'
, @body = @body_custom
, @body_format = 'HTML'
, @file_attachments = 'C:\Users\User\Desktop\image_1.jpg;C:\Users\User\Desktop\image_2.png;C:\Users\User\Desktop\image_3.gif'
这会将电子邮件和图像作为附件发送,但它们不会显示在电子邮件中。
我还将图像添加到我的谷歌驱动器并获取他们的链接并使用它,但仍然没有成功......