Friday, September 2, 2011

Configuring Database Mail in SQL Server 2008 R2

Database mail enables an instance of SQL server to send outbound e-mail messages.

For using Database mail feature in SQL server, one has to enable database mail feature by running the following query:

EXEC sp_configure "Database Mail XPs",1
GO
reconfigure with override


The next step would be to Configure Database Mail. For this,
    Connect to the instance of SQL server. Open Management node -> right click on Database Mail -> Configure. You will get welcome screen. Click Next. (There's nothing to do on the Welcome screen). In case you didnt enable the feature of Database Mail, it shows you a pop up asking you to enable it. Click "ok". If you did enable it earlier, it just takes you to the next page of the dialog.
    Click Set up(assuming you're installing it for the first time) -> Next.
    Specify Name for the profile and Click on ADD for configuring e-mail.
    You need an SMTP account for this. Fill in your account details. Also select your authentication mode and fill in the required details.
    Click ok and then click Next -> Finish.
    The final page shows all your configurations and gives message of completion. Click Close.
Now you are ready to test your Database Mail.
Right Click on Database Mail and click on send Test Mail. Enter the recepient's email address and hit send mail. Verify that you have recieved it.
Congratulations. You are all set to start using this wonderful service.


1 comment:

  1. Hey, you can add screenshots to the post. It will aid in understanding the technology :-)

    ReplyDelete