views:

60

answers:

1

I am trying to keep a record of all of the emails that get sent via xp_smtp mail component, but I don't know hw to store the message. Storing a 1 because it failed doesn't do me much good.

DECLARE @rc INT EXEC @rc = master.dbo.xp_smtp_sendmail...

--Once the email is sent put the results (pass or fail) into another table: EXEC pr_InsertEmailLog @Body, @From, @Subject, @To, @rc, 'Error MESSAGE here'

Thanks in advance, Jeremy

A: 

The documentation say it only returns 0 or 1.

However, further down it mentions planned work with an output message parameter

Add an output parameter (@errmsg OUTPUT) which contains the error message in case of a failure to have better control over the execution and enable to XP to work in complete silent mode. The parameter would only contain data if the return code of the XP is not equal to 0 (zero) indicating some sort of failure.

YMMV, but some kind soul may have developed it further then this release.

gbn