Tuesday, December 2, 2008

Why SQL Mail is Dead

I've always wondered why we use SQL Mail instead of Database Mail, mostly because I started off serious work with SQL Server 2005 and used previous versions only to get a feel of what they've got to offer. Database mail offers a separation between SQL Server and the mailing component - SQL mail ran in the same OS process as SQL Server, which meant SQL Server stopped whenever SQL mail came up with an error.

When I read about the shortcomings of SQL Mail, I begin to realise that it's really archaic - you have to install an email client, setup SQL Agent with the account that has access to the right profile of the email client, experience a nightmare with debugging (since SQL Agent can't display any dialogs as it's a Windows Service), and more.

You can get the full list of problems experienced with SQL Mail here:
http://support.microsoft.com/default.aspx/kb/315886

If you've still got any code using SQL Mail instead of Database Mail, you can replace all calls to the xp_sendmail stored procedure with calls to the sp_send_dbmail stored procedure. You can find a mapping of the arguments and further information here:
http://msdn.microsoft.com/en-us/library/ms187891.aspx

No comments: