Recently, a viewer mailed me asking about an error in Database Mail. The error was EXECUTE permission denied on object sp_send_dbmail, database 'msdb', schema 'dbo'.
The error means that the user who is trying to send Database Mail does not have the required permissions to execute sp_send_dbmail. To be able to send mail using Database mail, a user has to be a member of the ‘DatabaseMailUserRole’ role in the msdb database. Here’s how to add the user to this role
USE msdbAfter successful execution of this statement, the error should be fixed.
EXEC msdb.dbo.sp_addrolemember @rolename = 'DatabaseMailUserRole',
@membername = 'SomeDomain\SomeDomainUser';