sqlServer邮件发送

来源:互联网 发布:win10添加不了网络账户 编辑:程序博客网 时间:2024/04/28 21:00

1.邮件发送端配置,如下图;详细步骤就不在这里具体说了,


2. 查看Database Mail XPs功能是否打开

select name, value, description, is_dynamic, is_advanced
from sys.configurations
where name like '%mail%'

--value为0说明没有打开,需要执行以下语句

sp_configure 'show advanced options',1
go
reconfigure
go
 
sp_configure 'Database Mail XPs',1
go
reconfigure
go

3.执行邮件发送语句

EXEC msdb.dbo.sp_send_dbmail 
@profile_name = 'db_mail',         --配置文件名称
@recipients = 'xxxx@163.com;xxxx@qq.com',  --收件email地址
@subject = '测试',                 --邮件主题
@body = '测试'            --邮件正文内容

0 0
原创粉丝点击