With SQL Server 2005, there is no need to use MAPI client to send emails. Fellow developers who have used MAPI in the previous versions of SQL Server are well aware of the challenges it had. However in Sql Server 2005, we can now use the Database Mail to send emails.
[Note: I assume you have set up and configured Database Mail. If not, check this link Database Mail Configuration Stored Procedures to use various stored procedures required to configure Database Mail. As an alternative, you could also use the SQL Server Surface area configuration tool to configure Database Mail]
Use the following script to send a mail from your Sql Server
Documentation for all available options is available at msdn
sp_send_dbmail (Transact-SQL)
[Note: I assume you have set up and configured Database Mail. If not, check this link Database Mail Configuration Stored Procedures to use various stored procedures required to configure Database Mail. As an alternative, you could also use the SQL Server Surface area configuration tool to configure Database Mail]
Use the following script to send a mail from your Sql Server
USE [YourDB] EXEC msdb.dbo.sp_send_dbmail @recipients = 'admin@xyz.com; xyz@xyz.com; pqr@xyz.com', @body = 'Just testing the mail', @subject = 'Sending Mail using Database Mail' ; GO
Documentation for all available options is available at msdn
sp_send_dbmail (Transact-SQL)
No comments:
Post a Comment
Suggestions are invited from readers