我在 SQL Server 中使用数据库邮件并尝试发送电子邮件。我创建了这个简单的 html 消息用于测试目的:
declare @body nvarchar(1000)
select @body =
'<html><body>
<h3>Test Email</h3>
<table border="1">
<tr>
<th>ID </th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
</tr>
<tr>
<td>2</td>
<td>Marry</td>
</tr>
</table>
</body></html>'
EXEC msdb.dbo.sp_send_dbmail @recipients = 'myemail@gmail.com'
, @subject = 'Test', @body = @body, @reply_to = 'noreply@myserver.com',
@from_address = 'noreply@myserver.com', @profile_name= 'My SMTP'
但是,HTML 不会在 Outlook 2013 和 Gmail 上呈现。它显示了这一点:
为什么它不起作用?