Forum Moderators: open

Message Too Old, No Replies

How can I use SQL SERVER trigger to send an email in C#

         

asifakhtar

8:19 pm on Jan 23, 2010 (gmt 0)

10+ Year Member



I am building service failure notification system which notifies customers and management whenever there is a delay in the service. How can I use SQL SERVER trigger to send an email to a group of people when I add an alert in the alert database table using c#.

Ocean10000

9:55 pm on Jan 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have never had the need to use C# inside of SQL Server 2005/2008 to send mail. I have always done it with the use of SQL Triggers and SQL email abilities.

The basics is I setup one table, when a row is added will trigger an email to be sent out. And the row itself will contain the information for the email.

Reference:
SQL Mail and SQLAgentMail [msdn.microsoft.com]
Create Trigger [msdn.microsoft.com]
xp_sendmail [msdn.microsoft.com]