I try to use Service Broker and DBMail together, but have some trouble with that.
I need to create the queue with activation.
And the stored procedure activated on this queue must send e-mail using DBmail.
It's looks simple, but it doesn't work.
There is my script to create objects, but don't forget create dbmail profile before use it.
PS And replace my email by yours
Activated procedures are under the EXECUTE AS context, so they cannot dirrectly invoke procedures in another database (e.g. msdb DBmail procs). The issue is covered on this serios of articles:
http://blogs.msdn.com/remusrusanu/archive/2006/01/12/512085.aspx
http://blogs.msdn.com/remusrusanu/archive/2006/03/01/541882.aspx
http://blogs.msdn.com/remusrusanu/archive/2006/03/07/545508.aspx
The easiest woraround is to mark the database where activation occurs as trustworthy:
ALTER DATABASE [<dbname>] SET TRUSTWORTHY ON;
HTH,
~ Remus
No comments:
Post a Comment