SQL server Database Mail Error-SQL Server 2008 R2
Posted on 2016-09-29
I am receiving the following error when i try to run the Agent Job which tries to send an email.
Executed as user: UserXXX. The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (Error 229). The step failed.
Just for the test purpose, I have assigned the user-UserXXX to sysadmin privileges but still no luck.
I am running the job step Advanced->"Run as user -UserXXX' to execute this Job.
I have manually added the user UserXXX to the msdb database role 'DatabaseMailUserRole' also.
Have checked the sp_send_dbmail has the grant permission and the GranteeName- 'DatabaseMailUserRole'
Please let me know how to solve this issue?