By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,822 Members | 729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,822 IT Pros & Developers. It's quick & easy.

asp/ado/xp_sendmail/return codes/brain dead

P: n/a
I think I've lost my mind. This worked earlier today. Apparently I broke something but I have no idea what.

I have a stored procedure that builds and sends an email using xp_sendmail. It is called after the user makes a change to a form (it tells the support centre that a change has occurred.)

The last bit of my SP is this:
-- It fails if it has no recipient list
if isnull(@recip, '') = '' set @recip = @supportemail

declare @rc int -- have also tried changing it to bit

exec @rc = master..xp_sendmail
@recipients = @supportemail
, @message = @msg
, @subject = @subj
, @no_output = 'False'
, @query = @q
, @width = 200

Return Code Values
0 (success) or 1 (failure)

select @rc
return @rc
If I call it through query analyzer, @rc is 0 and I receive the email.
If I call it through my ASP page (which worked earlier), cint(rs.fields(0)) is -1 and I do not get the email.

strSQL = "exec pr_EmailNotification " & iRequestID
writeline "<P>" & strSQL

set rs = ConnObj.Execute (strSQL)
writeline "<P> Result: " & cint(rs.fields(0)) '0 (success) or 1 (failure)

(All variables are declared.)

It was working earlier, I had proven it... I thought it was the return @rc line that was doing it and was just keeping in select @rc for debugging. When I was ready to move on, I removed my debug statement, and then it started failing. I've put it back in, but it still fails, so I must have also removed something else, or changed something, or something.

I'm at wits end. It still works perfectly through Query Analyzer. But not ASP.

Any suggestions would be appreciated.

Jul 25 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Okay, I've found my mind.

I forgot I moved a piece of the code in the middle of my SP out to another SP. And the user account being used by the ASP page didn't have access to it, although I did under my own personal ID on Query Analyzer.

All's well, thanks for your time :)

"Beverley" <al**********> wrote in message news:ev**************@TK2MSFTNGP15.phx.gbl...
I think I've lost my mind. This worked earlier today. Apparently I broke something but I have no idea what.
Jul 25 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.