Hello,
I setup an alert system using Database Mail on SQL Server 2008 Std Windows 8
After a couple of successful tests, I started to receive the same email thousands of times. I could not stop it; stopped the queue, removed the account and profile, stop sql service. Eventually killing the Message Queuing processes seemed to help then enabling Service Broker started it again.
At this point, I am not sure what caused it, even where to start. Any idea?
The following is the code I use to send out emails.
while exists(select * from EmailsToGo WHERE alert = 0)begin
SELECT TOP 1 @EmailID = EmailID,@Recipients = Recipients,
@Subject = Subject, @Body = Body
FROM EmailsToGo
exec msdb.dbo.sp_send_dbmail @recipients = @Recipients, @subject = @Subject, @body = @Body
UPDATE EmailsToGo SET alert = 1 where EmailID = @EmailID
END
while exists(select * from EmailsToGo WHERE alert = 0) begin select top 1 @EmailID = EmailID,@Recipients = Recipients, @Subject = Subject, @Body = Body from EmailsToGo exec msdb.dbo.sp_send_dbmail @recipients = @Recipients, @subject = @Subject, @body = @Body UPDATE EmailsToGo SET alert = 1 where EmailID = @EmailID ENDI feel like something messed up in msdb or Message Queuing service.