Blog Post

Thoughts on Database Mail

,

I suspect few would argue that database mail in SQL 2005 is a huge improvement over the mail system in SQL 2000. No more Outlook on the server! However, there are two points about it's use I encourage everyone to think about:

  • One of those quiet quirks, they log all email that is sent in MSDB and don't prompt you to archive, nor is part of the standard maintenance plan. If you're sending much mail you'll want to set up a job to call sysmail_delete_mailitems_sp to remove some of the history, and also run sysmail_delete_log_sp to delete some status logging messages. This is important for space management, could also be important for security depending on what you're sending out in the messages. Note also the "sp" at the end instead of the beginning - really, did we need that change in convention?
  • Don't fall into the trap of using it for all your enterprise email needs. Sooner or later MS will change the proc in one way or another, and you may get stuck tracking down all the references to it in code (just like you're looking for xp_sendmail if you used that in SQL 2000). Instead, either create a wrapper proc (usp_sendemail) that calls sp_send_dbmail, or better yet, just build your own emailer that you'll own forever. Being able to send email is incredibly important to most businesses, and having a system you own and tweak is very handy stuff.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating