-
1 Attachment(s)
Newsletter
Hi, I created this script for a newsletter.
The user insert one or more news in the database and the script send it to all the contacts and then check them as sent.
Code:
<%
Const adOpenKeyset = 1
Dim cn : Set cn = Server.CreateObject("ADODB.Connection")
Dim strConn, strLogin, strPassword
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & server.MapPath("db.mdb") &" ;Persist Security Info=False"
cn.open strConn
dim rsNewsletter,sqlNewsletter
Set rsNewsletter = Server.CreateObject("ADODB.Recordset")
rsNewsletter.CursorLocation = 2
sqlNewsletter="select * from tabNewsletter where inviato=false"
rsNewsletter.Open sqlNewsletter, cn, adOpenKeyset
If Not rsNewsletter.EOF then
dim rsEmail,sqlEmail
Set rsEmail = Server.CreateObject("ADODB.Recordset")
rsEmail.CursorLocation = 2
sqlEmail="select email from tabContatti"
rsEmail.Open sqlEmail, cn, adOpenKeyset
perpage = 10
If Request.QueryString("p") = "" then
p = 1
else
p=cint("0"&Request.QueryString("p"))
End if
If rsEmail.recordcount>0 then
rsEmail.PageSize = perpage
rsEmail.AbsolutePage = p
end if
totpag = rsEmail.PageCount
For i = 1 to perpage
If Not rsEmail.EOF then
'codice che invia le email
rsEmail.MoveNext
end if
next
if p<totpag then
response.redirect("newsletter.asp?p="&p+1)
else
rsEmail.close
set rsEmail=nothing
end if
sqlUpdCnt="update tabNewsletter set inviato=true where idNewsletter=" & rsNewsletter("idNewsletter")
cn.execute sqlUpdCnt
response.redirect("newsletter.asp")
end if
rsNewsletter.close
set rsNewsletter=Nothing
response.write "finito"
%>
Everything works till the tenth cycle, then it gives a generic error, practically "page connot be displayed":
Code:
Internet Explorer: impossibile visualizzare la pagina Web
Cause più probabili:
Nessuna connessione a Internet.
Si sono verificati problemi relativi al sito Web.
È possibile che nell'indirizzo sia presente un errore di digitazione.
Possibili operazioni:
Diagnostica problemi di connessione
Ulteriori informazioni
Le cause del problema possono essere diverse, ad esempio:
La connessione a Internet è stata interrotta.
Il sito Web non è attualmente disponibile.
Il DNS (Domain Name Server) non è raggiungibile.
Il DNS (Domain Name Server) non dispone di un elenco per il dominio del sito Web.
Se si tratta di un indirizzo HTTPS (protetto), scegliere Opzioni Internet dal menu Strumenti, fare clic su Avanzate e verificare che i protocolli SSL e TLS siano abilitati nella sezione Protezione.
Per utenti non in linea
È tuttavia possibile visualizzare i feed sottoscritti e alcune pagine Web visualizzate di recente.
Per visualizzare i feed sottoscritti
Fare clic sul pulsante Centro Preferiti , quindi su Feed e infine sul feed da visualizzare.
Per visualizzare le pagine Web visitate di recente (è possibile che non tutte le pagine vengano visualizzate)
Scegliere Strumenti , quindi Non in linea.
Fare clic sul pulsante Centro Preferiti , quindi su Cronologia e infine sulla pagina da visualizzare.
But if the mail are less than 110 (less than 10 cycles) everything works correctly.
In the attachement you can find a zip file containing the asp page and the mdb file to test the script.
You only need to put the two files in a web folder and then open the newsletter page from localhost.
Thanks to all the ones who will help me.
-
Re: Newsletter
If you go into Internet Explorer, Tools, Internet Options, Advanced, and turn off "Friendly Error Messages" (or Italian equivalent), then it should tell you which line fails...
Out of interest, why did you set a pagesize in this manner? What use is it to have paging in effect for this application?
You might find this helpful:
http://www.asp101.com/articles/recor...ging/index.asp