Results 1 to 2 of 2

Thread: xp_sendmail

  1. #1
    sailaja Guest

    xp_sendmail

    Hi,

    I am using xp_sendmail in a stored procedure.I need to update the fields after the mail sent. Is there a way to capture the errors or server messages that occurs. I am using the following code.....


    select @myquery= 'Execute LeadDistribution..sp_sendmailB ' + convert(char,@AssToID) /*calling the sp_sendmailB procedure */

    execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',@query=@myquery

    Select @send_Mail=@@Error

    If @send_Mail=0
    Begin
    update MasterleadPool /*Updates the MasterleadPool table once the mail sent */
    Set EmailSent='Y', Dateout=getdate()
    where AssToID=@AssToID and EmailSent='N' and AssToFlag='Y'
    End


    I used @@error to capture the error but it does'nt work. I got server message as follows.... So the problem is it should'nt go to update statement if there is any type of errors in sending a mail..

    Server: Msg 17903, Level 18, State 1, Line 0
    MAPI login failure.

    (1 row(s) affected)

    Please help me if anyone knows....

    Thanks,
    Sailaja

  2. #2
    Jeff Putnam Guest

    xp_sendmail (reply)

    MAPI login failure generally means that SQLMail isn't logging in to the right account, or using the right password. Right click SQLMail in enterprise manager and select properties... then make sure it's actually using the right profile.


    ------------
    sailaja at 3/27/01 12:53:57 PM

    Hi,

    I am using xp_sendmail in a stored procedure.I need to update the fields after the mail sent. Is there a way to capture the errors or server messages that occurs. I am using the following code.....


    select @myquery= 'Execute LeadDistribution..sp_sendmailB ' + convert(char,@AssToID) /*calling the sp_sendmailB procedure */

    execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',@query=@myquery

    Select @send_Mail=@@Error

    If @send_Mail=0
    Begin
    update MasterleadPool /*Updates the MasterleadPool table once the mail sent */
    Set EmailSent='Y', Dateout=getdate()
    where AssToID=@AssToID and EmailSent='N' and AssToFlag='Y'
    End


    I used @@error to capture the error but it does'nt work. I got server message as follows.... So the problem is it should'nt go to update statement if there is any type of errors in sending a mail..

    Server: Msg 17903, Level 18, State 1, Line 0
    MAPI login failure.

    (1 row(s) affected)

    Please help me if anyone knows....

    Thanks,
    Sailaja

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •