Im trying for weeks to send e mail to all the registered users on my web. I use this procedure:
I call the procedure using for next loop:
when myDS is a dataset that contain my e mail list (something like 600).
The problem is that the program get stuck again and again. I tried everything I know, including running the loop for no more then 20 rows each time, in the third circle it got stuck.
What do I do wrong? Or other vise, do anybody knows a better way to send mail to the site users (not using the outlook express list, because I don't want my list to go to any user.)
Please help!
Code:
Sub Mailshot(ByVal adress As String, ByVal subject As String, ByVal body As String)
Dim msgmail As MailMessage = New MailMessage()
SmtpMail.SmtpServer = "smtp.012.net.il"
msgmail.From = "shoresh<shoresh@shoresh.org.il>"
Try
msgmail.To = adress
msgmail.Body = body
msgmail.Subject = subject
msgmail.BodyFormat = MailFormat.Html
SmtpMail.Send(msgmail)
Catch exc As Exception
'DO WHATEVER ERROR HANDLING
End Try
msgmail = Nothing
End Sub
I call the procedure using for next loop:
Code:
For i = fromnumber.Text To tonumber.Text
email = Trim(myDS.Tables(0).Rows(i).Item(0))
b = "<body dir=rtl><div align=center><table width=600><tr><td><BR><div align=center><a href='http://www.shoresh.org.il'><img src='http://www.shoresh.org.il/Images/menu2/logo.jpg' width=428 height=38 border=0></a></div><BR><BR><BR>"
b = b & "<font face='tahoma' size=2>" & Trim(body.Text) & "<BR>"
Mailshot(email, Trim(subject.Text), b)
Next
when myDS is a dataset that contain my e mail list (something like 600).
The problem is that the program get stuck again and again. I tried everything I know, including running the loop for no more then 20 rows each time, in the third circle it got stuck.
What do I do wrong? Or other vise, do anybody knows a better way to send mail to the site users (not using the outlook express list, because I don't want my list to go to any user.)
Please help!