SQL - Send email

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu

In the past, I've sent mail through SQL server using xp_sendMail. That's been depreciated; and the preferred way is to use msdb.dbo.sp_send_dbmail.

This article is just the code needed to send an email using that procedure.

You may wonder why we think it's a good idea to blog this sort of trivia; we do it because we're looking for the shortest possible route to getting an application developed. If all the pieces of code that we normally use (but forget the syntax) are in one place we've achieved that goal