Forum Moderators: open
<%
Response.buffer = True
'Loop until we've hit the EOF (end of file)
Do Until RS.EOF = True
Dim strHTML
strHTML = "<html><head><title>Test Email</title></head>"
strHTML = strHTML & "<body bgcolor=#FFFFFF>"
strHTML = strHTML & "Hi " & RS("Fname") & " " & objRS("Lname") & "<BR><BR>"
strHTML = strHTML & RS("Body")
strHTML = strHTML & "</body></html>"
'Set up the email object
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
With objMail
.From = RS("efrom")
.To = RS("Email")
.Subject = RS("Subject")
.BodyFormat = 0 'CdoBodyFormatHTML
.MailFormat = 0 'CdoMailFormatMime
.Body = strHTML
.Send
Response.Write "<BR>Your e-mail to " & RS("Email") & " has been sent. <BR>"
Response.flush
End With
Set objMail = Nothing
RS.MoveNext
EndTime = Now() + (7 / (24 * 60* 60)) '7 seconds
Do While Now() < EndTime
'Do nothing
Loop
Loop
%>
my total records are 50,000 in database
when i execute this code, my system slow down and after NO page display error comes.
I want some code with work with any number of record.
Also, take out your variable Dims inside the loops and move them up to the top of the page and that the variable cleanup code and move it below loop.
Taking out the wait and moving the declarations will really help.