nyhedsbrev - server timeout
Har et nyhedsbrev modul som giver problemer.Det har virket fint indtil nu indtil der kom over 300 e-mail
adresser i db'en.
Jeg går ud fra at serveren timeout'er fordi jeg har bygget
i kode forkert op.
Hjælp - det haster som altid :-)
HER ER KODEN:
---------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT"%>
<%SetLocale(1030)%>
<% Server.ScriptTimeout = 600 %>
<%
Dim Conn, aabendb, DSN
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../../db/ep.mdb")
Conn.Open DSN
Set rs = Conn.Execute("SELECT * FROM Nyhedsbrev_indstillinger WHERE Nyhedsbrev_indstillingerID = 1")
mailserver = rs("mailserver")
afsender_email = rs("afsender_email")
afsender_navn = rs("afsender_navn")
modtager_liste = rs("modtager_liste")
subject = Trim(Request.Form("subject"))
interessegruppe = Request.Form("interessegruppe")
body = Trim(Request.Form("MyText"))
body_nyhedsbrevTempTemp = Left((body), 275)
body_nyhedsbrevTemp = body_nyhedsbrevTempTemp & "...."
body_nyhedsbrev = replace(body_nyhedsbrevTemp, vbCrLf, "<BR>")
Select case interessegruppe
Case "Alle"
Set rs = Conn.Execute("SELECT COUNT(KundeEmail) AS antal FROM Kundedatabase WHERE KundeEmail <> ''")
Case "Fritid"
Set rs = Conn.Execute("SELECT COUNT(KundeEmail) AS antal FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeFritid <> ''")
Case "Avl"
Set rs = Conn.Execute("SELECT COUNT(KundeEmail) AS antal FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeAvl <> ''")
Case "Konkurrence"
Set rs = Conn.Execute("SELECT COUNT(KundeEmail) AS antal FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeKonkurrence <> ''")
End Select
Nyhedsbrev_emne = subject
Nyhedsbrev_tekst = body
Nyhedsbrev_interessegruppe = interessegruppe
Nyhedsbrev_tilmeldte = rs("antal")
Nyhedsbrev_afsendt = Date
strSQL = "INSERT INTO Nyhedsbrev_arkiv ("
strSQL = strSQL & "Nyhedsbrev_emne, "
strSQL = strSQL & "Nyhedsbrev_tekst, "
strSQL = strSQL & "Nyhedsbrev_tilmeldte, "
strSQL = strSQL & "Nyhedsbrev_afsendt, "
strSQL = strSQL & "Nyhedsbrev_interessegruppe"
strSQL = strSQL & ") values( "
strSQL = strSQL & "'" & Nyhedsbrev_emne & "', "
strSQL = strSQL & "'" & Nyhedsbrev_tekst & "', "
strSQL = strSQL & "'" & Nyhedsbrev_tilmeldte & "', "
strSQL = strSQL & "'" & Nyhedsbrev_afsendt & "', "
strSQL = strSQL & "'" & Nyhedsbrev_interessegruppe
strSQL = strSQL & "');"
Conn.Execute(strSQL)
Nyhedsbrev_emne = ""
Nyhedsbrev_tekst = ""
Nyhedsbrev_tilmeldte = ""
Nyhedsbrev_afsendt = ""
Nyhedsbrev_interessegruppe = ""
strSQL = "SELECT TOP 1 * FROM Nyhedsbrev_arkiv ORDER BY Nyhedsbrev_afsendt DESC"
set rs = conn.execute(strSQL)
Nyhedsbrev_arkivID = rs("Nyhedsbrev_arkivID")
link = "<p><a href=""http://www.DOMÆNENAVN.dk/indhold/nyhedsbrev.asp?nyhedsbrevid=" & Nyhedsbrev_arkivID & """>Læs hele nyhedsbrevet</a></p>"
css = "<link rel=""stylesheet"" href=""http://www.DOMÆNENAVN.dk/css/nyhedsbrev.css"">"
Select case interessegruppe
Case "Alle"
Set rs = Conn.Execute("SELECT KundeEmail FROM Kundedatabase WHERE KundeEmail <> ''")
Case "Fritid"
Set rs = Conn.Execute("SELECT KundeEmail FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeFritid = '1'")
Case "Avl"
Set rs = Conn.Execute("SELECT KundeEmail FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeAvl = '1'")
Case "Konkurrence"
Set rs = Conn.Execute("SELECT KundeEmail FROM Kundedatabase WHERE KundeEmail <> '' And KundeHestetypeKonkurrence = '1'")
End Select
Set jmail = Server.CreateObject("JMail.SMTPMail")
jmail.ServerAddress = mailserver
jmail.Sender = afsender_email
jmail.SenderName = afsender_navn
jmail.Subject = subject
jmail.HTMLBody = "<html>" & css & "<body>" & body_nyhedsbrev & link & "</body></html>"
jmail.Priority = "3"
''JMail.AddRecipientCC("info@DOMÆNENAVN.dk")
Do While Not rs.EOF
jmail.AddRecipientCC(rs("KundeEmail"))
rs.MoveNext
Loop
If modtager_liste <> "" Then
jmail.HideRecipients = modtager_liste
End If
jmail.Execute()
jmail.Close()
Set jmail = Nothing
Conn.Close
Set Conn = Nothing
response.Redirect("nyhedsbrev_arkiv.asp")
%>