我正在尝试发送数据库邮件,但是却收到了EXECUTE permission denied on the object 'sp_send_dbmail' database 'msdb', schema 'dbo'.
。我正在运行的代码如下:
SELECT SUSER_NAME(), USER_NAME();
Create USER kyle_temp FOR LOGIN Foo
EXECUTE AS USER = 'kyle_temp';
SELECT SUSER_NAME(), USER_NAME();
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Mail Profile',
@recipients = 'test@test.com',
@subject = 'Test',
@body = 'Test'
REVERT;
DROP USER kyle_temp
Foo登录显示它已映射到msdb中的Foo用户。当我查看msdb中的foo用户时,我看到它已检查“ DatabaseMailUserRole”,并且对dbo执行sp_send_dbmail
。
我想念什么?