matao
matao

Reputation: 657

What's the best way send email from the database in SQL Server 2008 R2?

Migrating a legacy database from SQL Server 2000, and there are a few scheduled tasks that use SP_OACreate & CDOSYS to send emails to an open SMTP relay as in this KB article: http://support.microsoft.com/kb/312839

In SQL Server 2008 R2, what's the best (simplest) way to replace the sendmail functionality? It seems like DB Mail is the new best recommended way, anyone have much experience with it or another alternative?

Upvotes: 7

Views: 3020

Answers (3)

Haroon
Haroon

Reputation: 1110

Setup the SQL Server using DB Mail. It is fairly simple and uses SQL Service broker to manage messages - which means you don't lose mail if you can't connect to the SMTP server.

Upvotes: 3

gbn
gbn

Reputation: 432180

Yes, DB Mail is by far the best way: it's simple SMTP.

Don't think about using:

  • sp_OA% and cdosys (sp_OA% can be tricky and leak resources)
  • xp_sendmail (require local Outlook install for MAPI client)

Upvotes: 3

Jerad Rose
Jerad Rose

Reputation: 15503

Yes, I use sp_send_dbmail primarily for sending mail within SQL Server, and it seems to be easy enough to set up and a reliable option, with plenty of configuration available.

Upvotes: 3

Related Questions