Proprio non riesco... ossia il codice funziona bene la tabella si aggiorna esegue l'invio di 4 email per volta, ma nel msg email recapitato al mittente si trovano altre password oltre alla sua
:
codice:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova pagina 1</title>
</head>
<body>
<%
Session.Timeout = 45
session.lcid = 1040
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Function JSRedirect(Byval secondi)
With Response
.Write("<script language=""JavaScript"">" & vbCrLf)
.Write("<!--" & vbCrLf)
.Write("function redirect() {" & vbCrLf)
.Write("window.location = '" & url & "';" & vbCrLf)
.Write("}" & vbCrLf)
.Write("timer = setTimeout('redirect()', '" & (secondi * 1000) & "');" & vbCrLf)
.Write("-->" & vbCrLf)
.Write("</script>" & vbCrLf)
End With
End Function
SQL = "SELECT * FROM tbl_login2 "
SQL = SQL & " WHERE ( login1 IS NOT NULL ) "
SQL = SQL & " AND ( login1 <> '' ) "
SQL = SQL & " AND ( esitoEmail = 0 ) "
SQL = SQL & " LIMIT 4 "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open SQL, objconn
if objRS.eof then
response.write "ko"
else
Const cdoSendUsingMethod = _
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = _
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = _
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
while not objRS.eof
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "localhost"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
messaggio = messaggio & VBcrlf & "LOGIN = " & objRS.fields("login1") & "
"
messaggio = messaggio & VBcrlf & "PASSWORD = " & objRS.fields("password1") & "
"
messaggio = messaggio & VBcrlf & "E-MAIL = " & objRS.fields("EMail") & "
"
With objMessage
.To = objRS.fields("EMail")
.From = "autoreply@com.com"
.Subject = "Risposta automatica"
.HtmlBody = messaggio
.Send
End With
str_update = "UPDATE tbl_login2 SET "
str_update = str_update & " EsitoEmail = 1 "
str_update = str_update & " WHERE id = "& objRS("Id")
objconn.execute (str_update)
response.write "id:"& objRS.fields("ID") &"-"
response.write "Nome:"& objRS.fields("Nome") &"-"
response.write "Il messaggio è stato spedito a:"& objRS.fields("EMail") &"
"
objRS.movenext
wend
response.write (JSRedirect(5))
end if
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</body>
</html>