SqlAnswersMail
is a powerful component that was designed to be compatible with xp_sendmail --
the interface and functionality are almost identical with a few minor
exceptions:
- The interface for
SqlAnswersMail does not support the @type parameter since this
parameter only applies to MAPI
- SqlAnswersMail does not
return text Mail Sent; instead it returns a one-row, one column
resultset that has one of three values Mail Sent, Mail Queued,
or Queue Processed depending on the call.
Since
SqlAnswersMail implements 99% of functionality of xp_sendmail, it’s possible to
replace xp_sendmail with SqlAnswersMail in a way that’s completely transparent
to existing SQL code; thus you can start using all the new features of
SqlAnswersMail without modifying your existing SQL code.
This
process has been tested on SQL Server 2000 only. Substitution of sp_sendSAM for
xp_sendmail on SQL Server 2005 is currently not supported.
XP_Sendmail
is an extended stored procedure provided by Microsoft as part of Microsoft SQL
Server. While substituting XP_Sendmail with SqlAnswersMail worked in all
scenarios tested in our lab, we cannot guarantee that this substitution will
not cause unforeseen problems in your environment; therefore we recommend that
you test this substitution thoroughly in your development environment before
implementing it in production.
Here are
the steps for making the substitution
- Install
SqlAnswersMail on the server. Make sure to install sp_sendSAM in the
master database of your server. For more information see Configuration Guide.
- Run
the script sp_sendSAMWrapper.txt
- Save
the results of the script in a permanent location since you may have to
use the rollback script
- Test the solution by running
the following SQL (you need to substitute info@domain.com
with your email)
exec master..xp_sendmail
@recipients='info@domain.com',
@subject='Email from SqlAnswersMail via xp_sendmail'
If you
run into any problems after the switch, you can always execute the rollback
script you saved in step #3 in the master database of your server to rollback
to the original configuration.