简体   繁体   中英

How can I find the source of a specific, SQL Server Database Mail-generated message?

A user has requested they be removed from an email notification sent out by our database server, but I can't find the object responsible for the email!

I know the sender, receiver, subject, body, and time of day. I know that Database Mail is sending the email, but I can't find the source job.

I've looked through SQL Server Agent Jobs, Stored Procedures, and Database Triggers in the appropriate database container, and even looked at the Visual Studio packages on that server and still can't find it. (I also did a quick survey of the other database containers, but none have any connection with the msdb.dbo.sysmail_allitems send_request_user associated to the email in question.)

Can someone offer any advice for tracking this down? Thank you.

This is solved.

@Larnu, your suggestion that the information could be stored in a table was key. @squillman and @AaronBertrand, I looked into using Extended Events for sp_send_dbmail , but was unable to master the tool.

After examining the dependencies of tableA (which had the same name as the email subject I was tracking down), I discovered that tableA was a parent to tableB (which had a very generic-sounding name). In turn, tableB had a trigger ! The trigger contained the list of email addresses and I was able to satisfy the original request of removing specified user from all future mailings.

Thank you all for your help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM