Chi*_*keh 4 sql sql-server sp-send-dbmail
我编写了一个触发器来在特定列更改后抓取某行记录,并将这些记录存储到另一个名为“反馈”的表中。
然后我尝试使用以下代码通过 sp_send_dbmail 将更改通过电子邮件发送给我们的用户。
但是,在测试代码时,我不断收到以下错误消息:
消息 14607,级别 16,状态 1,过程 sysmail_verify_profile_sp,第 42 行
配置文件名称无效
配置文件被调用Feedback Survey并使用数据库邮件配置向导正确设置。
我可能做错了什么?
Declare @email nvarchar(MAX),@content1 nvarchar(4000), @RequestID INT, @custname nvarchar(200)
select @email = '', @content1 = '', @RequestID = 0, @custname = ''
SET @content1 = 'SET QUOTED_IDENTIFIER OFF;
This is a computer generated email message.
Please DO NOT use the REPLY button above to respond to this email.
Dear '+ @custname +':
Thank you for using the order processing system.
Please click the link below to complete a survey
http://satisfactionsurvey.php?wo=@RequestID
Regards,
Order administrator. '
SELECT top 1 @email = @email+';'+Email, @content1 = @content1
FROM Feedback
WHERE Status = 'Completed'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Feedback Survey', -- our defined email profile or static info
@recipients = @email, -- Authorized user email
@blind_copy_recipients = 'jab.judah@yahoo.com',
@subject = 'Feedback Survey',
@body = @content1;
--delete records after sending email.
Delete FROM Feedback
Run Code Online (Sandbox Code Playgroud)
小智 5
在数据库邮件配置向导中,转到管理配置文件安全并检查公共和私有配置文件的设置。
检查您使用的登录名是否已连接到配置文件“反馈调查”。
更详细的信息可以在消息 14607,级别 16,状态 1 中找到 - 配置文件名称无效(2014 年 1 月 15 日的互联网档案链接)。