views:

95

answers:

2

How can I send e-mails using Database Mail (which is integrated in SQL Server) in C# ? I couldn't find a useful article or something which can help me thoroughly.

+1  A: 

I don't have any experience with Database Mail, so this is just from looking at this tutorial, but it seems like you could just Parametrize an ADO.NET SQL Query with whatever you're sending, and use ADO.NET to execute the SQL stored procedure for sending mail.

George Stocker
+1  A: 

I also don't have any experience but SQL Server Agent Mail (http://msdn.microsoft.com/en-us/library/ms188235.aspx) appears to be able to use Database Mail.

How to configure Agent to use Database Mail is here: http://msdn.microsoft.com/en-us/library/ms186358.aspx

The .NET class for Agent ( Microsoft.SqlServer.Management.Smo.Agent) is here: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.aspx and while there are enumerations for mailtype nothing jumps out at me regarding mail .... it might be in a "job"

BlueShepherd
Actually the third link should have been http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.mail.aspx . Because that link actaully talks about Database Mail :) Thanks tho, your answer led me there :)
Braveyard