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 Administration (2000)
 xp_sendmail

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-02 : 07:14:30
CC writes "Hi,
I encountered the following errrors when I try to execute xp_sendmail.

Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005

I've tried most of the suggestions provided on the internet/books but without any success. I think my SQL Mail and SQL Server Agent, have been configured correctly because I can send email notification autimatically after completed running a job.

I need to get the xp_sendmail working so that I can send attachment(ie.error log). I notice that the recipient is hard coded/fix. Is there any way that I can have a dynamic recipient? Like the person who has just executed the job because more than one person can execute the job and each one of them has to be notified by email with their on error log.

Any suggestions would be really appreciated.

Thanks. "

Shastryv
Posting Yak Master

145 Posts

Posted - 2003-07-02 : 11:35:23
There is no direct way but what you can do is, create a table with list of authorized user names and their email address and write stored proc to capture the user id and get the email id from the table and use the following syntax

EXEC master..xp_sendmail @recipients = @Email_ID,
@query = 'Query',
@subject = 'SUB',
@attach_results = 'TRUE', @width = 250


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-02 : 11:39:18
Error 0x80004005 is a SQL Mail problem. The server will need to be rebooted to correct the problem. We were having the problem occur every few weeks in production. We had several MS trouble calls in. Eventually, MS recommended that we use Outlook 2002 instead of Outlook 2000. Since Outlook 2002 has been installed, we have not had ANY SQL Mail problems including the error that you have received. I highly recommend that anyone who uses SQL Mail, even if you aren't experiencing problems right now, to use Outlook 2002.

Tara
Go to Top of Page
   

- Advertisement -