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 is unreliable

Author  Topic 

Zathras
Starting Member

28 Posts

Posted - 2005-04-07 : 20:00:11
After working with xp_sendmail in SPs for awhile now, I think it is unreliable at best. We've already installed the hotfix regarding broken sessions between exchange and sql server [url]http://support.microsoft.com/default.aspx/kb/833045?[/url], but it only takes a matter of time before xp_sendmail stops working and returns the dreaded:
   Server: Msg 18025, Level 16, State 1, Line 0
   xp_sendmail: failed with mail error 0x80004005


What's even worse about the problems with xp_sendmail is that the error is not logged in the SQL Server logs. Anyone know how to get this error logged?

My question is that has anyone else reached this conclusion and moved to something else? What are you guys using? I just read the excellent article about making a message queue at [url]http://www.sqlteam.com/item.asp?ItemID=5908[/url].

I'm up for making the message queue system if that's the way to go, unless people know of better or more accepted way. Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-07 : 20:20:53
To make SQL Mail more reliable, use Outlook for 2002, also known as Outlook XP. When we were running Outlook 2000, we had this reliability problem as you have mentioned. Since upgrading to the newer version per MS' advice, we have not had any reliability problems. And that was about 2 years ago. HTH.

But I wouldn't use SQL Mail for an application. It should only be used for DBA type stuff like notifying DBAs of job failures and such.

Tara
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-07 : 21:27:34
I FULLY agree with Tara on this. NEVER use SQLMain for a mail application. It's for notifications only to alert the DBA group. If you need to email and you want to hold the messages, draw recipient lists, etc from SQL Server that's great. It's very easy to make an application that will just take the lists and messages, then email using SMTP.

We had a lot of people using SQLMail for this. It's extremely inefficient and it's unreliable. It can also be a security risk depending on how the account is setup.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

Zathras
Starting Member

28 Posts

Posted - 2005-04-07 : 23:15:37
What should I be using then? Outlook itself? How do I get my SP to communicate with Outlook? Can you point me in the right direction on how to do that?
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-07 : 23:22:18
Don't use SQL Server for it at all. Learn to develop. This is an application, not a database. If you are determined to use SQL Server for mail, then at least use SMTP mail. You can find out how to do that here:

http://www.sqlteam.com/filtertopics.asp?topicID=125

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

Zathras
Starting Member

28 Posts

Posted - 2005-04-08 : 01:25:52
I think there is some misunderstanding.... I'm not writing some C# or VB application that just happens to call some SPs. These are pure T-SQL stored proceedures that move & manipulate data from one database to another. They are run as part of a nightly batch process executed by the SQL Agent. The emails are generated by the SPs whenever there is a problem in the process and that manual intervention is needed.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-08 : 01:31:30
so you need it for alerts and notifications, i personally don't use sqlmail and create a mailing application using VB, afraid to even set up sqlmail no matter how careful you are, coz you have to use outlook

to each his own however



--------------------
keeping it simple...
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-08 : 01:34:44
Ok. Zathras, you can use the alternate SMTP solutions for the alerts and status updates. Did you look at the link I gave you?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

Zathras
Starting Member

28 Posts

Posted - 2005-04-08 : 01:38:28
Yes, I'll create the message queing system for certain. I'll see if I can get the dba to install the alternative sendmail object and give that a whirl. Thanks for you help.
Go to Top of Page

bakerjon
Posting Yak Master

145 Posts

Posted - 2005-04-08 : 09:05:49
If you are not into using sp_OACreate (which I hate!), you could use xp_smtp_sendmail from Gert Drapers.

http://www.sqldev.net/xp/xpsmtp.htm

Now I know, and knowing is half the battle!
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=48013

Go to Top of Page

Zathras
Starting Member

28 Posts

Posted - 2005-04-08 : 09:14:21
I need one that can do @query too. Looks like that one states it as a known limitation. I need to check if the others can do @query in the email also...
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-08 : 12:33:21
In response to your e-mail:

SQL Mail uses Outlook as the e-mail client. To work with SQL Mail, you use xp_sendmail like you have. So xp_sendmail will become more reliable if you upgrade your Outlook client on the database server.

Tara
Go to Top of Page
   

- Advertisement -