Question

I have a logon trigger that is designed to block certain logins (like 'Login%', or = 'Login1', etc.), if they come from:

  1. certain IP
  2. certain hosts
  3. SSMS

Example code can be found here: https://paste.ofcode.org/wpJCPFVSEMFwx3iUirwj7X

Problem:

In the trigger code, it also creates report (which host/IP tried to login), and supposed to send this report by email

Database Mail is setup on the instance, and it can send emails just fine

So trigger itself works and does its main function, it blocks logins based on criteria above

But, it does not send emails that it is supposed to do

Also I've tried to grant permission to send emails to Login1 for testing purpose (login that is supposed to be blocked by the trigger), and verified that this login can send emails, but it did not resolve trigger's inability to send emails

How can I make this logon trigger send emails ?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top