如何在SQL Server中发送电子邮件

在本文中,将介绍如何在SQL Server中发送电子邮件。
我们可以从SQL Server发送电子邮件。
在发送电子邮件之前,我们必须在SQL Server中配置电子邮件。
其中我正在解释在SQL Server中发送电子邮件。

要发送电子邮件,我们需要通过SP_Configure存储过程启用数据库邮件XPS参数。

示例

sp CONFIGURE 'show advanced', 1

GO

RECONFIGURE

GO

sp_CONFIGURE 'Database Mail XPs', 1

GO

RECONFIGURE

GO

要发送电子邮件,我们使用以下语句

USE msdb

GO

EXEC sp_send_dbmail @profile_name='oirvip',

@recipients='jack@onitroad',

@subject='Test message',

@body='This is the body of the test message.

Congrates Database Mail Received By you Successfully.'
日期:2020-06-02 22:17:55 来源:oir作者:oir