Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to handle xp_sendmail error in a trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-22 : 06:49:30
Rob writes "How do I keep an xp_sendmail failure inside a trigger (for example, permissision denied or no mail available) from killing the entire transaction? I would like the insert, update, or delete which fires the trigger to work regardless of if the xp_sendmail was successful inside the trigger. Is there a way to test mail before calling it and getting an error?

I tried checking the return_status of the exec command, but the trigger seems to be dying right when it calls xp_sendmail. Is 'permission denied' a fatal error?

exec @return_status = xp_sendmail parameter list

if @return_status <> 0
-- hopefully ignore error and make it look like the trigger was successful anyway."
   

- Advertisement -