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)
 Problems with xp_findnextmsg

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-19 : 07:51:10
Daniel writes "I'm having trouble with processing mail in SQL Server 2000. Basically, data is emailed back to an exchange mail box, which has been set up for the SQL Server.

I use the combination of xp_findnextmsg and xp_readmail to go through the messages in the inbox and get the subject and body of each message, which are then subsequently parsed for data by my SP.

The SP initially worked perfectly, but the inbox of the SQL Server has begun to fill up. Among the many messages (which are manually cleaned) were automated error messages such as "Your message was undeliverable", which were sent back to the SQL Server mail-box when it attempted to send out survey forms to incorrect addresses. The problem is that as xp_findnextmsg proceeds through the list of emails, it eventually runs into one of these error messages. At this point it returns NULL as the message id for these emails. What's more, the return code for xp_findnextmsg remains 0 (success), and it does not proceed past this email message (subsequent calls to xp_findnextmsg return NULL indefinately).

It only seems to be server-generated messages that cause problems, but this assumption is based only on what I have observed.

I don't actually need to read the contents of such messages, I just need xp_findnextmsg to get past them so I can extract data from correct replies."
   

- Advertisement -