codice:
blocco = Request.QueryString("blocco")
Dim rsutenti
Set rsutenti = Server.CreateObject("ADODB.Recordset")
rsutenti.Open "SELECT * FROM Utenti WHERE Conferma = 1", dbc, 3, 3
if blocco = "" then blocco = 0
send = (blocco*50)
rsutenti.move(send)
bloccosend = 0
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.createObject("CDO.Configuration")
With objConfig
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "serverdiposta"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 300
.Fields.update
End With
Set objMail.Configuration = objConfig
Do While not rsutenti.eof
on error resume next
objMail.From = "newsletter@miosito.it"
objMail.To = rsutenti("UtentiMail")
objMail.Subject = oggettonewsletter
objMail.HTMLBody = newsletter
objMail.Send()
bloccosend = bloccosend + 1
if (bloccosend) = 50 then
dbc.close
set dbc = nothing
' For i = 1 to 140000
' Response.write "wait... "
' Next
Response.Redirect("send_nl.asp?blocco=" & blocco + 1)
end if
rsutenti.movenext
Loop
Set objMail = nothing
Response.Redirect("newsletterinviata.asp")