博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
add the send mail permission of non-sysadmin user
阅读量:6626 次
发布时间:2019-06-25

本文共 1758 字,大约阅读时间需要 5 分钟。

source text:

This problem occured when I was trying to send emails using the msdb.dbo.sp_send_dbmail Stored Procedure as a non-sysadmin user in SQL Server 2012.

 For Example:

EXEC msdb.dbo.sp_send_dbmail@profile_name = 'MailProfile', @recipients = 'test@test.com', @subject = 'Automated Test Results (Successful)', @body = 'The stored procedure finished successfully.'

The error was:

Msg 229, Level 14, State 5, Procedure msdb..sp_send_dbmail, Line 1The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'.

You can see that the non-sysadmin user has been added to the DatabaseMailUserRole role in the database.

I try again of send mail.

The  new error was:

Msg 14607, Level 16, State 1, Procedure sp_send_dbmail, Line 141Profile name is not valid

Note: If the database mail profile is not set for public access then the user is not allowed to use the specified profile.

Now set the profile to Public.

Right-click on the Database Mail in the Management Studio and select the Configure Database Mail menu option.

 

Click the "Next" button.

 

Select "Manage profile security" then click the "Next" button.

 

Now go to Public Profiles, select your profile name and then set the profile to Public then click the "Next" button .

 

Note: The Manage Profile Security screen allows you to set this profile to either public or private. A private profile is accessible only to specific users or roles. A public profile allows any user or role with access to the mail host database (Microsoft database) to send e-mail using this profile.

Now click the "Finish" button.

 

Now you can send emails using the msdb.dbo.sp_send_dbmail Stored Procedure as a non-sysadmin user in SQL Server 2012.

转载于:https://www.cnblogs.com/ziqiumeng/p/10953938.html

你可能感兴趣的文章
php扩展安装
查看>>
Windows与Linux之间的文件自动同步
查看>>
15个重要的Android代码
查看>>
(转)android 牛人必修 ant 编译android工程
查看>>
求最大公约数与最小公倍数
查看>>
C# Winform 跨线程更新UI控件常用方法总结(转)
查看>>
eclipse菜单栏不显示 + the system is running in lou-graphics mode问题
查看>>
【WebService】使用jaxb完成对象和xml的转换
查看>>
如何去除My97 DatePicker控件上右键弹出官网的链接 - 如何debug混淆过的代码
查看>>
多文档
查看>>
输入5个学生的信息(包括学号,姓名,英语成绩,计算机语言成绩和数据库成绩), 统计各学生的总分,然后将学生信息和统计结果存入test.txt文件中...
查看>>
BZOJ2337 [HNOI2011]XOR和路径
查看>>
C# 该行已经属于另一个表 ...
查看>>
android 避免线程的重复创建(HandlerThread、线程池)
查看>>
手游-放开那三国socket协议分析
查看>>
SQL Lazy Spool Eager Spool
查看>>
type的解释
查看>>
Windows Phone 8 开发环境搭建
查看>>
2017:IDC市场规模将持续增长 增速放缓
查看>>
从自动驾驶到学习机器学习:解读2017科技发展的15大趋势
查看>>