March 24, 2017 at 2:24 am
How can I send mail with a user within a contained database is SQL Server using Database Mail? I tried using msdb.dbo.sp_send_dbmail but since any users local to the contained database do not see msdb, therefore msdb.dbo.sp_send_dbmail is unreachable as well. Then I tried creating certificates and signing procedures, first going straight to msdb and then re-routing the whole stuff through the master database (I know, it's not a 'very good idea') but even that does not work (I suppose it would break the containment, hence not allowed).
Is there a way do that at all?
March 26, 2017 at 3:38 pm
If the user on the partially contained database is a "SQL user mapped to a login" or a "Windows User", they both are still created mapped to a login. That login can still have a user in MSDB that is a member of the DatabaseMailUser database role and it can still call sp_send_dbmail. I just tried it and got it to work. I was not able to get a SQL User that did not have a mapped login to work however.
Joie Andrew
"Since 1982"
March 27, 2017 at 7:56 am
The main problem was that mapping the user in the contained database to an SQL Server login was not an option, it had to be contained as well. Meanwhile, I got a working answer elsewhere that I'll share here in case others run into this.
The not working solution or what I tried first is as described below, with some additional details:
Now it works as expected.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply