Can I ask what is the difference between xp_sendmail
and sp_send_dbmail
proc? They are both send e-mail message, which may include a query result set attachment, to the specified recipients.....
What is the difference?
Can I ask what is the difference between xp_sendmail
and sp_send_dbmail
proc? They are both send e-mail message, which may include a query result set attachment, to the specified recipients.....
What is the difference?
Another difference between the two is that email message sent using sp_send_dbmail() will be rolled back (not sent) if the transaction is rolled back. This does not happen with email sent using xp_sendmail().
So, if you want the email message to be sent regardless of the end result of the transaction you'll need to use xp_sendmail().
I was sending emails to notify users if an SP was unable to complete it's processing. Of course, I was rolling back the transaction in that event. When I switched to sp_send_dbmail() the transactions that were being rolled back (the very ones I wanted to get an email notification from) stopped sending emails.