Bluehost - Affordable, Reliable Web Hosting Solutions
Powered by MaxBlogPress 

Would you like to get paid for signing up for a web hosting plan with Bluehost.com?
Powered by MaxBlogPress 

Database Mail vs SQL Mail in SQL Server 2005

Posted on October 29, 2008
Filed Under Database, Development | 1 Comment

If you've enjoyed reading this post then please subscribe to my Full Text RSS Feed.

SQL Mail was what one would use to send emails from SQL Server in the SQL Server 2000 version. But in SQL Server 2005, SQL Mail is considered legacy. Microsoft introduced a better email component called Database Mail for SQL Server 2005.

In SQL Mail, you can run the xp_sendmail stored procedure to send an email from SQL Server 2000. Here is an example of the xp_sendmail script.

I use a lot of xp_sendmail in my SQL script when I was developing applications in SQL Server 2000 and since migrating to SQL Server 2005, there are still the legacy SQL Mail scripts lurking in SQL Server 2005 which I have not migrated to using Database Mail.

So why did Microsoft make the decision to move away from SQL Mail and introduce Database Mail?

1. SQL Mail was developed and runs in-process to SQL Server service. This means if SQL Mail goes down, your SQL Server also goes down. You don’t want this to happen on your production database because you will not have many happy users if that happens.

2. To use SQL Mail you need to install the extended MAPI client component on your server. How I usually do this is by installing Microsoft Outlook on the server. This will install the MAPI client component. Without MAPI, SQL Mail will not run.

What are the advantages of using Database Mail?

1. Unlike SQL Mail, Database Mail runs outside SQL Server in a separate process. So if Database Mail goes down, it will not bring down SQL Server.

2. Database Mail does not need Extended MAPI client components installed for it to run.

3. Database Mail can be configued with multiple SMTP accounts and with multiple profiles. This increases the robustness of the system. In a realtime environment, if one mail server goes down, Database Mail will still be able to send emails through the other configured SMTP accounts.

4. In Database Mail, all mail events are logged and you can view the mail history.

5. You can configure Database Mail to limit file sizes, disallowing large attachments and filtering of file extensions such as .exe or .bat

Where do you enable Database Mail and SQL Mail in SQL Server 2005?

You do it through SQL Server 2005 Surface Area Configuration shown below. Click on Surface Area Configuration for Features.

Tick Enable Database Mail Stored Procedures to enable Database Mail in SQL Server

Tick Enable SQL Mail Stored Procedures to enable SQL Mail in SQL Server

Access Database Mail and SQL Mail and setup both in SQL Server Management Console, shown below.
Once that is setup, you can invoke Database Mail and SQL Mail to send emails and notification.

Bookmark and Share
Sphere: Related Content

Other Related Posts:

  • What is an Internet Server?
  • Yahoo Mail – 2GB storage
  • US politicians out to restrict Google mail service
  • SQL Server Integration Services is the new Data Transformation tool for SQL Server
  • SQL xp_findnextmsg and xp_readmail

  • If you've enjoyed reading this post then why not subscribe to received updates by email.

    Enter your email address:

    Delivered by FeedBurner

    Email This Post Email This Post

    Trackback This Post

    Comments

    One Response to “Database Mail vs SQL Mail in SQL Server 2005”

    1. Nitin Reddy on December 2nd, 2008 8:02 am

      Hi!

      I just came across your article when looking up why the use of SQL Mail is discouraged.

      Did you notice that the Surface Area Configuration tool isn’t provided with MS SQL Server 2008? Configuring Database Mail through SQL Server Management Studio let’s you enable Database Mail… and there’s always sp_configure!

      -Nitin

      Nitin Reddy’s last blog post..Using ASP.NET AJAX Extenders Part I

    Leave a Reply




    CommentLuv Enabled

    Twitter

    Posting tweet...

    Powered by Twitter Tools