I'm trying to send email to a group of people using the logic provided by following article: http://www.sqlservercentral.com/columnists/kdas/xp_sendmail.asp
However, I can only send out one email. If I retrieved more than one email addresses, it won't work even though it shown "Mail Sent" multiple times. What did I do wrong?
Here is my code:
########################################
Declare @MyMessage nvarchar (255)
Set @MyMessage = 'Sent out emails'
Declare MyCursor Cursor For
Select email From fs_users Where user_id < 35
Open MyCursor
Fetch Next From MyCursor Into @MyRecipients
While @@Fetch_Status = 0
BEGIN
Exec Master.dbo.xp_sendmail @MyRecipients, @MyMessage
End
Close MyCursor
Deallocate MyCursor
Also, when I hard-coded multiple email addresses, it went out ok.
....
Change the order