Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13

Discussione: time out

  1. #1

    time out

    ciao

    sto provando questo script di newsletter
    ed ho inserito uno scripttimeout

    <%@ Language=VBScript %>
    <% Option Explicit %>



    <html>
    <head>
    <title>Newsletter - Send Mail</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body topmargin="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
    <%
    Dim rsNews, recipients, strCount, strSQL, iMsg, iConf, Flds, cdoSendUsingPort, cdoSendUsingMethod
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsletter "
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    strCount = 0
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    recipients = recipients & rsNews("email") & ","
    strCount = strCount + 1
    rsNews.MoveNext
    Loop
    recipients = Left(recipients,Len(recipients)-1)
    End If
    rsNews.Close
    Set rsNews = Nothing

    Select Case Request.Form("action")
    Case ""


    server.scripttimeout = 300

    %>
    <div align="center" style="width: 404; height: 1030">






    <form action="mailtutti.asp" method="post">


    <table border="0" cellpadding="0" cellspacing="0" width="100">
    <tr>
    <TD width="25%" height=75><map name="FPMap1">
    <area href="../index.htm" shape="rect" coords="0, 50, 54, 74"></map>[img]../index_file/01.jpg[/img]</TD>
    <TD width="27%">
    <DIV align=center><map name="FPMap0">
    <area href="mailto:info@raffaellodocenti.it" shape="rect" coords="0, 54, 54, 74"></map>[img]../index_file/02.gif[/img]</DIV></TD>
    <TD width="8%">
    <OBJECT
    codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0
    height=75 width=125 classid=clsid27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="movie" VALUE="../banner.swf"><PARAM NAME="quality" VALUE="high">
    <embed src="../banner.swf" quality="high"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash" width="125"
    height="75"></embed></OBJECT></TD>
    <TD width="40%">
    <DIV align=right>[img]../index_file/04.jpg[/img]</DIV></TD>
    </tr>
    </table>


    <span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">
    Ci sono <%= strCount %> utenti nell'archivio.
    </span>
    </form>
    <form action="mailtutti.asp" method="post">
    <input type="hidden" name="action" value="view" /><input type="hidden" name="recipients" value="<%= recipients %>" />

    <table width="50%" border="0" cellpadding="1" cellspacing="0" bgcolor="#333333">
    <tr>
    <td><table width="600" bgcolor="#FFFFFF">
    <tr>
    <td valign="top" width="182"><span class="thrd">Oggetto:</span></td><td width="502"><input type="text" name="nwsubject" size="30" />
    </td>

    </tr>
    <tr>
    <td valign="top" width="182"><span class="thrd">Messaggio:</span></td><td width="502"><textarea name="msg" cols="60" rows="40"></textarea>
    </td>
    </tr>
    <tr>
    <td valign="top" width="182"><input type="radio" name="version" value="html" checked /><span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">HTML</span></td><td width="502">
    <p align="left"><span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold"><input type="radio" name="version" value="Testo" />TEXT</span>
    </p>
    </td>
    </tr>
    <tr>
    <td align="center" width="182"><input type="submit" value="anteprima" /></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </form>
    </div>
    <% Case "view" %>
    <form action="mailtutti.asp" method="post">
    <input type="hidden" name="action" value="Invia" />
    <input type="hidden" name="recipients" value="<%= recipients %>" />
    <input type="hidden" name="nwsubject" size="30" value="<%=Request.Form("nwsubject")%>" />
    <input name="msg" type="hidden" value="<%=Replace(Request.Form("msg"),chr(34),"'") %>">
    <input type="hidden" name="version" value="<%=Request.Form("version")%>" />
    <table width="50%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr>
    <td><table width="100%" align="center" bgcolor="#FFFFFF">
    <tr>
    <td><span class="thrd">Oggetto:</span> <%=Request.Form("nwsubject")%></td>
    </tr>
    <tr>
    <td>Messaggio:</td>
    </tr>
    <tr>
    <td><div align="justify"><%
    If Request.Form("version") = "html" Then
    Response.Write Replace(Request.Form("msg"),chr(34),"'")
    Else
    Response.Write Replace(Request.Form("msg"),Chr(13) & Chr(10),"
    ")
    End If %> </div></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" value="Invia" /></td>
    </tr>
    </table></td>
    </tr>
    </table>


    </form>
    <%
    Case "Invia"
    Dim mailObj, cdoMessage, cdoConfig, addrList, strEmailMsg, subject
    Dim strEmail

    strEmail = Request.Form("recipients")
    subject = Request.form("nwsubject")
    'send email so subscriber can confirm
    ' strEmailMsg = Replace(Request.Form("msg"),Chr(13) & Chr(10),"
    ")
    strEmailMsg = Request.Form("msg")
    ' If Request.Form("version") = "html" Then
    ' strEmailMsg = strEmailMsg & strFooter
    ' Else
    ' strEmailMsg = Replace(strEmailMsg & strFooter,"
    ",Chr(13) & Chr(10))
    ' End If
    'Send email based on mail component.

    'Send email (CDONTS version). Note: CDONTS doesn't support a reply-to
    'address and has no error checking.

    if mailComp = "CDONTS" then
    set mailObj = Server.CreateObject("CDONTS.NewMail")
    If Request.Form("version") = "html" Then
    mailObj.BodyFormat = 0
    mailObj.MailFormat = 0
    Else
    mailObj.BodyFormat = 1
    End If
    mailObj.From = fromAddr
    mailObj.To = strEmail
    mailObj.Subject = subject
    mailObj.Body = strEmailMsg
    mailObj.Send
    set mailObj = Nothing
    end if

    'Send email (CDOSYS version).

    if mailComp = "CDOSYS" then
    set cdoMessage = Server.CreateObject("CDO.Message")
    set cdoConfig = Server.CreateObject("CDO.Configuration")
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
    cdoConfig.Fields.Update
    set cdoMessage.Configuration = cdoConfig
    cdoMessage.From = fromAddr
    cdoMessage.To = fromAddr
    cdoMessage.Bcc = strEmail
    cdoMessage.Subject = subject

    If Request.Form("version") = "html" Then
    cdoMessage.HtmlBody = strEmailMsg
    Else
    cdoMessage.TextBody = strEmailMsg
    End If

    on error resume next
    cdoMessage.Send
    if Err.Number <> 0 then
    SendMail = "Email send failed: " & Err.Description & "."
    end if
    set cdoMessage = Nothing
    set cdoConfig = Nothing
    end if

    'Send email (JMail version).

    if mailComp = "JMail" then
    set mailObj = Server.CreateObject("JMail.SMTPMail")
    mailObj.Silent = true
    mailObj.ServerAddress = smtpServer
    mailObj.Sender = fromAddr
    mailObj.ReplyTo = fromAddr
    mailObj.Subject = subject
    addrList = Split(strEmail, ",")
    for each addr in addrList
    mailObj.AddRecipient Trim(addr)
    next
    If Request.Form("version") = "html" Then mailObj.ContentType = "text/html"
    mailObj.Body = strEmailMsg
    if not mailObj.Execute then
    SendMail = "Email send failed: " & mailObj.ErrorMessage & "."
    end if
    end if

    'Send email (ASPMail version).

    if mailComp = "ASPMail" then
    set mailObj = Server.CreateObject("SMTPsvg.Mailer")
    mailObj.FromAddress = fromAddr
    mailObj.RemoteHost = smtpServer
    mailObj.ReplyTo = fromAddr
    for each addr in Split(strEmail, ",")
    mailObj.AddRecipient "", Trim(addr)
    next
    mailObj.Subject = subject
    If Request.Form("version") = "html" Then mailObj.ContentType = "text/html"
    mailObj.BodyText = strEmailMsg
    if not mailObj.SendMail then
    SendMail = "Email send failed: " & mailObj.Response & "."
    end if
    end if
    If Err.Number <> 0 then
    Response.Write SendMail
    Else
    Response.Write "<div align=""center"">

    " & _
    "<span style=""font-family:arial;font-size:12px;color:#000080;font-weight:bold;text-align:left"">" & _
    "La newsletter è stata inviata con successo!</span></div>"
    End If

    End Select

    If Request.Form("purge") = "yes" Then
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE confirm = 'no';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    If DateDiff("y",rsNews("Date"),Now) > 7 then
    rsNews.delete
    End If
    rsNews.MoveNext
    Loop
    End If
    rsNews.Close
    Set rsNews = Nothing
    End If

    objConn.Close
    Set objConn = Nothing
    %>
    </body>
    </html>



    quando in archivio ne ho un numero elevato il meccanismo si blocca è possibile?


    come faccio ad inviare tutti questi messaggi in maniera + semplice ho inserito anche uno scripttimeout ma niente ............

    fatemi sapere

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Devi inviarle a blocchi.
    Ne abbiamo parlato diverse volte.

    Roby

  3. #3
    Sto provando con un ciclo
    visto su questo forum


    For x = 1 to 50

    'invia email al destinatario

    Next

    l'ho inserito cosi


    <%
    Dim rsNews, recipients, strCount, strSQL, iMsg, iConf, Flds, cdoSendUsingPort, cdoSendUsingMethod
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsletter "
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    strCount = 0
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    recipients = recipients & rsNews("email") & ","
    strCount = strCount + 1
    rsNews.MoveNext
    Loop
    recipients = Left(recipients,Len(recipients)-1)
    End If
    rsNews.Close
    Set rsNews = Nothing

    Select Case Request.Form("action")
    Case ""

    For x = 1 to 50

    'invia email al destinatario

    Next


    server.scripttimeout = 300

    %>


    mi da questo errore

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'x'

    /prova2409/mailtutti.asp, line 33


    come lo devo mettere

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Te lo dice:
    Dim x

    insieme alle altre variabili

    Roby

  5. #5
    ok ora non da errore ma il ciclo non funziona

    bisognava mettere lo script in altro modo????

  6. #6
    guarda che io sto' provando ma questo benedettisimo script non funziona mai perchè????????????????????????????????

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Perché evidentemnte non è ben strutturato..

  8. #8
    si ma un aiuto???

  9. #9
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Riposta lo script... Come hai fatto l'invio a blocchi?

    Roby

  10. #10
    ti rinvio lo script attuale

    <%@ Language=VBScript %>
    <% Option Explicit %>



    <html>
    <head>
    <title>Newsletter - Send Mail</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body topmargin="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
    <%
    Dim rsNews, recipients, strCount, strSQL, iMsg, iConf, Flds, cdoSendUsingPort, cdoSendUsingMethod, x
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsletter "
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    strCount = 0
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    recipients = recipients & rsNews("email") & ","
    strCount = strCount + 1
    rsNews.MoveNext
    Loop
    recipients = Left(recipients,Len(recipients)-1)
    End If
    rsNews.Close
    Set rsNews = Nothing

    Select Case Request.Form("action")
    Case ""

    %>
    <div align="center" style="width: 404; height: 1030">






    <form action="mailtutti.asp" method="post">


    <table border="0" cellpadding="0" cellspacing="0" width="100">
    <tr>
    <TD width="25%" height=75><map name="FPMap1">
    <area href="../index.htm" shape="rect" coords="0, 50, 54, 74"></map>[img]../index_file/01.jpg[/img]</TD>
    <TD width="27%">
    <DIV align=center><map name="FPMap0">
    <area href="mailto:info@raffaellodocenti.it" shape="rect" coords="0, 54, 54, 74"></map>[img]../index_file/02.gif[/img]</DIV></TD>
    <TD width="8%">
    <OBJECT
    codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0
    height=75 width=125 classid=clsid27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="movie" VALUE="../banner.swf"><PARAM NAME="quality" VALUE="high">
    <embed src="../banner.swf" quality="high"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash" width="125"
    height="75"></embed></OBJECT></TD>
    <TD width="40%">
    <DIV align=right>[img]../index_file/04.jpg[/img]</DIV></TD>
    </tr>
    </table>


    <span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">
    Ci sono <%= strCount %> utenti nell'archivio.
    </span>
    </form>
    <form action="mailtutti.asp" method="post">
    <input type="hidden" name="action" value="view" /><input type="hidden" name="recipients" value="<%= recipients %>" />

    <table width="50%" border="0" cellpadding="1" cellspacing="0" bgcolor="#333333">
    <tr>
    <td><table width="600" bgcolor="#FFFFFF">
    <tr>
    <td valign="top" width="182"><span class="thrd">Oggetto:</span></td><td width="502"><input type="text" name="nwsubject" size="30" />
    </td>

    </tr>
    <tr>
    <td valign="top" width="182"><span class="thrd">Messaggio:</span></td><td width="502"><textarea name="msg" cols="60" rows="40"></textarea>
    </td>
    </tr>
    <tr>
    <td valign="top" width="182"><input type="radio" name="version" value="html" checked /><span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">HTML</span></td><td width="502">
    <p align="left"><span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold"><input type="radio" name="version" value="Testo" />TEXT</span>
    </p>
    </td>
    </tr>
    <tr>
    <td align="center" width="182"><input type="submit" value="anteprima" /></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </form>
    </div>
    <% Case "view" %>
    <form action="mailtutti.asp" method="post">
    <input type="hidden" name="action" value="Invia" />
    <input type="hidden" name="recipients" value="<%= recipients %>" />
    <input type="hidden" name="nwsubject" size="30" value="<%=Request.Form("nwsubject")%>" />
    <input name="msg" type="hidden" value="<%=Replace(Request.Form("msg"),chr(34),"'") %>">
    <input type="hidden" name="version" value="<%=Request.Form("version")%>" />
    <table width="50%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr>
    <td><table width="100%" align="center" bgcolor="#FFFFFF">
    <tr>
    <td><span class="thrd">Oggetto:</span> <%=Request.Form("nwsubject")%></td>
    </tr>
    <tr>
    <td>Messaggio:</td>
    </tr>
    <tr>
    <td><div align="justify"><%
    If Request.Form("version") = "html" Then
    Response.Write Replace(Request.Form("msg"),chr(34),"'")
    Else
    Response.Write Replace(Request.Form("msg"),Chr(13) & Chr(10),"
    ")
    End If %> </div></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" value="Invia" /></td>
    </tr>
    </table></td>
    </tr>
    </table>


    </form>
    <%

    dim epv

    Case "Invia"

    EPV = 70

    Dim mailObj, cdoMessage, cdoConfig, addrList, strEmailMsg, subject
    Dim strEmail




    strEmail = Request.Form("recipients")
    subject = Request.form("nwsubject")
    'send email so subscriber can confirm
    ' strEmailMsg = Replace(Request.Form("msg"),Chr(13) & Chr(10),"
    ")
    strEmailMsg = Request.Form("msg")
    ' If Request.Form("version") = "html" Then
    ' strEmailMsg = strEmailMsg & strFooter
    ' Else
    ' strEmailMsg = Replace(strEmailMsg & strFooter,"
    ",Chr(13) & Chr(10))
    ' End If
    'Send email based on mail component.

    'Send email (CDONTS version). Note: CDONTS doesn't support a reply-to
    'address and has no error checking.

    if mailComp = "CDONTS" then
    set mailObj = Server.CreateObject("CDONTS.NewMail")
    If Request.Form("version") = "html" Then
    mailObj.BodyFormat = 0
    mailObj.MailFormat = 0
    Else
    mailObj.BodyFormat = 1
    End If
    mailObj.From = fromAddr
    mailObj.To = strEmail
    mailObj.Subject = subject
    mailObj.Body = strEmailMsg
    mailObj.Send
    set mailObj = Nothing
    end if

    'Send email (CDOSYS version).

    if mailComp = "CDOSYS" then
    set cdoMessage = Server.CreateObject("CDO.Message")
    set cdoConfig = Server.CreateObject("CDO.Configuration")
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
    cdoConfig.Fields.Update
    set cdoMessage.Configuration = cdoConfig
    cdoMessage.From = fromAddr
    cdoMessage.To = fromAddr
    cdoMessage.Bcc = strEmail
    cdoMessage.Subject = subject

    If Request.Form("version") = "html" Then
    cdoMessage.HtmlBody = strEmailMsg
    Else
    cdoMessage.TextBody = strEmailMsg
    End If

    on error resume next
    cdoMessage.Send
    if Err.Number <> 0 then
    SendMail = "Email send failed: " & Err.Description & "."
    end if
    set cdoMessage = Nothing
    set cdoConfig = Nothing
    end if

    'Send email (JMail version).





    if mailComp = "JMail" then
    set mailObj = Server.CreateObject("JMail.SMTPMail")
    mailObj.Silent = true
    mailObj.ServerAddress = smtpServer
    mailObj.Sender = fromAddr
    mailObj.ReplyTo = fromAddr
    mailObj.Subject = subject
    addrList = Split(strEmail, ",")
    for each addr in addrList
    mailObj.AddRecipient Trim(addr)
    next
    If Request.Form("version") = "html" Then mailObj.ContentType = "text/html"
    mailObj.Body = strEmailMsg
    if not mailObj.Execute then
    SendMail = "Email send failed: " & mailObj.ErrorMessage & "."
    end if
    end if

    'Send email (ASPMail version).

    if mailComp = "ASPMail" then
    set mailObj = Server.CreateObject("SMTPsvg.Mailer")
    mailObj.FromAddress = fromAddr
    mailObj.RemoteHost = smtpServer
    mailObj.ReplyTo = fromAddr
    for each addr in Split(strEmail, ",")
    mailObj.AddRecipient "", Trim(addr)
    next
    mailObj.Subject = subject
    If Request.Form("version") = "html" Then mailObj.ContentType = "text/html"
    mailObj.BodyText = strEmailMsg
    if not mailObj.SendMail then
    SendMail = "Email send failed: " & mailObj.Response & "."
    end if
    end if
    If Err.Number <> 0 then
    Response.Write SendMail
    Else
    Response.Write "<div align=""center"">

    " & _
    "<span style=""font-family:arial;font-size:12px;color:#000080;font-weight:bold;text-align:left"">" & _
    "La newsletter è stata inviata con successo!</span></div>"
    End If

    End Select

    If Request.Form("purge") = "yes" Then
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE confirm = 'no';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    If DateDiff("y",rsNews("Date"),Now) > 7 then
    rsNews.delete
    End If
    rsNews.MoveNext
    Loop
    End If
    rsNews.Close
    Set rsNews = Nothing
    End If

    objConn.Close
    Set objConn = Nothing
    %>
    </body>
    </html>





    vedi te se ci capisci qualcosa

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.