asp/ado/xp_sendmail/return codes/brain dead

Discussion in 'ASP General' started by Beverley, Jul 26, 2005.

  1. Beverley

    Beverley Guest

    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.

    Beverley, Jul 26, 2005
    1. Advertisements

  2. Beverley

    Beverley Guest

    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" <> wrote in message news:...
    I think I've lost my mind. This worked earlier today. Apparently I broke something but I have no idea what.
    Beverley, Jul 26, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lloyd Sheen

    Brain Dead Reformatting

    Lloyd Sheen, Jan 24, 2004, in forum: ASP .Net
    Lloyd Sheen
    Jan 24, 2004
  2. Replies:
    S. Justin Gengo
    Apr 24, 2006
  3. Replies:
    Aug 20, 2005
  4. pataphor
    Jun 14, 2009
  5. Jeff Cochran

    Using xp_sendmail in ASP?

    Jeff Cochran, Feb 24, 2004, in forum: ASP General
    Jeff Cochran
    Feb 24, 2004

Share This Page