3

I'm using Service Broker to [maybe] monitor my database events, so I have my activation sp in some user database and it should react on some events by sending e-mail to admin. But it fails with the error

The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo

while trying to use sp_send_dbmail.

How can I manage the permissions in my case?

  • Did you see this question? – SqlWorldWide Sep 13 '17 at 13:14
  • 1
    @SqlWorldWide this question has to do with service broker sending mail and the "duplicate" of which it isn't has to do with a DDL trigger setup by the DBA to audit. Big difference in answers, in fact the answer has no meaning to this question. – Sean says Remove Sara Chipps Sep 13 '17 at 15:13
  • @SeanGallardy I did not mark it as duplicate. – SqlWorldWide Sep 13 '17 at 15:15
  • 1
    Again, not a dupe. Here the user specified in EXECUTE AS in the Queue Activation configuration specified in (CREATE QUEUE)[docs.microsoft.com/en-us/sql/t-sql/statements/…, or the EXECUTE AS on the activation proc (if not 'SELF'), needs permissions on sp_send_dbmail. – David Browne - Microsoft Sep 13 '17 at 17:24
  • Upvoted the comments stated this is not a duplicate. The "solution" from "dup" is: "confirm that there are no attempted email sends from your script". Why does he confirm it? His activation sp DOES send mail, and he need a solution how to make it functional...I think the only option is to sign the proc with the certificate or some variation of this – sepupic Sep 13 '17 at 18:40