Tuesday, October 30, 2012

Available Methods for Sending a Mail from SQL Server

-->
Are you looking for a method that enables you to send a mail from your SQL server? For you Microsoft SQL server offers a special feature that will enable you to send a mail from it. Earlier to SQL server 2000, it is known as SQL mail but with release of SQL Server 2005 it has been changed & the new name is database mail. Database mail is very useful for sending a mail from SQL server to end users as well as to database administrator. It can contain data from files, queries, or many other resources available on the network.

What is SQL Mail? It is available in earlier version of SQL server 2005 & uses Message application programming interface (MAPI) to send mail. You can't use it without installation of outlook.

What is Database Mail? It is an enhanced version of SQL mail that is available in SQL server 2005 & upper versions. The best thing is that there is no any requirement to install outlook first to use it. It uses simple mail transfer protocol (SMTP) for sending a mail. In this article I would discuss about how to configure database mail in SQL server 2005 because SQL mail is a very old fashion.

How to Configure Database mail? You can configure database mail with the help of SQL server management studio. For exercise, we will learn how to setup a database mail using SQL Server Management Studio.
  • To setup database mail in SQL server 2005, connect to the instances of SQL server database.
  • Browse the management.
  • Now right click from your mouse on database mail.
  • Select configure database mail section.
  • Choose one option from list for a particular task.

How to Check Database is enabled or not? If you want to check database mail is enabled or not on your database then connect to an instance of SQL server database by a query editor and execute bellow: 
 
sp_configure 'show advanced', 1; GO RECONFIGURE; GO sp_configure; GO

Result: Go to the result pane and check “run_value” of the database. If run_value is 1 then database mail is enabled on your database otherwise not.