使用数据库邮件时为什么会出现以下错误 - >程序sysmail_verify_profile_sp,配置文件名称无效?

时间:2015-08-10 14:33:28

标签: sql sql-server

我写了一个触发器,在特定列更改后抓取某一行记录,并将记录存储到另一个名为Feedback的表中。

然后我尝试使用以下代码通过sp_send_dbmail将更改通过电子邮件发送给我们的用户。

但是,在测试代码时,我不断收到以下错误消息:

Msg 14607, Level 16, State 1, Procedure sysmail_verify_profile_sp, Line 42
profile name is not valid

该配置文件名为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

1 个答案:

答案 0 :(得分:4)

从数据库邮件配置 - >邮件配置文件公共和私人配置文件的安全检查设置 检查您使用的登录信息是否与个人资料'反馈调查'。

相关联

更多详细信息可以在这篇博客文章中找到: https://cms4j.wordpress.com/2013/12/17/msg-14607-level-16-state-1-profile-name-is-not-valid/